aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/diff.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-27 17:18:05 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-27 17:18:05 +1200
commit673c96515da477e2a4f14d9466153ff0874777aa (patch)
treeb468bedc1fb438fd582275800e3482fbd758e08c /vim/after/ftplugin/diff.vim
parentCorrect a comment (diff)
downloaddotfiles-673c96515da477e2a4f14d9466153ff0874777aa.tar.gz
dotfiles-673c96515da477e2a4f14d9466153ff0874777aa.zip
Improve diff block navigation in Vim with function
Diffstat (limited to 'vim/after/ftplugin/diff.vim')
-rw-r--r--vim/after/ftplugin/diff.vim18
1 files changed, 15 insertions, 3 deletions
diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim
index 798c7089..a52b3fdd 100644
--- a/vim/after/ftplugin/diff.vim
+++ b/vim/after/ftplugin/diff.vim
@@ -8,13 +8,25 @@ if exists('g:no_plugin_maps') || exists('g:no_diff_maps')
finish
endif
-" Modify curly braces to navigate by diff block
+" Maps using autoloaded function for quoted block movement
nnoremap <buffer> <silent> <LocalLeader>[
- \ :call search('\m^@@', 'bW')<CR>
+ \ :<C-U>call diff#MoveBlock(v:count1, 1, 0)<CR>
nnoremap <buffer> <silent> <LocalLeader>]
- \ :call search('\m^@@', 'W')<CR>
+ \ :<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