diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-10-19 12:42:04 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-10-20 12:23:30 +0200 |
| commit | 34eb520236eeeb4eb5417c184541bfb9d0d5efee (patch) | |
| tree | ca7ab5ad37c57da2c841a88c37e870f589afb577 /config/nvim/lua | |
| parent | c86fab0e8d470c7e30bb875c3f7f9d17fdb975f5 (diff) | |
First pass at using a light theme
Diffstat (limited to 'config/nvim/lua')
| -rw-r--r-- | config/nvim/lua/lsp.lua | 118 | ||||
| -rw-r--r-- | config/nvim/lua/plugins.lua | 6 | ||||
| -rw-r--r-- | config/nvim/lua/treesitter_config.lua | 1 |
3 files changed, 46 insertions, 79 deletions
diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index 7434504..6c69119 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -1,45 +1,37 @@ local coq = require('coq') --- Prepare capabilities with COQ support -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true -capabilities = coq.lsp_ensure_capabilities(capabilities) - --- Configure each LSP server -vim.lsp.config('ts_ls', { +vim.lsp.config('ts_ls', coq.lsp_ensure_capabilities({ cmd = { 'typescript-language-server', '--stdio' }, - root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json' }, - capabilities = capabilities, -}) + filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, + root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json' } +})) +vim.lsp.enable('ts_ls') -vim.lsp.config('eslint', { +vim.lsp.config('eslint', coq.lsp_ensure_capabilities({ cmd = { 'vscode-eslint-language-server', '--stdio' }, - root_markers = { '.eslintrc', '.eslintrc.js', '.eslintrc.json', 'package.json' }, - capabilities = capabilities, -}) + filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, + root_markers = { '.eslintrc', '.eslintrc.js', '.eslintrc.json', 'package.json' } +})) +vim.lsp.enable('eslint') -vim.lsp.config('svelte', { +vim.lsp.config('svelte', coq.lsp_ensure_capabilities({ cmd = { 'svelteserver', '--stdio' }, - root_markers = { 'package.json', 'svelte.config.js' }, - capabilities = capabilities, -}) + filetypes = { 'svelte' }, + root_markers = { 'package.json', 'svelte.config.js' } +})) +vim.lsp.enable('svelte') -vim.lsp.config('pyright', { +vim.lsp.config('pyright', coq.lsp_ensure_capabilities({ cmd = { 'pyright-langserver', '--stdio' }, - root_markers = { 'pyproject.toml', 'setup.py', 'requirements.txt' }, - capabilities = capabilities, -}) - -vim.lsp.config('dartls', { - cmd = { 'dart', 'language-server', '--protocol=lsp' }, - root_markers = { 'pubspec.yaml' }, - capabilities = capabilities, -}) + filetypes = { 'python' }, + root_markers = { 'pyproject.toml', 'setup.py', 'requirements.txt' } +})) +vim.lsp.enable('pyright') -vim.lsp.config('rust_analyzer', { +vim.lsp.config('rust_analyzer', coq.lsp_ensure_capabilities({ cmd = { 'rust-analyzer' }, + filetypes = { 'rust' }, root_markers = { 'Cargo.toml', 'rust-project.json' }, - capabilities = capabilities, settings = { ['rust-analyzer'] = { imports = { @@ -57,61 +49,35 @@ vim.lsp.config('rust_analyzer', { enable = true }, checkOnSave = { + enable = true, command = "clippy" } }, }, -}) +})) +vim.lsp.enable('rust_analyzer') -vim.lsp.config('lua_ls', { +vim.lsp.config('lua_ls', coq.lsp_ensure_capabilities({ cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, root_markers = { '.luarc.json', '.luarc.jsonc', '.luacheckrc', 'stylua.toml', 'selene.toml' }, - capabilities = capabilities, -}) - --- Auto-enable LSP servers based on filetype -vim.api.nvim_create_autocmd('FileType', { - pattern = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, - callback = function() - vim.lsp.enable('ts_ls') - vim.lsp.enable('eslint') - end, -}) +})) +vim.lsp.enable('lua_ls') -vim.api.nvim_create_autocmd('FileType', { - pattern = 'svelte', - callback = function() - vim.lsp.enable('svelte') - end, -}) - -vim.api.nvim_create_autocmd('FileType', { - pattern = 'python', - callback = function() - vim.lsp.enable('pyright') - end, -}) - -vim.api.nvim_create_autocmd('FileType', { - pattern = 'dart', - callback = function() - vim.lsp.enable('dartls') - end, -}) - -vim.api.nvim_create_autocmd('FileType', { - pattern = 'rust', - callback = function() - vim.lsp.enable('rust_analyzer') - -- Enable inlay hints for Rust - vim.lsp.inlay_hint.enable(true, { bufnr = 0 }) - end, -}) +vim.lsp.config('gleam', coq.lsp_ensure_capabilities({ + cmd = { 'gleam', 'lsp' }, + filetypes = { 'gleam' }, + root_markers = { 'gleam.toml' }, +})) +vim.lsp.enable('gleam') -vim.api.nvim_create_autocmd('FileType', { - pattern = 'lua', - callback = function() - vim.lsp.enable('lua_ls') +-- Enable inlay hints for Rust when LSP attaches +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client and client.name == 'rust_analyzer' then + vim.lsp.inlay_hint.enable(true, { bufnr = args.buf }) + end end, }) diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 882c76d..ce637e9 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -28,9 +28,9 @@ require('lazy').setup({ ['fg'] = {'fg', 'Normal'}, ['bg'] = {'bg', 'Normal'}, ['hl'] = {'fg', 'Comment'}, - ['fg+'] = {'fg', 'CursorLine'}, - ['bg+'] = {'bg', 'CursorLine'}, - ['hl+'] = {'fg', 'Statement'}, + ['fg+'] = {'fg', 'Type'}, + ['bg+'] = {'bg', 'Comment'}, + ['hl+'] = {'fg', '@fzf.hlplus'}, ['info'] = {'fg', 'PreProc'}, ['prompt'] = {'fg', 'Conditional'}, ['pointer'] = {'fg', 'Exception'}, diff --git a/config/nvim/lua/treesitter_config.lua b/config/nvim/lua/treesitter_config.lua index ded65ac..16986d6 100644 --- a/config/nvim/lua/treesitter_config.lua +++ b/config/nvim/lua/treesitter_config.lua @@ -8,6 +8,7 @@ require'nvim-treesitter.configs'.setup { 'diff', 'dockerfile', 'gitcommit', + 'gleam', 'graphql', 'html', 'htmldjango', |