annotate runtime/ftplugin/gitrebase.vim @ 20788:072ad890c227 v8.2.0946

patch 8.2.0946: cannot use "q" to cancel a number prompt Commit: https://github.com/vim/vim/commit/eebd555733491cb55b9f30fe28772c0fd0ebacf7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 10 15:45:57 2020 +0200 patch 8.2.0946: cannot use "q" to cancel a number prompt Problem: Cannot use "q" to cancel a number prompt. Solution: Recognize "q" instead of ignoring it.
author Bram Moolenaar <Bram@vim.org>
date Wed, 10 Jun 2020 16:00:05 +0200
parents 5c40013d45ee
children 3e661b0cf500
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
1 " Vim filetype plugin
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
2 " Language: git rebase --interactive
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
4 " Last Change: 2019 Dec 05
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
5
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
6 " Only do this when not done yet for this buffer
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
7 if (exists("b:did_ftplugin"))
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
8 finish
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
9 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
10
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
11 runtime! ftplugin/git.vim
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
12 let b:did_ftplugin = 1
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
13
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
14 setlocal comments=:# commentstring=#\ %s formatoptions-=t
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2202
diff changeset
15 setlocal nomodeline
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
16 if !exists("b:undo_ftplugin")
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
17 let b:undo_ftplugin = ""
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
18 endif
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 2202
diff changeset
19 let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo< ml<"
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
20
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
21 function! s:choose(word) abort
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
22 s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
23 endfunction
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
24
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
25 function! s:cycle(count) abort
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
26 let words = ['pick', 'edit', 'fixup', 'squash', 'reword', 'drop']
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
27 let index = index(map(copy(words), 'v:val[0]'), getline('.')[0])
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
28 let index = ((index < 0 ? 0 : index) + 10000 * len(words) + a:count) % len(words)
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
29 call s:choose(words[index])
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
30 endfunction
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
31
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
32 command! -buffer -bar -range Pick :<line1>,<line2>call s:choose('pick')
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
33 command! -buffer -bar -range Squash :<line1>,<line2>call s:choose('squash')
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
34 command! -buffer -bar -range Edit :<line1>,<line2>call s:choose('edit')
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
35 command! -buffer -bar -range Reword :<line1>,<line2>call s:choose('reword')
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
36 command! -buffer -bar -range Fixup :<line1>,<line2>call s:choose('fixup')
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
37 command! -buffer -bar -range Drop :<line1>,<line2>call s:choose('drop')
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
38 command! -buffer -count=1 -bar -bang Cycle call s:cycle(<bang>0 ? -<count> : <count>)
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
39
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
40 if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps")
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
41 finish
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
42 endif
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
43
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
44 nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K'
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
45 nnoremap <buffer> <silent> <C-A> :<C-U><C-R>=v:count1<CR>Cycle<CR>
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
46 nnoremap <buffer> <silent> <C-X> :<C-U><C-R>=v:count1<CR>Cycle!<CR>
1624
18ee39301b82 updated for version 7.2a
vimboss
parents:
diff changeset
47
18818
5c40013d45ee Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10048
diff changeset
48 let b:undo_ftplugin = b:undo_ftplugin . "|exe 'nunmap <buffer> K'|exe 'nunmap <buffer> <C-A>'|exe 'nunmap <buffer> <C-X>'"