Created
June 20, 2012 16:26
-
-
Save raymond-w-ko/2960778 to your computer and use it in GitHub Desktop.
Testcase Showing Bug in VIM 7.3.561
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
function! TestCompleteFunc(findstart, base) | |
if a:findstart | |
let index = col('.') - 2 | |
let line = getline('.') | |
while 1 | |
if (index == -1) | |
break | |
endif | |
if ( match(line[index], '[a-zA-Z0-9_]') == -1 ) | |
break | |
endif | |
let index = index - 1 | |
endwhile | |
let result = index + 1 | |
return result | |
else | |
let dummy = ['VIM', 'is', 'awesome'] | |
" BEFORE 7.3.561 | |
" works fine | |
" typing 'test' in insert mode results in reg(.) = 'test' (correct) | |
" | |
" AFTER 7.3.561 | |
" broken, second character and after is repeated | |
" typing 'test' in insert mode results in reg(.) = 'teesstt' (incorrect) | |
" | |
return {'words' : dummy} | |
" BEFORE 7.3.561 | |
" broken, only last letter is preserved | |
" typing 'test' in insert mode results in reg(.) = 't' (incorrect) | |
" | |
" AFTER 7.3.561 | |
" works fine | |
" typing 'test' in insert mode results in reg(.) = 'test' (correct) | |
" | |
"return {'words' : dummy, 'refresh' : 'always' } | |
endif | |
endfunction | |
set completefunc=TestCompleteFunc | |
set completeopt=menu,menuone,preview | |
function! MapForMappingDriven() | |
let keys_mapping_driven = | |
\ [ | |
\ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', | |
\ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', | |
\ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', | |
\ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', | |
\ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', | |
\ '_', '<Space>', '<C-h>', '<BS>', | |
\ ] | |
for key in keys_mapping_driven | |
exe printf('inoremap <silent> %s %s<C-r>=FeedPopup()<CR>', | |
\ key, key) | |
endfor | |
endfunction | |
function! FeedPopup() | |
if &paste | |
return '' | |
endif | |
call feedkeys("\<C-x>\<C-u>\<C-p>", 'n') | |
return '' | |
endfunction | |
call MapForMappingDriven() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment