liuchengxu / vista.vim

:cactus: Viewer & Finder for LSP symbols and tags
https://liuchengxu.github.io/vista.vim
MIT License
1.88k stars 89 forks source link

Auto-open Vista window when starting with vim_lsp #451

Open spearman opened 1 year ago

spearman commented 1 year ago

Is your feature request related to a problem? Please describe. Would like to automatically have the Vista window visible when starting to edit a file with vim-lsp. When using

let g:vista_default_executive = 'vim_lsp'
autocmd VimEnter * Vista

nothing happens.

Describe the solution you'd like Would like the above config to work.

Describe alternatives you've considered Maybe it needs to be triggered when vim_lsp finishes loading symbols, but I don't know how to do this.

Additional context

spearman commented 1 year ago

This kind of works:

let g:vista_default_executive = 'vim_lsp'
function! OpenVista()
  if !exists("g:opened_vista")
    Vista
    if vista#sidebar#IsOpen()
      let g:opened_vista = 1
    endif
  endif
endfunction
autocmd User lsp_diagnostics_updated call OpenVista()