83130fbbc7f9 v0.0.6

HUD highlighting, wrapping and more.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 13 Jun 2011 20:43:36 -0400
parents 7db534146a3e
children 9539ae8686cd
branches/tags v0.0.6
files doc/threesome.txt plugin/threesomelib/init.py plugin/threesomelib/modes.py syntax/threesome.vim

Changes

--- a/doc/threesome.txt	Mon Jun 13 19:05:27 2011 -0400
+++ b/doc/threesome.txt	Mon Jun 13 20:43:36 2011 -0400
@@ -56,6 +56,7 @@
         5.13 threesome_initial_scrollbind_compare .. |ThreesomeConfig-is_compare|
         5.14 threesome_initial_scrollbind_path ..... |ThreesomeConfig-is_path|
         5.15 threesome_initial_mode ................ |ThreesomeConfig-im|
+        5.16 threesome_wrap ........................ |ThreesomeConfig-wrap|
     6. License ..................................... |ThreesomeLicense|
     7. Bugs ........................................ |ThreesomeBugs|
     8. Contributing ................................ |ThreesomeContributing|
@@ -561,6 +562,17 @@
 Options: "grid", "loupe", "compare", or "path"
 Default: "grid"
 
+------------------------------------------------------------------------------
+5.16 g:threesome_wrap                                   *ThreesomeConfig-wrap*
+
+Set this to "wrap" or "nowrap" to set |wrap| or |nowrap| on all windows by
+default.
+
+By default Threesome will use your default settings.
+
+Options: "wrap", "nowrap"
+Default: None (use the default settings)
+
 ==============================================================================
 6. License                                                  *ThreesomeLicense*
 
@@ -588,6 +600,9 @@
 ==============================================================================
 9. Changelog                                              *ThreesomeChangelog*
 
+v0.0.6
+    * Add the HUD.
+    * Configurable wrapping.
 v0.0.5
     * Configurable scrollbinding.
 v0.0.4
--- a/plugin/threesomelib/init.py	Mon Jun 13 19:05:27 2011 -0400
+++ b/plugin/threesomelib/init.py	Mon Jun 13 20:43:36 2011 -0400
@@ -55,23 +55,34 @@
     buffers.original.open()
     vim.command('setlocal noswapfile')
     vim.command('setlocal nomodifiable')
+    if setting('wrap'):
+        vim.command('setlocal ' + setting('wrap'))
 
     buffers.one.open()
     vim.command('setlocal noswapfile')
     vim.command('setlocal nomodifiable')
+    if setting('wrap'):
+        vim.command('setlocal ' + setting('wrap'))
 
     buffers.two.open()
     vim.command('setlocal noswapfile')
     vim.command('setlocal nomodifiable')
+    if setting('wrap'):
+        vim.command('setlocal ' + setting('wrap'))
+
+    buffers.result.open()
+    if setting('wrap'):
+        vim.command('setlocal ' + setting('wrap'))
 
     buffers.hud.open()
     vim.command('setlocal noswapfile')
     vim.command('setlocal nomodifiable')
     vim.command('setlocal nobuflisted')
     vim.command('setlocal buftype=nofile')
-    vim.command('setlocal winfixheight')
     vim.command('setlocal noundofile')
     vim.command('setlocal nolist')
+    vim.command('setlocal ft=threesome')
+    vim.command('setlocal nowrap')
     vim.command('resize ' + setting('hud_size', '3'))
 
 def create_hud():
--- a/plugin/threesomelib/modes.py	Mon Jun 13 19:05:27 2011 -0400
+++ b/plugin/threesomelib/modes.py	Mon Jun 13 20:43:36 2011 -0400
@@ -36,6 +36,8 @@
             for buffer in buffers.all:
                 buffer.open()
                 vim.command('diffoff')
+                if setting('wrap'):
+                    vim.command('setlocal ' + setting('wrap'))
 
             curbuffer.open()
 
@@ -99,7 +101,6 @@
     def activate(self):
         self.layout(self._current_layout)
         self.diff(self._current_diff_mode)
-
         self.scrollbind(self._current_scrollbind)
 
 
