Skip to content

Commit

Permalink
improve handling of caputured keys for longest enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
ervandew committed Feb 16, 2011
1 parent 79aaf04 commit edfcc1d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions plugin/supertab.vim
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ function! s:InitBuffer()
let b:complReset = 0
let b:complTypeManual = !exists('b:complTypeManual') ? '' : b:complTypeManual
let b:complTypeContext = ''
let b:capturing = 0

" init hack for <c-x><c-v> workaround.
let b:complCommandLine = 0
Expand Down Expand Up @@ -480,7 +479,7 @@ function! s:EnableLongestEnhancement()
augroup END
endfunction " }}}

" s:CompletionReset() {{{
" s:CompletionReset(char) {{{
function! s:CompletionReset(char)
let b:complReset = 1
return a:char
Expand All @@ -500,15 +499,15 @@ function! s:CaptureKeyPresses()
for c in split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_', '.\zs')
exec 'imap <buffer> ' . c . ' <c-r>=<SID>CompletionReset("' . c . '")<cr>'
endfor
imap <buffer> <bs> <c-r>=<SID>CompletionReset("\<lt>c-h>")<cr>
imap <buffer> <bs> <c-r>=<SID>CompletionReset("\<lt>bs>")<cr>
imap <buffer> <c-h> <c-r>=<SID>CompletionReset("\<lt>c-h>")<cr>
exec 'imap <buffer> ' . g:SuperTabMappingForward . ' <c-r>=<SID>SuperTab("n")<cr>'
endif
endfunction " }}}

" s:ReleaseKeyPresses() {{{
function! s:ReleaseKeyPresses()
if b:capturing
if exists('b:capturing') && b:capturing
let b:capturing = 0
for c in split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_', '.\zs')
exec 'iunmap <buffer> ' . c
Expand Down

0 comments on commit edfcc1d

Please sign in to comment.