338639048930

Start the use hunk functionality.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 13 Jun 2011 21:18:06 -0400
parents 0797e3cc5020
children d4684baf9cfe
branches/tags (none)
files plugin/threesome.py plugin/threesome.vim plugin/threesomelib/init.py plugin/threesomelib/modes.py

Changes

--- a/plugin/threesome.py	Mon Jun 13 21:17:54 2011 -0400
+++ b/plugin/threesome.py	Mon Jun 13 21:18:06 2011 -0400
@@ -63,3 +63,6 @@
 def ThreesomePrev():
     threesome.modes.current_mode.key_prev()
 
+def ThreesomeUse():
+    threesome.modes.current_mode.key_use()
+
--- a/plugin/threesome.vim	Mon Jun 13 21:17:54 2011 -0400
+++ b/plugin/threesome.vim	Mon Jun 13 21:18:06 2011 -0400
@@ -152,6 +152,9 @@
 function! s:ThreesomePrev()"{{{
     python ThreesomePrev()
 endfunction"}}}
+function! s:ThreesomeUse()"{{{
+    python ThreesomeUse()
+endfunction"}}}
 
 "}}}
 
@@ -175,6 +178,7 @@
 command! -nargs=0 ThreesomeLayout call s:ThreesomeLayout()
 command! -nargs=0 ThreesomeNext call s:ThreesomeNext()
 command! -nargs=0 ThreesomePrev call s:ThreesomePrev()
+command! -nargs=0 ThreesomeUse call s:ThreesomeUse()
 
 "}}}
 
--- a/plugin/threesomelib/init.py	Mon Jun 13 21:17:54 2011 -0400
+++ b/plugin/threesomelib/init.py	Mon Jun 13 21:18:06 2011 -0400
@@ -47,6 +47,7 @@
     keys.bind('n', ':ThreesomeNext<cr>')
     keys.bind('N', ':ThreesomePrev<cr>')
     keys.bind('<space>', ':ThreesomeLayout<cr>')
+    keys.bind('u', ':ThreesomeUse<cr>')
 
     keys.bind('q', ':wa<cr>:qa<cr>')
     keys.bind('CC', ':cq<cr>')
--- a/plugin/threesomelib/modes.py	Mon Jun 13 21:17:54 2011 -0400
+++ b/plugin/threesomelib/modes.py	Mon Jun 13 21:18:06 2011 -0400
@@ -596,7 +596,18 @@
 
 
     def key_use(self):
-        pass
+        active = (self._current_buffer_first, self._current_buffer_second)
+
+        if buffers.result not in active:
+            return
+
+        if buffers.one not in active and buffers.two not in active:
+            return
+
+        if buffers.current == buffers.result:
+            vim.command('diffget')
+        elif buffers.current in (buffers.one, buffers.two):
+            vim.command('diffput')
 
 
     def goto_result(self):