]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/ftplugin/gitrebase.vim
Remove easymotion plugin
[rbdr/dotfiles] / vim / ftplugin / gitrebase.vim
1 " Vim filetype plugin
2 " Language: git rebase --interactive
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4
5 " Only do this when not done yet for this buffer
6 if (exists("b:did_ftplugin"))
7 finish
8 endif
9
10 runtime! ftplugin/git.vim
11 let b:did_ftplugin = 1
12
13 setlocal comments=:# commentstring=#\ %s formatoptions-=t
14 if !exists("b:undo_ftplugin")
15 let b:undo_ftplugin = ""
16 endif
17 let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo<"
18
19 function! s:choose(word)
20 s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e
21 endfunction
22
23 function! s:cycle()
24 call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},getline('.')[0],'pick'))
25 endfunction
26
27 command! -buffer -bar Pick :call s:choose('pick')
28 command! -buffer -bar Squash :call s:choose('squash')
29 command! -buffer -bar Edit :call s:choose('edit')
30 command! -buffer -bar Reword :call s:choose('reword')
31 command! -buffer -bar Fixup :call s:choose('fixup')
32 command! -buffer -bar Cycle :call s:cycle()
33 " The above are more useful when they are mapped; for example:
34 "nnoremap <buffer> <silent> S :Cycle<CR>
35
36 if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps")
37 finish
38 endif
39
40 nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K'
41
42 let b:undo_ftplugin = b:undo_ftplugin . "|nunmap <buffer> K"