aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/diff.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-27 17:18:35 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-27 17:18:35 +1200
commit3f73517e2dd1be08af6588b3d49cf470e0fb4acd (patch)
treee0ca1e212d04029ba5e20119a702b42409c6359c /vim/after/ftplugin/diff.vim
parentMerge branch 'release/v1.61.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-3f73517e2dd1be08af6588b3d49cf470e0fb4acd.tar.gz
dotfiles-3f73517e2dd1be08af6588b3d49cf470e0fb4acd.zip
Merge branch 'release/v1.62.0'v1.62.0
* release/v1.62.0: Bump VERSION Improve diff block navigation in Vim with function Correct a comment Silence Vim diff section navigation maps Use local leader keys in Vim diff section nav maps Use search() in Vim diff section navigation maps
Diffstat (limited to 'vim/after/ftplugin/diff.vim')
-rw-r--r--vim/after/ftplugin/diff.vim24
1 files changed, 19 insertions, 5 deletions
diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim
index eecc8b8c..a52b3fdd 100644
--- a/vim/after/ftplugin/diff.vim
+++ b/vim/after/ftplugin/diff.vim
@@ -8,11 +8,25 @@ if exists('g:no_plugin_maps') || exists('g:no_diff_maps')
finish
endif
-" Modify curly braces to navigate by diff block
-nnoremap <buffer> { ?^@@<CR>
-nnoremap <buffer> } /^@@<CR>
-let b:undo_ftplugin .= '|nunmap <buffer> {'
- \ . '|nunmap <buffer> }'
+" Maps using autoloaded function for quoted block movement
+nnoremap <buffer> <silent> <LocalLeader>[
+ \ :<C-U>call diff#MoveBlock(v:count1, 1, 0)<CR>
+nnoremap <buffer> <silent> <LocalLeader>]
+ \ :<C-U>call diff#MoveBlock(v:count1, 0, 0)<CR>
+onoremap <buffer> <silent> <LocalLeader>[
+ \ :<C-U>call diff#MoveBlock(v:count1, 1, 0)<CR>
+onoremap <buffer> <silent> <LocalLeader>]
+ \ :<C-U>call diff#MoveBlock(v:count1, 0, 0)<CR>
+xnoremap <buffer> <silent> <LocalLeader>[
+ \ :<C-U>call diff#MoveBlock(v:count1, 1, 1)<CR>
+xnoremap <buffer> <silent> <LocalLeader>]
+ \ :<C-U>call diff#MoveBlock(v:count1, 0, 1)<CR>
+let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>['
+ \ . '|nunmap <buffer> <LocalLeader>]'
+ \ . '|ounmap <buffer> <LocalLeader>['
+ \ . '|ounmap <buffer> <LocalLeader>]'
+ \ . '|xunmap <buffer> <LocalLeader>['
+ \ . '|xunmap <buffer> <LocalLeader>]'
" Set mappings
nmap <buffer> <LocalLeader>p