Steve Losh avatar Steve Losh committed 83130fb

HUD highlighting, wrapping and more.

Comments (0)

Files changed (4)

doc/threesome.txt

         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|
 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*
 
 ==============================================================================
 9. Changelog                                              *ThreesomeChangelog*
 
+v0.0.6
+    * Add the HUD.
+    * Configurable wrapping.
 v0.0.5
     * Configurable scrollbinding.
 v0.0.4

plugin/threesomelib/init.py

     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():

plugin/threesomelib/modes.py

             for buffer in buffers.all:
                 buffer.open()
                 vim.command('diffoff')
+                if setting('wrap'):
+                    vim.command('setlocal ' + setting('wrap'))
 
             curbuffer.open()
 
     def activate(self):
         self.layout(self._current_layout)
         self.diff(self._current_diff_mode)
-
         self.scrollbind(self._current_scrollbind)
 
 
         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])
         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):
         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
         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
         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):
         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):
         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
         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):
         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
         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):

syntax/threesome.vim

+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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.