1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:30:04 +08:00

fix(iedit): skip empty character when start iedit

if the cursor in on empty character, iedit should be skipped
This commit is contained in:
wsdjeg 2022-03-23 21:25:08 +08:00
parent c8cc8c0332
commit c63e9bf303

View File

@ -97,6 +97,16 @@ endfunction
" <
" if only argv 1 is given, use selected word as pattern
function! SpaceVim#plugins#iedit#start(...) abort
" do not start iedit if symbol is empty
let argv = get(a:000, 0, '')
if empty(argv) &&
\ (
\ matchstr(getline('.'), '\%' . col('.') . 'c.') ==# ''
\ || matchstr(getline('.'), '\%' . col('.') . 'c.') ==# ' '
\ )
echo 'no pattern found under cursor'
return
endif
let save_tve = &t_ve
let save_cl = &l:cursorline
setlocal nocursorline
@ -108,7 +118,6 @@ function! SpaceVim#plugins#iedit#start(...) abort
let w:spacevim_statusline_mode = 'in'
if empty(s:stack)
let curpos = getpos('.')
let argv = get(a:000, 0, '')
let save_reg_k = @k
" the register " is cleared
" save the register context before run following command