]> git.rmz.io Git - dotfiles.git/commitdiff
vim: reinstate K -> "git show" map in gitrebase
authorSamir Benmendil <me@rmz.io>
Fri, 11 Mar 2022 08:38:53 +0000 (08:38 +0000)
committerSamir Benmendil <me@rmz.io>
Fri, 11 Mar 2022 08:38:53 +0000 (08:38 +0000)
This got removed upstream, but I found it really useful.

There might be a better way of doing this, but this works.

vim/ftplugin/gitrebase.vim

index 08a174094db60ce29e6e106773a149b1cea20a3d..897aaf69fb8e7bae33170439c080a68e3ba47b70 100644 (file)
@@ -6,3 +6,11 @@ nnoremap <buffer> <nowait> <leader>e :Edit<cr>
 nnoremap <buffer> <nowait> <leader>r :Reword<cr>
 nnoremap <buffer> <nowait> <leader>f :Fixup<cr>
 nnoremap <buffer> <nowait> <leader>d :Drop<cr>
+
+" used to be part of vim, now removed see
+" https://github.com/tpope/vim-git/commit/3a96b1bca
+" https://github.com/tpope/vim-git/commit/6ee5e1f20
+let &l:keywordprg = 'git show'
+nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K'
+
+let b:undo_ftplugin = "setl keywordprg< |exe 'nunmap <buffer> K'"