Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix in-between line movement.

  • Loading branch information...
commit d64027b08072089fe14c1496f98b80ccb1b835d0 1 parent 95d53c5
authored October 12, 2010

Showing 1 changed file with 12 additions and 6 deletions. Show diff stats Hide diff stats

  1. 18  plugin/gundo.vim
18  plugin/gundo.vim
@@ -23,12 +23,15 @@ endif
23 23
 
24 24
 "{{{ Movement Mappings
25 25
 function! s:GundoMoveUp()
  26
+    let start_line = getline('.')
26 27
     if line('.') - 2 <= 4
27  
-        return
  28
+        call cursor(5, 0)
  29
+    elseif stridx(start_line, '[') == -1
  30
+        call cursor(line('.') - 1, 0)
  31
+    else
  32
+        call cursor(line('.') - 2, 0)
28 33
     endif
29 34
 
30  
-    call cursor(line('.') - 2, 0)
31  
-
32 35
     let line = getline('.')
33 36
     let idx1 = stridx(line, '@')
34 37
     let idx2 = stridx(line, 'o')
@@ -44,12 +47,15 @@ function! s:GundoMoveUp()
44 47
 endfunction
45 48
 
46 49
 function! s:GundoMoveDown()
  50
+    let start_line = getline('.')
47 51
     if line('.') + 2 >= line('$')
48  
-        return
  52
+        call cursor(line('$') - 1, 0)
  53
+    elseif stridx(start_line, '[') == -1
  54
+        call cursor(line('.') + 1, 0)
  55
+    else
  56
+        call cursor(line('.') + 2, 0)
49 57
     endif
50 58
 
51  
-    call cursor(line('.') + 2, 0)
52  
-
53 59
     let line = getline('.')
54 60
     let idx1 = stridx(line, '@')
55 61
     let idx2 = stridx(line, 'o')

0 notes on commit d64027b

Please sign in to comment.
Something went wrong with that request. Please try again.