aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-27 16:39:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-27 16:39:30 +1200
commit292ffffacbb29774ba4703969c55c826a22e1c8b (patch)
treef81eae6fa3758a9bfb41993231483cf91922deb9
parentMerge branch 'release/v1.61.0' into develop (diff)
downloaddotfiles-292ffffacbb29774ba4703969c55c826a22e1c8b.tar.gz
dotfiles-292ffffacbb29774ba4703969c55c826a22e1c8b.zip
Use search() in Vim diff section navigation maps
This preserves the user's primary search pattern.
-rw-r--r--vim/after/ftplugin/diff.vim6
1 files changed, 4 insertions, 2 deletions
diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim
index eecc8b8c..31403cc3 100644
--- a/vim/after/ftplugin/diff.vim
+++ b/vim/after/ftplugin/diff.vim
@@ -9,8 +9,10 @@ if exists('g:no_plugin_maps') || exists('g:no_diff_maps')
endif
" Modify curly braces to navigate by diff block
-nnoremap <buffer> { ?^@@<CR>
-nnoremap <buffer> } /^@@<CR>
+nnoremap <buffer> {
+ \ :call search('\m^@@', 'bW')<CR>
+nnoremap <buffer> {
+ \ :call search('\m^@@', 'W')<CR>
let b:undo_ftplugin .= '|nunmap <buffer> {'
\ . '|nunmap <buffer> }'