This plugin makes the vim-lsp client use FZF to display results and navigate the code.
If you don't have a preferred installation method, I recommend install vim-plug, and then add following codes.
Plug 'prabirshrestha/vim-lsp'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim' " optional
Plug 'jiz4oh/vim-lspfuzzy'
:FzfLspDocumentSymbol
By default the following FZF actions are available:
- alt-a : select all entries
- alt-d : deselect all entries
- ctrl-t : go to location in a new tab
- ctrl-v : go to location in a vertical split
- ctrl-x : go to location in a horizontal split
The fzf_preview
and fzf_action
settings are determined as follows:
- Values passed to
g:lspfuzzy_preview
andg:lspfuzzy_action
- Otherwise the plugin will try to load values from the respective FZF options
g:fzf_preview_window
andg:fzf_action
if they are set. - Finally the default values will be used.
For others FZF options such as g:fzf_layout
or g:fzf_colors
the plugin will
respect your settings.
Note:
- Some servers may only support partial commands.
Command | Method | Description |
---|---|---|
:FzfLspDeclaration |
textDocument/declaration | Go to the declaration of the word under the cursor, and open in the current window |
:FzfLspDefinition |
textDocument/definition | Go to the definition of the word under the cursor, and open in the current window |
:FzfLspDocumentSymbol |
textDocument/documentSymbol | Show document symbols |
:FzfLspImplementation |
textDocument/implementation | Show implementation of interface in the current window |
:FzfLspReferences |
textDocument/references | Find references |
:FzfLspTypeDefinition |
textDocument/typeDefinition | Go to the type definition of the word under the cursor, and open in the current window |
:FzfLspWorkspaceSymbol |
workspace/symbol | Search/Show workspace symbol |
:FzfLspCodeAction |
textDocument/codeAction | Find available code actions |
:FzfLspCodeActionSync |
textDocument/codeAction | Find available code actions and execute synchronously |
You need to install fzf.vim to enable previews. If it's already installed, make sure it's up-to-date.
Try to append +{2}-/2
to either g:fzf_preview_window
or to the g:lspfuzzy_preview
to make the preview respect line numbers. For instance:
let g:lspfuzzy_preview = ['+{2}-/2'] " more detail refer to :help g:fzf_preview_window