diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-07-19 12:28:39 -0400 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2025-07-19 12:28:39 -0400 |
| commit | cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa (patch) | |
| tree | a9233adbe1e1b4803d696c26efdd238b8af5bd7c /README.md | |
| parent | docs: readme (diff) | |
| download | nvim-lspconfig-cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa.tar nvim-lspconfig-cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa.tar.gz nvim-lspconfig-cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa.tar.bz2 nvim-lspconfig-cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa.tar.lz nvim-lspconfig-cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa.tar.xz nvim-lspconfig-cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa.tar.zst nvim-lspconfig-cf8b8e8438fded3be8c1fc18d26a66ef7d97d8fa.zip | |
docs: how to create a config
fix #3941
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -85,6 +85,39 @@ vim.lsp.config('rust_analyzer', { }) ``` +## Create a new config + +To create a new config you can either (1) use `vim.lsp.config` or (2) create +a file `lsp/<config-name>.lua` somewhere on your 'runtimepath'. + +### Example: define a new config as code + +1. Run `:lua vim.lsp.config('foo', {cmd={'true'}})` +2. Run `:lua vim.lsp.enable('foo')` +3. Run `:checkhealth vim.lsp`, the new config is listed under "Enabled Configurations". 😎 + +### Example: define a new config as a file + +1. Create a file `lsp/foo.lua` somewhere on your 'runtimepath'. + ``` + :exe 'edit' stdpath('config') .. '/lsp/foo.lua' + ``` +2. Add this code to the file (or copy any of the examples from the [lsp/ directory](./lsp/) in this repo): + ``` + return { + cmd = { 'true' }, + } + ``` +3. Save the file (with `++p` to ensure its parent directory is created). + ``` + :write ++p + ``` +4. Enable the config. + ``` + :lua vim.lsp.enable('foo') + ``` +5. Run `:checkhealth vim.lsp`, the new config is listed under "Enabled Configurations". 🌈 + ## Troubleshooting Start with `:checkhealth vim.lsp` to troubleshoot. The most common reasons a language server does not start or attach are: |
