7eecd2329bf0

add remapping options for graph navigation keys
[view raw] [browse files]
author Nathan Howell <nath@nhowell.net>
date Sun, 27 Feb 2011 15:53:34 -0800
parents c839b22aa015
children 9cc5f6d3bcb8
branches/tags (none)
files doc/gundo.txt plugin/gundo.vim

Changes

--- a/doc/gundo.txt	Wed Dec 29 15:16:33 2010 -0800
+++ b/doc/gundo.txt	Sun Feb 27 15:53:34 2011 -0800
@@ -14,6 +14,8 @@
         3.4 gundo_right ............... |gundo_right|
         3.5 gundo_help ................ |gundo_help|
         3.6 gundo_disable ............. |gundo_disable|
+        3.7 gundo_map_move_older ...... |gundo_map_move_older|
+            gundo_map_move_newer ...... |gundo_map_move_newer|
     4. License ........................ |GundoLicense|
     5. Bugs ........................... |GundoBugs|
     6. Contributing ................... |GundoContributing|
@@ -176,6 +178,16 @@
 
 Default: 0 (Gundo is enabled as usual)
 
+------------------------------------------------------------------------------
+3.7 g:gundo_map_move_older,g:gundo_map_move_newer       *gundo_map_move_older*
+                                                        *gundo_map_move_newer*
+
+These options let you change the keys that navigate the undo graph. This is
+useful if you use a Dvorak keyboard and have changed your movement keys.
+
+Default: gundo_map_move_older = "j"
+         gundo_map_move_newer = "k"
+
 ==============================================================================
 4. License                                                      *GundoLicense*
 
--- a/plugin/gundo.vim	Wed Dec 29 15:16:33 2010 -0800
+++ b/plugin/gundo.vim	Sun Feb 27 15:53:34 2011 -0800
@@ -426,10 +426,16 @@
 "{{{ Gundo buffer settings
 
 function! s:GundoMapGraph()"{{{
+    if !exists("g:gundo_map_move_older")
+        let g:gundo_map_move_older = 'j'
+    endif
+    if !exists("g:gundo_map_move_newer")
+        let g:gundo_map_move_newer = 'k'
+    endif
+    exec 'nnoremap <script> <silent>'.g:gundo_map_move_older." :call <sid>GundoMove(1)<CR>"
+    exec 'nnoremap <script> <silent>'.g:gundo_map_move_newer." :call <sid>GundoMove(-1)<CR>"
     nnoremap <script> <silent> <buffer> <CR>          :call <sid>GundoRevert()<CR>
     nnoremap <script> <silent> <buffer> o             :call <sid>GundoRevert()<CR>
-    nnoremap <script> <silent> <buffer> j             :call <sid>GundoMove(1)<CR>
-    nnoremap <script> <silent> <buffer> k             :call <sid>GundoMove(-1)<CR>
     nnoremap <script> <silent> <buffer> <down>        :call <sid>GundoMove(1)<CR>
     nnoremap <script> <silent> <buffer> <up>          :call <sid>GundoMove(-1)<CR>
     nnoremap <script> <silent> <buffer> gg            gg:call <sid>GundoMove(1)<CR>