From 88ed631f6e44c3d0df990e51465960f2057f1195 Mon Sep 17 00:00:00 2001 From: "shane.xb.qian" Date: Mon, 17 Jan 2022 16:09:49 +0800 Subject: [PATCH] fix: not jump if cur one is same buf also --- autoload/lsp/symbol.vim | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/autoload/lsp/symbol.vim b/autoload/lsp/symbol.vim index ae293dc..1480aad 100644 --- a/autoload/lsp/symbol.vim +++ b/autoload/lsp/symbol.vim @@ -101,7 +101,17 @@ def JumpToWorkspaceSymbol(popupID: number, result: number): void exe $'confirm edit {symTbl[result - 1].file}' endif else - winList[0]->win_gotoid() + var wid = fname->bufwinid() + if wid != -1 + if bufwinid(bufnr()) == wid + # do nothing if cur one is + else + # jump to one in cur tab + wid->win_gotoid() + endif + else + winList[0]->win_gotoid() + endif 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. @@ -291,7 +301,10 @@ export def GotoSymbol(lspserver: dict, location: dict, peekSymbol: boo # jump to the file and line containing the symbol var wid = fname->bufwinid() if wid != -1 - wid->win_gotoid() + # do not jump if cur one is same buf + if bufwinid(bufnr()) != wid + wid->win_gotoid() + endif else var bnr: number = fname->bufnr() if bnr != -1 -- 2.48.1