Mercurial > vim
annotate runtime/ftplugin/gitrebase.vim @ 28223:3832fda7305a
Added tag v8.2.4637 for changeset 85540173d3cab539816c91aa8011a7b305bae381
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Mar 2022 19:15:04 +0200 |
parents | 3e661b0cf500 |
children |
rev | line source |
---|---|
1624 | 1 " Vim filetype plugin |
2 " Language: git rebase --interactive | |
2034 | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
27036 | 4 " Last Change: 2022 Jan 05 |
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 let b:did_ftplugin = 1 | |
12 | |
27036 | 13 let &l:comments = ':' . (matchstr(getline('$'), '^[#;@!$%^&|:]\S\@!') . '#')[0] |
14 let &l:commentstring = &l:comments[1] . ' %s' | |
15 setlocal formatoptions-=t | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2202
diff
changeset
|
16 setlocal nomodeline |
27036 | 17 let b:undo_ftplugin = "setl com< cms< fo< ml<" |
1624 | 18 |
18818 | 19 function! s:choose(word) abort |
2202 | 20 s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e |
1624 | 21 endfunction |
22 | |
18818 | 23 function! s:cycle(count) abort |
24 let words = ['pick', 'edit', 'fixup', 'squash', 'reword', 'drop'] | |
25 let index = index(map(copy(words), 'v:val[0]'), getline('.')[0]) | |
26 let index = ((index < 0 ? 0 : index) + 10000 * len(words) + a:count) % len(words) | |
27 call s:choose(words[index]) | |
1624 | 28 endfunction |
29 | |
18818 | 30 command! -buffer -bar -range Pick :<line1>,<line2>call s:choose('pick') |
31 command! -buffer -bar -range Squash :<line1>,<line2>call s:choose('squash') | |
32 command! -buffer -bar -range Edit :<line1>,<line2>call s:choose('edit') | |
33 command! -buffer -bar -range Reword :<line1>,<line2>call s:choose('reword') | |
34 command! -buffer -bar -range Fixup :<line1>,<line2>call s:choose('fixup') | |
35 command! -buffer -bar -range Drop :<line1>,<line2>call s:choose('drop') | |
36 command! -buffer -count=1 -bar -bang Cycle call s:cycle(<bang>0 ? -<count> : <count>) | |
1624 | 37 |
38 if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps") | |
2202 | 39 finish |
1624 | 40 endif |
41 | |
18818 | 42 nnoremap <buffer> <silent> <C-A> :<C-U><C-R>=v:count1<CR>Cycle<CR> |
43 nnoremap <buffer> <silent> <C-X> :<C-U><C-R>=v:count1<CR>Cycle!<CR> | |
1624 | 44 |
27036 | 45 let b:undo_ftplugin = b:undo_ftplugin . "|exe 'nunmap <buffer> <C-A>'|exe 'nunmap <buffer> <C-X>'" |