@@ -112,6 +113,13 @@
         vim.command(r'exe "normal! ?\=\=\=\=\=\=\=\<cr>"')
 
 
+    def open_hud(self, winnr):
+        windows.split()
+        windows.focus(winnr)
+        buffers.hud.open()
+        vim.command('wincmd K')
+        self.redraw_hud()
+
     def hud_lines(self):
         def pad(lines):
             l = max([len(line) for line in lines])
@@ -141,6 +149,9 @@
         for i, line in enumerate(commands):
             lines[i] += line + sep
 
+        for i, line in enumerate(lines):
+            lines[i] = line.rstrip()
+
         return lines
 
     def redraw_hud(self):
@@ -210,11 +221,9 @@
         windows.focus(4)
         buffers.result.open()
 
-        # HUD
-        windows.split()
+        self.open_hud(5)
+
         windows.focus(5)
-        buffers.hud.open()
-        vim.command('wincmd K')
 
     def _layout_1(self):
         self._number_of_windows = 3
@@ -235,11 +244,9 @@
         windows.focus(3)
         buffers.two.open()
 
-        # HUD
-        windows.split()
-        windows.focus(4)
-        buffers.hud.open()
-        vim.command('wincmd K')
+        self.open_hud(4)
+
+        windows.focus(3)
 
     def _layout_2(self):
         self._number_of_windows = 4
@@ -260,11 +267,9 @@
         windows.focus(3)
         buffers.two.open()
 
-        # HUD
-        windows.split()
-        windows.focus(4)
-        buffers.hud.open()
-        vim.command('wincmd K')
+        self.open_hud(4)
+
+        windows.focus(3)
 
 
     def _diff_0(self):
@@ -373,11 +378,9 @@
         windows.focus(1)
         self._current_buffer.open()
 
-        # HUD
-        windows.split()
+        self.open_hud(2)
+
         windows.focus(2)
-        buffers.hud.open()
-        vim.command('wincmd K')
 
 
     def key_original(self):
@@ -470,11 +473,9 @@
         windows.focus(2)
         self._current_buffer_second.open()
 
-        # HUD
-        windows.split()
+        self.open_hud(3)
+
         windows.focus(3)
-        buffers.hud.open()
-        vim.command('wincmd K')
 
     def _layout_1(self):
         self._number_of_windows = 2
@@ -491,11 +492,9 @@
         windows.focus(2)
         self._current_buffer_second.open()
 
-        # HUD
-        windows.split()
+        self.open_hud(3)
+
         windows.focus(3)
-        buffers.hud.open()
-        vim.command('wincmd K')
 
 
     def key_original(self):
@@ -705,11 +704,9 @@
         windows.focus(3)
         buffers.result.open()
 
-        # HUD
-        windows.split()
+        self.open_hud(4)
+
         windows.focus(4)
-        buffers.hud.open()
-        vim.command('wincmd K')
 
     def _layout_1(self):
         self._number_of_windows = 3
@@ -730,11 +727,9 @@
         windows.focus(3)
         buffers.result.open()
 
-        # HUD
-        windows.split()
+        self.open_hud(4)
+
         windows.focus(4)
-        buffers.hud.open()
-        vim.command('wincmd K')
 
 
     def key_original(self):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syntax/threesome.vim	Mon Jun 13 20:43:36 2011 -0400
@@ -0,0 +1,13 @@
+let b:current_syntax = 'threesome'
+
+syn match ThreesomeModes '\v^[^|]+'
+syn match ThreesomeLayout '\v\|[^\|]+\|'
+syn match ThreesomeCommands '\v[^\|]+\|$'
+syn match ThreesomeHeading '\v(Threesome Modes|Threesome Commands|Layout -\>)' contained containedin=ThreesomeModes,ThreesomeLayout,ThreesomeCommands
+syn match ThreesomeSep '\v\|' contained containedin=ThreesomeLayout,ThreesomeCommands
+syn match ThreesomeCurrentMode '\v\*\S+' contained containedin=ThreesomeModes
+
+hi def link ThreesomeSep Comment
+hi def link ThreesomeHeading Comment
+hi def link ThreesomeModes Normal
+hi def link ThreesomeCurrentMode Keyword