diff --git a/autoload/SpaceVim/plugins/highlight.vim b/autoload/SpaceVim/plugins/highlight.vim index 2c8bdd497..06544ce42 100644 --- a/autoload/SpaceVim/plugins/highlight.vim +++ b/autoload/SpaceVim/plugins/highlight.vim @@ -103,13 +103,16 @@ function! s:hi() abort endfor endfunction +function! s:is_ex_mode() abort + return exists('v:argv') && index(v:argv, '-Ex') !=# -1 +endfunction + function! s:init() abort call s:hi() " https://github.com/neovim/neovim/issues/18050 " vim-patch:8.0.0542 make `line('w$')` return 0 in Ex mode " so the default range should be Buffer in Ex mode - let mode = mode() - if mode ==# 'cv' || mode ==# 'ce' + if s:is_ex_mode() let s:current_range = 'Buffer' let [s:cursor_stack, s:index] = SpaceVim#plugins#iedit#paser(1, line('$'), s:current_match, 0) else @@ -269,7 +272,7 @@ function! s:change_range() abort let [s:cursor_stack, s:index] = SpaceVim#plugins#iedit#paser(range[0], range[1], s:current_match, 0) call s:clear_highlight() call s:highlight() - elseif s:current_range ==# 'Function' && (mode() ==# 'cv' || mode() ==# 'ce') + elseif s:current_range ==# 'Function' && s:is_ex_mode() let s:current_range = 'Buffer' let [s:cursor_stack, s:index] = SpaceVim#plugins#iedit#paser(1, line('$'), s:current_match, 0) call s:clear_highlight()