mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-06 04:34:29 +08:00
Reorder mappings.
This commit is contained in:
@@ -254,19 +254,19 @@ function! s:DelimitMateSwitch() "{{{
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:Finish()
|
||||
function! s:Finish() " {{{
|
||||
if exists('g:delimitMate_loaded')
|
||||
return delimitMate#Finish(1)
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
endfunction " }}}
|
||||
|
||||
function! s:FlushBuffer()
|
||||
function! s:FlushBuffer() " {{{
|
||||
if exists('g:delimitMate_loaded')
|
||||
return delimitMate#FlushBuffer()
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
endfunction " }}}
|
||||
|
||||
"}}}
|
||||
|
||||
@@ -321,16 +321,34 @@ endfunction "}}}
|
||||
function! s:ExtraMappings() "{{{
|
||||
" If pair is empty, delete both delimiters:
|
||||
inoremap <silent> <Plug>delimitMateBS <C-R>=delimitMate#BS()<CR>
|
||||
if !hasmapto('<Plug>delimitMateBS','i')
|
||||
silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
|
||||
endif
|
||||
" If pair is empty, delete closing delimiter:
|
||||
inoremap <silent> <expr> <Plug>delimitMateS-BS delimitMate#WithinEmptyPair() ? "\<C-R>=delimitMate#Del()\<CR>" : "\<S-BS>"
|
||||
if !hasmapto('<Plug>delimitMateS-BS','i')
|
||||
silent! imap <unique> <buffer> <S-BS> <Plug>delimitMateS-BS
|
||||
endif
|
||||
" Expand return if inside an empty pair:
|
||||
inoremap <silent> <Plug>delimitMateCR <C-R>=delimitMate#ExpandReturn()<CR>
|
||||
if b:_l_delimitMate_expand_cr != 0 && !hasmapto('<Plug>delimitMateCR', 'i')
|
||||
silent! imap <unique> <buffer> <CR> <Plug>delimitMateCR
|
||||
endif
|
||||
" Expand space if inside an empty pair:
|
||||
inoremap <silent> <Plug>delimitMateSpace <C-R>=delimitMate#ExpandSpace()<CR>
|
||||
" Jump out ot any empty pair:
|
||||
if b:_l_delimitMate_expand_space != 0 && !hasmapto('<Plug>delimitMateSpace', 'i')
|
||||
silent! imap <unique> <buffer> <Space> <Plug>delimitMateSpace
|
||||
endif
|
||||
" Jump over any delimiter:
|
||||
inoremap <silent> <Plug>delimitMateS-Tab <C-R>=delimitMate#JumpAny("\<S-Tab>")<CR>
|
||||
if b:_l_delimitMate_tab2exit && !hasmapto('<Plug>delimitMateS-Tab', 'i')
|
||||
silent! imap <unique> <buffer> <S-Tab> <Plug>delimitMateS-Tab
|
||||
endif
|
||||
" Change char buffer on Del:
|
||||
inoremap <silent> <Plug>delimitMateDel <C-R>=delimitMate#Del()<CR>
|
||||
if !hasmapto('<Plug>delimitMateDel', 'i')
|
||||
silent! imap <unique> <buffer> <Del> <Plug>delimitMateDel
|
||||
endif
|
||||
" Flush the char buffer on movement keystrokes or when leaving insert mode:
|
||||
for map in ['Esc', 'Left', 'Right', 'Home', 'End']
|
||||
exec 'inoremap <silent> <Plug>delimitMate'.map.' <C-R>=<SID>Finish()<CR><'.map.'>'
|
||||
@@ -355,27 +373,10 @@ function! s:ExtraMappings() "{{{
|
||||
|
||||
" Jump over next delimiters
|
||||
inoremap <buffer> <Plug>delimitMateJumpMany <C-R>=len(b:_l_delimitMate_buffer) ? delimitMate#Finish(0) : delimitMate#JumpMany()<CR>
|
||||
imap <silent> <buffer> <C-G>g <Plug>delimitMateJumpMany
|
||||
if !hasmapto('<Plug>delimitMateJumpMany')
|
||||
imap <silent> <buffer> <C-G>g <Plug>delimitMateJumpMany
|
||||
endif
|
||||
|
||||
" Map away!
|
||||
if !hasmapto('<Plug>delimitMateDel', 'i')
|
||||
silent! imap <unique> <buffer> <Del> <Plug>delimitMateDel
|
||||
endif
|
||||
if !hasmapto('<Plug>delimitMateBS','i')
|
||||
silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
|
||||
endif
|
||||
if !hasmapto('<Plug>delimitMateS-BS','i')
|
||||
silent! imap <unique> <buffer> <S-BS> <Plug>delimitMateS-BS
|
||||
endif
|
||||
if b:_l_delimitMate_expand_cr != 0 && !hasmapto('<Plug>delimitMateCR', 'i')
|
||||
silent! imap <unique> <buffer> <CR> <Plug>delimitMateCR
|
||||
endif
|
||||
if b:_l_delimitMate_expand_space != 0 && !hasmapto('<Plug>delimitMateSpace', 'i')
|
||||
silent! imap <unique> <buffer> <Space> <Plug>delimitMateSpace
|
||||
endif
|
||||
if b:_l_delimitMate_tab2exit && !hasmapto('<Plug>delimitMateS-Tab', 'i')
|
||||
silent! imap <unique> <buffer> <S-Tab> <Plug>delimitMateS-Tab
|
||||
endif
|
||||
" The following simply creates an ambiguous mapping so vim fully processes
|
||||
" the escape sequence for terminal keys, see 'ttimeout' for a rough
|
||||
" explanation, this just forces it to work
|
||||
|
||||
Reference in New Issue
Block a user