Skip to content

A Vim plugin to make the vim-lsp works with FZF

Notifications You must be signed in to change notification settings

jiz4oh/vim-lspfuzzy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

vim-lspfuzzy

This plugin makes the vim-lsp client use FZF to display results and navigate the code.

FzfLspDocumentSymbol

Installation

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'

Usage

: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

Configuration

The fzf_preview and fzf_action settings are determined as follows:

  1. Values passed to g:lspfuzzy_preview and g:lspfuzzy_action
  2. Otherwise the plugin will try to load values from the respective FZF options g:fzf_preview_window and g:fzf_action if they are set.
  3. 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.

Supported commands

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

Troubleshooting

Preview does not work

You need to install fzf.vim to enable previews. If it's already installed, make sure it's up-to-date.

Preview does not scroll to the selected location

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

Credits

About

A Vim plugin to make the vim-lsp works with FZF

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published