Mercurial > vim
annotate runtime/ftplugin/gitrebase.vim @ 10761:721af7a9b4b4 v8.0.0270
patch 8.0.0270: may get ml_get error when :rubydo deletes lines
commit https://github.com/vim/vim/commit/c593fee0e5e850f7e75be41f5d1751f28892a27f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 29 23:11:25 2017 +0100
patch 8.0.0270: may get ml_get error when :rubydo deletes lines
Problem: May get ml_get error when :rubydo deletes lines or switches to
another buffer. (Nikolai Pavlov, issue https://github.com/vim/vim/issues/1421)
Solution: Check the buffer and line every time.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 29 Jan 2017 23:15:50 +0100 |
parents | 43efa4f5a8ea |
children | 5c40013d45ee |
rev | line source |
---|---|
1624 | 1 " Vim filetype plugin |
2 " Language: git rebase --interactive | |
2034 | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2202
diff
changeset
|
4 " Last Change: 2016 Aug 29 |
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 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2202
diff
changeset
|
15 setlocal nomodeline |
1624 | 16 if !exists("b:undo_ftplugin") |
2202 | 17 let b:undo_ftplugin = "" |
1624 | 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 | 20 |
21 function! s:choose(word) | |
2202 | 22 s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e |
1624 | 23 endfunction |
24 | |
25 function! s:cycle() | |
2202 | 26 call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},getline('.')[0],'pick')) |
1624 | 27 endfunction |
28 | |
29 command! -buffer -bar Pick :call s:choose('pick') | |
30 command! -buffer -bar Squash :call s:choose('squash') | |
31 command! -buffer -bar Edit :call s:choose('edit') | |
2034 | 32 command! -buffer -bar Reword :call s:choose('reword') |
2202 | 33 command! -buffer -bar Fixup :call s:choose('fixup') |
1624 | 34 command! -buffer -bar Cycle :call s:cycle() |
35 " The above are more useful when they are mapped; for example: | |
36 "nnoremap <buffer> <silent> S :Cycle<CR> | |
37 | |
38 if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps") | |
2202 | 39 finish |
1624 | 40 endif |
41 | |
42 nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K' | |
43 | |
44 let b:undo_ftplugin = b:undo_ftplugin . "|nunmap <buffer> K" |