autoload/lsp/symbol.vim | 41 ++++++++++++++++++++++++++++------------- diff --git a/autoload/lsp/symbol.vim b/autoload/lsp/symbol.vim index 7d26df82a3f6bc8ab28e2a8e35f5eb48e411a607..57164546107e8361bbf3dea42e6c054a1620432e 100644 --- a/autoload/lsp/symbol.vim +++ b/autoload/lsp/symbol.vim @@ -802,7 +802,7 @@ # Key filter function for the symbol popup menu. def SymbolMenuFilterKey(symPopupMenu: number, key: string): bool - var keyHandled = false + var keyHandled = true var updateInputPopup = false var inputText = symPopupMenu->getwinvar('inputText', '') var symInputPopup = symPopupMenu->getwinvar('symbolInputPopup', 0) @@ -811,33 +811,48 @@ if key == "\" || key == "\" # Erase a character in the input popup if inputText->len() >= 1 inputText = inputText[: -2] - keyHandled = true updateInputPopup = true + else + keyHandled = false endif elseif key == "\" # Erase all the characters in the input popup inputText = '' - keyHandled = true updateInputPopup = true + elseif key == "\" + || key == "\" + || key == "\" + || key == "\" + var ln = getcurpos(symPopupMenu)[1] + win_execute(symPopupMenu, "normal! j") + if ln == getcurpos(symPopupMenu)[1] + win_execute(symPopupMenu, "normal! gg") + endif + elseif key == "\" + || key == "\" + || key == "\" + || key == "\" + var ln = getcurpos(symPopupMenu)[1] + win_execute(symPopupMenu, "normal! k") + if ln == getcurpos(symPopupMenu)[1] + win_execute(symPopupMenu, "normal! G") + endif + elseif key == "\" + win_execute(symPopupMenu, 'normal! ' .. "\") + elseif key == "\" + win_execute(symPopupMenu, 'normal! ' .. "\") elseif key == "\" || key == "\" - || key == "\" - || key == "\" || key == "\" || key == "\" - || key == "\" - || key == "\" - # scroll the symbol popup window - var cmd: string = 'normal! ' .. (key == "\" ? 'j' : - key == "\" ? 'k' : key) - win_execute(symPopupMenu, cmd) - keyHandled = true + win_execute(symPopupMenu, $"normal! {key}") elseif key =~ '^\k$' # A keyword character is typed. Add to the input text and update the # popup inputText ..= key - keyHandled = true updateInputPopup = true + else + keyHandled = false endif var symTblFiltered: list> = []