Files
nixos-config/modules/user/config/nvim/lsp.lua
T
kiskaadee acc0bd7c80 feat(dev): unify Python tooling and migrate dotfile to declarative
lua/conf files

- Consolidate Python dev stack: Add `postgresql`/`pgcli`,
  `httpie`/`bruno`, and `ruff`/`mypy` to the environment
- Centralize Neovim logic: Move all configuration (`init.lua`,
  `lsp.lua`, `catppuccin.lua`) to standalone files and load them via
  `builtins.readFile`.
- Externalize Tmux configuration: Migrate the monolithic `extraConfig`
  to an external `modules/user/config/tmux.conf` file.
- Configure Zed and Neovim to use `ruff` as the primary Python formatter
  and `pyright` for static analysis.

Rationale: Embeded scripts as strings lack of proper language-specific
syntax highlighting, and makes the configuration harder to read and
understand. Eliminating hardcoded configuration in Nix improves readability,
enables proper syntax highlighting for Lua/Conf files, and standardizes
development tooling across all environments.
2026-06-25 15:07:49 -05:00

36 lines
1.1 KiB
Lua

local lspconfig = require('lspconfig')
-- Python LSP: Pyright (Type checking and navigation)
lspconfig.pyright.setup{}
-- Python LSP: Ruff (Ultra-fast Linting and Auto-formatting)
lspconfig.ruff.setup{
on_attach = function(client, bufnr)
-- Disable hover provider in Ruff so it doesn't conflict with Pyright
client.server_capabilities.hoverProvider = false
end,
}
-- Configure LSP Keybindings on attach
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local opts = { buffer = ev.buf }
-- Standard navigation & actions
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
-- Auto-format on save using Ruff / LSP
vim.api.nvim_create_autocmd('BufWritePre', {
buffer = ev.buf,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end,
})