mirror of
https://github.com/Raimondi/delimitMate.git
synced 2025-12-07 21:24:51 +08:00
Always jump over the quote on the right. Closes #89.
This commit is contained in:
@@ -320,14 +320,13 @@ function! delimitMate#QuoteDelim(char) "{{{
|
|||||||
endif
|
endif
|
||||||
let char_at = delimitMate#GetCharFromCursor(0)
|
let char_at = delimitMate#GetCharFromCursor(0)
|
||||||
let char_before = delimitMate#GetCharFromCursor(-1)
|
let char_before = delimitMate#GetCharFromCursor(-1)
|
||||||
if delimitMate#IsSmartQuote(a:char)
|
if char_at == a:char &&
|
||||||
" Seems like a smart quote, insert a single char.
|
|
||||||
return a:char
|
|
||||||
"elseif line[col + 1] == a:char &&
|
|
||||||
elseif char_at == a:char &&
|
|
||||||
\ index(b:_l_delimitMate_nesting_quotes, a:char) < 0
|
\ index(b:_l_delimitMate_nesting_quotes, a:char) < 0
|
||||||
" Get out of the string.
|
" Get out of the string.
|
||||||
return a:char . delimitMate#Del()
|
return a:char . delimitMate#Del()
|
||||||
|
elseif delimitMate#IsSmartQuote(a:char)
|
||||||
|
" Seems like a smart quote, insert a single char.
|
||||||
|
return a:char
|
||||||
elseif (char_before == a:char && char_at != a:char) && b:_l_delimitMate_smart_quotes
|
elseif (char_before == a:char && char_at != a:char) && b:_l_delimitMate_smart_quotes
|
||||||
" Seems like we have an unbalanced quote, insert one quotation mark and jump to the middle.
|
" Seems like we have an unbalanced quote, insert one quotation mark and jump to the middle.
|
||||||
call delimitMate#AddToBuffer(a:char)
|
call delimitMate#AddToBuffer(a:char)
|
||||||
|
|||||||
@@ -34,3 +34,5 @@ set cpo=ces$
|
|||||||
"'x" "'x'"
|
"'x" "'x'"
|
||||||
# Make sure smart quote works beyond first column.
|
# Make sure smart quote works beyond first column.
|
||||||
" 'x" " 'x'"
|
" 'x" " 'x'"
|
||||||
|
# Make sure we jump over a quote on the right. #89.
|
||||||
|
"('test'x" "('test'x)"
|
||||||
|
|||||||
Reference in New Issue
Block a user