mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-07 05:04:34 +08:00
Consider | for matchpairs. Also some minor formatting. Fix #155.
This commit is contained in:
@@ -471,13 +471,15 @@ function! delimitMate#ExpandReturn() "{{{
|
|||||||
endif
|
endif
|
||||||
let escaped = delimitMate#CursorIdx() >= 2
|
let escaped = delimitMate#CursorIdx() >= 2
|
||||||
\ && delimitMate#GetCharFromCursor(-2) == '\'
|
\ && delimitMate#GetCharFromCursor(-2) == '\'
|
||||||
if !pumvisible() && (
|
let expand_right_matchpair = s:g('expand_cr') == 2
|
||||||
\ delimitMate#WithinEmptyMatchpair()
|
\ && index(s:g('right_delims'), delimitMate#GetCharFromCursor(0)) > -1
|
||||||
\ || (s:g('expand_cr') == 2
|
let expand_inside_quotes = s:g('expand_inside_quotes')
|
||||||
\ && index(s:g('right_delims'), delimitMate#GetCharFromCursor(0)) > -1)
|
\ && delimitMate#WithinEmptyQuotes()
|
||||||
\ || (s:g('expand_inside_quotes')
|
\ && !escaped
|
||||||
\ && delimitMate#WithinEmptyQuotes()
|
if !pumvisible()
|
||||||
\ && !escaped))
|
\ && (delimitMate#WithinEmptyMatchpair()
|
||||||
|
\ || expand_right_matchpair
|
||||||
|
\ || expand_inside_quotes)
|
||||||
" Expand:
|
" Expand:
|
||||||
" XXX zv prevents breaking expansion with syntax folding enabled by
|
" XXX zv prevents breaking expansion with syntax folding enabled by
|
||||||
" InsertLeave.
|
" InsertLeave.
|
||||||
@@ -493,10 +495,10 @@ function! delimitMate#ExpandSpace() "{{{
|
|||||||
endif
|
endif
|
||||||
let escaped = delimitMate#CursorIdx() >= 2
|
let escaped = delimitMate#CursorIdx() >= 2
|
||||||
\ && delimitMate#GetCharFromCursor(-2) == '\'
|
\ && delimitMate#GetCharFromCursor(-2) == '\'
|
||||||
if delimitMate#WithinEmptyMatchpair()
|
let expand_inside_quotes = s:g('expand_inside_quotes')
|
||||||
\ || (s:g('expand_inside_quotes')
|
\ && delimitMate#WithinEmptyQuotes()
|
||||||
\ && delimitMate#WithinEmptyQuotes()
|
\ && !escaped
|
||||||
\ && !escaped)
|
if delimitMate#WithinEmptyMatchpair() || expand_inside_quotes
|
||||||
" Expand:
|
" Expand:
|
||||||
return "\<Space>\<Space>\<Left>"
|
return "\<Space>\<Space>\<Left>"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -16,13 +16,6 @@ let g:loaded_delimitMate = 1
|
|||||||
let save_cpo = &cpo
|
let save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
if exists("s:loaded_delimitMate") && !exists("g:delimitMate_testing")
|
|
||||||
" Don't define the functions if they already exist: just do the work
|
|
||||||
" (unless we are testing):
|
|
||||||
call s:DelimitMateDo()
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
if v:version < 700
|
if v:version < 700
|
||||||
echoerr "delimitMate: this plugin requires vim >= 7!"
|
echoerr "delimitMate: this plugin requires vim >= 7!"
|
||||||
finish
|
finish
|
||||||
@@ -294,6 +287,7 @@ function! s:AutoClose() "{{{
|
|||||||
|
|
||||||
" Exit from inside the matching pair:
|
" Exit from inside the matching pair:
|
||||||
for delim in s:g('right_delims')
|
for delim in s:g('right_delims')
|
||||||
|
let delim = delim == '|' ? '<bar>' : delim
|
||||||
exec 'inoremap <expr><silent> <Plug>delimitMate' . delim
|
exec 'inoremap <expr><silent> <Plug>delimitMate' . delim
|
||||||
\. ' <SID>TriggerAbb().delimitMate#JumpOut("\' . delim . '")'
|
\. ' <SID>TriggerAbb().delimitMate#JumpOut("\' . delim . '")'
|
||||||
exec 'silent! imap <unique> <buffer> ' . delim
|
exec 'silent! imap <unique> <buffer> ' . delim
|
||||||
@@ -362,8 +356,6 @@ endfunction "}}}
|
|||||||
|
|
||||||
" Commands: {{{
|
" Commands: {{{
|
||||||
|
|
||||||
call s:DelimitMateDo()
|
|
||||||
|
|
||||||
" Let me refresh without re-loading the buffer:
|
" Let me refresh without re-loading the buffer:
|
||||||
command! -bar DelimitMateReload call s:DelimitMateDo(1)
|
command! -bar DelimitMateReload call s:DelimitMateDo(1)
|
||||||
|
|
||||||
@@ -388,6 +380,7 @@ augroup delimitMate
|
|||||||
\ call <SID>DelimitMateDo() |
|
\ call <SID>DelimitMateDo() |
|
||||||
\ let b:delimitMate_was_here = 1 |
|
\ let b:delimitMate_was_here = 1 |
|
||||||
\ endif
|
\ endif
|
||||||
|
autocmd VimEnter * call <SID>DelimitMateDo()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|||||||
Reference in New Issue
Block a user