-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vim.lsp.buf.definition() adds extra entry to jumplist when definition file not opened yet #28784
Comments
I will investigate further and try to provide a minimal config to reproduce the issue. |
@mikehaertl I cannot reproduce with |
Issue was actually caused by this little config that I've probably copied from somewhere a long time ago and never reconsidered: " When editing a file, always jump to the last cursor position.
autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif The fix was easy: use g`" instead of `" autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal! g`\"" | endif Source: https://stackoverflow.com/a/774599 EDIT: Even better: :help last-position-jump |
Problem
When
vim.lsp.buf.definition()
is called and the file with the definition is not yet available in a buffer I find an extra entry in the jumplist. It points to the top of the file that contains the definition.Steps to reproduce
:lua vim.lsp.buf.definition()
Expected behavior
The jumplist should only have one entry. So a single
<C-O>
should take you back to where you calledvim.lsp.buf.definition()
.Instead the first
<c-o>
takes me to the top of the definition file and I need a second<c-o>
to get back to the initial location.Neovim version (nvim -v)
0.10.0
Vim (not Nvim) behaves the same?
Operating system/version
Linux Mint 21.3
Terminal name/version
Gnome Terminal 3.44.0
$TERM environment variable
screen-256-color
Installation
build from repo
The text was updated successfully, but these errors were encountered: