Added double space inside auto-close pairs
This commit is contained in:
parent
33cdbc0995
commit
558a474a8f
1 changed files with 18 additions and 0 deletions
18
vimrc
18
vimrc
|
@ -143,9 +143,26 @@ function! s:autoClose_HelperEnter()
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return "\<enter>"
|
||||
endfunc
|
||||
|
||||
function! s:autoClose_HelperSpace()
|
||||
if exists("b:autoClose_Pairs")
|
||||
let next_c = getline(".")[col(".")-1]
|
||||
let prev_c = getline(".")[col(".")-2]
|
||||
|
||||
if (next_c !=# "") && (prev_c !=# "")
|
||||
if exists("b:autoClose_Pairs[prev_c]")
|
||||
if (next_c ==# b:autoClose_Pairs[prev_c])
|
||||
return "\<space>\<C-o>h\<space>"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return "\<space>"
|
||||
endfunc
|
||||
|
||||
function! s:autoClose_AddPair(open, close) "TODO: Improve with expand('<sfile>')
|
||||
if !exists("b:autoClose_Pairs")
|
||||
let b:autoClose_Pairs = {}
|
||||
|
@ -159,6 +176,7 @@ function! s:autoClose_AddPair(open, close) "TODO: Improve with expand('<sfile>')
|
|||
exe "inoremap <buffer> <expr> ".a:open." <SID>autoClose_HelperDouble('".a:open."')"
|
||||
end
|
||||
inoremap <buffer> <expr> <enter> <SID>autoClose_HelperEnter()
|
||||
inoremap <buffer> <expr> <space> <SID>autoClose_HelperSpace()
|
||||
endfunc
|
||||
|
||||
function! MatchingLines(pattern)
|
||||
|
|
Loading…
Reference in a new issue