gfanto / fzf-lsp.nvim

Enable the power of fzf fuzzy search for the neovim built in lsp
MIT License
223 stars 11 forks source link
fzf lsp neovim neovim-lua nvim vim

fzf-lsp.nvim

Show document symbols

Installation

Install using vim-plug. Put this in your init.vim.

Plug 'gfanto/fzf-lsp.nvim'
Plug 'nvim-lua/plenary.nvim'

Requirements

Features

This is an extension for fzf that give you the ability to search for symbols using the neovim builtin lsp.

Commands and settings

If you have fzf.vim installed, this plugin will respect your g:fzf_command_prefix setting.

Settings:

In general fzf-lsp.vim will respect your fzf.vim settings, alternatively you can override a specific settings with the fzf-lsp.vim equivalent:

fzf-lsp.vim only settings:

Commands:

Commands accepts and respect the ! if given

Note(*): this methods may not be implemented in your language server, especially textDocument/declaration (Declarations) it's usually not implemented in favour of textDocument/definition (Definitions).

Functions

Commands are just wrappers to the following function, each function take one optional parameter: a dictionary containing the options.

Handlers

Functions and commands are implemented using sync calls, if you want your calls to be async you can use the standard neovim calls setting his relative handler. To do that you can use the provided setup function, keeping in mind that this will replace all your handlers:

require'fzf_lsp'.setup()

or you can manually setup your handlers. The provided handlers are:

vim.lsp.handlers["textDocument/codeAction"] = require'fzf_lsp'.code_action_handler
vim.lsp.handlers["textDocument/definition"] = require'fzf_lsp'.definition_handler
vim.lsp.handlers["textDocument/declaration"] = require'fzf_lsp'.declaration_handler
vim.lsp.handlers["textDocument/typeDefinition"] = require'fzf_lsp'.type_definition_handler
vim.lsp.handlers["textDocument/implementation"] = require'fzf_lsp'.implementation_handler
vim.lsp.handlers["textDocument/references"] = require'fzf_lsp'.references_handler
vim.lsp.handlers["textDocument/documentSymbol"] = require'fzf_lsp'.document_symbol_handler
vim.lsp.handlers["workspace/symbol"] = require'fzf_lsp'.workspace_symbol_handler
vim.lsp.handlers["callHierarchy/incomingCalls"] = require'fzf_lsp'.incoming_calls_handler
vim.lsp.handlers["callHierarchy/outgoingCalls"] = require'fzf_lsp'.outgoing_calls_handler
Setup options

The setup function optionally takes a table for configuration. Available options: