From: Andreas Louv Date: Sun, 19 Mar 2023 18:29:50 +0000 (+0100) Subject: Don't add two entries to the jump list when jumping to a symbol in another file X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=7640af01366c5419a0e18dec07a399b28efee8c7;p=vim-lsp.git Don't add two entries to the jump list when jumping to a symbol in another file --- diff --git a/autoload/lsp/util.vim b/autoload/lsp/util.vim index 0e18dcf..9343d4e 100644 --- a/autoload/lsp/util.vim +++ b/autoload/lsp/util.vim @@ -172,7 +172,11 @@ export def JumpToLspLocation(location: dict, cmdmods: string) # jump to the file and line containing the symbol if cmdmods == '' var bnr: number = fname->bufnr() - if bnr != bufnr() + if bnr == bufnr() + # Set the previous cursor location mark. Instead of using setpos(), m' is + # used so that the current location is added to the jump list. + normal m' + else var wid = fname->bufwinid() if wid != -1 wid->win_gotoid() @@ -201,9 +205,6 @@ export def JumpToLspLocation(location: dict, cmdmods: string) else exe $'{cmdmods} split {fname}' endif - # Set the previous cursor location mark. Instead of using setpos(), m' is - # used so that the current location is added to the jump list. - normal m' setcursorcharpos(range.start.line + 1, range.start.character + 1) enddef