mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-16 01:17:07 +08:00
Don't use #Finish() until completion has been used.
This commit is contained in:
@@ -268,10 +268,18 @@ function! s:DelimitMateSwitch() "{{{
|
|||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
|
function! s:Finish()
|
||||||
|
if exists('g:delimitMate_loaded')
|
||||||
|
return delimitMate#Finish()
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:FlushBuffer()
|
function! s:FlushBuffer()
|
||||||
if exists('g:delimitMate_loaded')
|
if exists('g:delimitMate_loaded')
|
||||||
call delimitMate#FlushBuffer()
|
return delimitMate#FlushBuffer()
|
||||||
endif
|
endif
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
@@ -337,14 +345,14 @@ function! s:ExtraMappings() "{{{
|
|||||||
inoremap <silent> <Plug>delimitMateDel <C-R>=delimitMate#Del()<CR>
|
inoremap <silent> <Plug>delimitMateDel <C-R>=delimitMate#Del()<CR>
|
||||||
" Flush the char buffer on movement keystrokes or when leaving insert mode:
|
" Flush the char buffer on movement keystrokes or when leaving insert mode:
|
||||||
for map in ['Esc', 'Left', 'Right', 'Home', 'End']
|
for map in ['Esc', 'Left', 'Right', 'Home', 'End']
|
||||||
exec 'inoremap <silent> <Plug>delimitMate'.map.' <C-R>=delimitMate#Finish()<CR><'.map.'>'
|
exec 'inoremap <silent> <Plug>delimitMate'.map.' <C-R>=<SID>Finish()<CR><'.map.'>'
|
||||||
if !hasmapto('<Plug>delimitMate'.map, 'i')
|
if !hasmapto('<Plug>delimitMate'.map, 'i')
|
||||||
exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
|
exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
" Except when pop-up menu is active:
|
" Except when pop-up menu is active:
|
||||||
for map in ['Up', 'Down', 'PageUp', 'PageDown', 'S-Down', 'S-Up']
|
for map in ['Up', 'Down', 'PageUp', 'PageDown', 'S-Down', 'S-Up']
|
||||||
exec 'inoremap <silent> <expr> <Plug>delimitMate'.map.' pumvisible() ? "\<'.map.'>" : "<C-R>=delimitMate#Finish()<CR><'.map.'>"'
|
exec 'inoremap <silent> <expr> <Plug>delimitMate'.map.' pumvisible() ? "\<'.map.'>" : "<C-R>=<SID>Finish()<CR><'.map.'>"'
|
||||||
if !hasmapto('<Plug>delimitMate'.map, 'i')
|
if !hasmapto('<Plug>delimitMate'.map, 'i')
|
||||||
exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
|
exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user