Module Structure
The handlers are defined inlua/user/lsp/handlers.lua as a Lua module:
Capabilities
Capabilities define what features the LSP client supports:lua/user/lsp/handlers.lua:8
- Enables snippet support for completions
- Integrates with nvim-cmp for enhanced completions
- Provides base LSP protocol capabilities
Setup Function
Called once during LSP initialization inlua/user/lsp/init.lua:7.
Diagnostic Signs
Custom icons for diagnostic messages:lua/user/lsp/handlers.lua:13
Diagnostic Configuration
lua/user/lsp/handlers.lua:25
Handler Overrides
Customize hover and signature help appearance:lua/user/lsp/handlers.lua:45
LSP Keybindings
Automatic buffer-local keymaps when LSP attaches:Navigation
| Keymap | Command | Description |
|---|---|---|
gD | vim.lsp.buf.declaration() | Go to declaration |
gd | vim.lsp.buf.definition() | Go to definition |
gI | vim.lsp.buf.implementation() | Go to implementation |
gr | vim.lsp.buf.references() | List references |
Information
| Keymap | Command | Description |
|---|---|---|
K | vim.lsp.buf.hover() | Show hover documentation |
gl | vim.diagnostic.open_float() | Open diagnostic float |
<leader>ls | vim.lsp.buf.signature_help() | Show signature help |
Code Actions
| Keymap | Command | Description |
|---|---|---|
<leader>la | vim.lsp.buf.code_action() | Show code actions |
<leader>lr | vim.lsp.buf.rename() | Rename symbol |
<leader>lf | vim.lsp.buf.format{ async = true } | Format document |
Diagnostics
| Keymap | Command | Description |
|---|---|---|
<leader>lj | vim.diagnostic.goto_next() | Next diagnostic |
<leader>lk | vim.diagnostic.goto_prev() | Previous diagnostic |
<leader>lq | vim.diagnostic.setloclist() | Send to location list |
Information
| Keymap | Command | Description |
|---|---|---|
<leader>li | :LspInfo | Show LSP info |
<leader>lI | :LspInstallInfo | Show Mason install info |
On Attach Function
Called when an LSP server attaches to a buffer:lua/user/lsp/handlers.lua:74
Formatting Control
Disable formatting for servers where null-ls should handle it:- tsserver: Uses Prettier via null-ls
- sumneko_lua/lua_ls: Uses Stylua via null-ls
Illuminate Integration
Automatically highlights matching symbols under the cursor.Customization
Adding Custom Keymaps
Edit thelsp_keymaps function in lua/user/lsp/handlers.lua:54:
Changing Diagnostic Display
Modify the config table inM.setup():
Custom Diagnostic Signs
Change the icons in the signs table:Usage in Mason
The handlers are used when setting up each LSP server inlua/user/lsp/mason.lua:39:
Related Pages
Mason Setup
Install and manage LSP servers
Null-ls
Configure formatters and linters

