Add workaround for normal! bug in nvim terminals (#1588)

There's a known issue regarding `normal` usage in neovim. See
https://github.com/neovim/neovim/issues/4895 for more details.

As a temporary workaround, use setpos to set the
bookmark instead.
This commit is contained in:
Mo-tmd
2025-04-16 00:58:52 +02:00
committed by GitHub
parent 1fff637559
commit 3cb44a8ba5

View File

@@ -369,7 +369,7 @@ function! s:action_for(key, ...)
" errors. e.g. E471: Argument required: tab drop
if !a:0
if !edit
normal! m'
call setpos("''", getpos('.'))
silent! call s:execute_silent(cmd)
endif
else
@@ -378,7 +378,7 @@ function! s:action_for(key, ...)
" instructed to stay on the current buffer.
let stay = edit && (a:0 > 1 && a:2 || fnamemodify(a:1, ':p') ==# expand('%:p'))
if !stay
normal! m'
call setpos("''", getpos('.'))
call s:execute_silent((len(cmd) ? cmd : 'edit').' '.s:escape(a:1))
endif
endif