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