Don't break undo with left/right cursor movement.
This commit is contained in:
parent
b647ef54cd
commit
7f548cbb18
@ -105,13 +105,13 @@ function! AutoPairsInsert(key)
|
|||||||
|
|
||||||
" Skip the character if current character is the same as input
|
" Skip the character if current character is the same as input
|
||||||
if current_char == a:key
|
if current_char == a:key
|
||||||
return "\<Right>"
|
return "\<C-G>U\<Right>"
|
||||||
end
|
end
|
||||||
|
|
||||||
if !g:AutoPairsFlyMode
|
if !g:AutoPairsFlyMode
|
||||||
" Skip the character if next character is space
|
" Skip the character if next character is space
|
||||||
if current_char == ' ' && next_char == a:key
|
if current_char == ' ' && next_char == a:key
|
||||||
return "\<Right>\<Right>"
|
return "\<C-G>U\<Right>\<C-G>U\<Right>"
|
||||||
end
|
end
|
||||||
|
|
||||||
" Skip the character if closed pair is next character
|
" Skip the character if closed pair is next character
|
||||||
@ -132,7 +132,7 @@ function! AutoPairsInsert(key)
|
|||||||
" Fly Mode, and the key is closed-pairs, search closed-pair and jump
|
" Fly Mode, and the key is closed-pairs, search closed-pair and jump
|
||||||
if g:AutoPairsFlyMode && has_key(b:AutoPairsClosedPairs, a:key)
|
if g:AutoPairsFlyMode && has_key(b:AutoPairsClosedPairs, a:key)
|
||||||
if search(a:key, 'W')
|
if search(a:key, 'W')
|
||||||
return "\<Right>"
|
return "\<C-G>U\<Right>"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ function! AutoPairsInsert(key)
|
|||||||
let close = b:AutoPairs[open]
|
let close = b:AutoPairs[open]
|
||||||
|
|
||||||
if current_char == close && open == close
|
if current_char == close && open == close
|
||||||
return "\<Right>"
|
return "\<C-G>U\<Right>"
|
||||||
end
|
end
|
||||||
|
|
||||||
" Ignore auto close ' if follows a word
|
" Ignore auto close ' if follows a word
|
||||||
@ -159,7 +159,7 @@ function! AutoPairsInsert(key)
|
|||||||
let pprev_char = line[col('.')-3]
|
let pprev_char = line[col('.')-3]
|
||||||
if pprev_char == open && prev_char == open
|
if pprev_char == open && prev_char == open
|
||||||
" Double pair found
|
" Double pair found
|
||||||
return repeat(a:key, 4) . repeat("\<LEFT>", 3)
|
return repeat(a:key, 4) . repeat("\<C-G>U\<LEFT>", 3)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ function! AutoPairsInsert(key)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return open.close."\<Left>"
|
return open.close."\<C-G>U\<Left>"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! AutoPairsDelete()
|
function! AutoPairsDelete()
|
||||||
@ -318,10 +318,10 @@ function! AutoPairsFastWrap()
|
|||||||
else
|
else
|
||||||
call search(s:FormatChunk(followed_open_pair, followed_close_pair), 'We')
|
call search(s:FormatChunk(followed_open_pair, followed_close_pair), 'We')
|
||||||
end
|
end
|
||||||
return "\<RIGHT>".inputed_close_pair."\<LEFT>"
|
return "\<C-G>U\<RIGHT>".inputed_close_pair."\<C-G>U\<LEFT>"
|
||||||
else
|
else
|
||||||
normal he
|
normal he
|
||||||
return "\<RIGHT>".current_char."\<LEFT>"
|
return "\<C-G>U\<RIGHT>".current_char."\<C-G>U\<LEFT>"
|
||||||
end
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ function! AutoPairsSpace()
|
|||||||
let cmd = ''
|
let cmd = ''
|
||||||
let cur_char =line[col('.')-1]
|
let cur_char =line[col('.')-1]
|
||||||
if has_key(g:AutoPairsParens, prev_char) && g:AutoPairsParens[prev_char] == cur_char
|
if has_key(g:AutoPairsParens, prev_char) && g:AutoPairsParens[prev_char] == cur_char
|
||||||
let cmd = "\<SPACE>\<LEFT>"
|
let cmd = "\<SPACE>\<C-G>U\<LEFT>"
|
||||||
endif
|
endif
|
||||||
return "\<SPACE>".cmd
|
return "\<SPACE>".cmd
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user