prabirshrestha / vim-lsp

async language server protocol plugin for vim and neovim
MIT License
3.1k stars 304 forks source link

Feature request: Automatically open fold after jumping to definition with `:LspDefinition` when `&foldopen` includes `'jump'` #1498

Open lukelbd opened 11 months ago

lukelbd commented 11 months ago

I use set foldlevelstart=0 in .vimrc to have all folds closed whenever I open new files. As a result, after jumping to a definition in an unopened file with :LspDefinition, I often have to hit zv to show the definition under the cursor. I tried the maps noremap gd <Cmd>LspDefinition<CR>zv and noremap gd <Cmd>LspDefinition \| feedkeys('zv', 'n')<CR> but both fail to open the fold (perhaps due to asynchronous processing of LspDefinition?).

Is there any way to get vim-lsp to open a fold after jumping by default? Perhaps vim-lsp could do this automatically whenever the &foldopen setting contains the string 'jump' (to be consistent with built-in jumping methods like gd).

Thanks for all your work on this awesome project!