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.
This commit is contained in:
1 parent
dad78546f0
commit
acc0bd7c80
6 files changed
+66
-27
No files matched your search
@@ -0,0 +1,2 @@
|
||||
vim.cmd("packadd catppuccin-nvim")
|
||||
vim.cmd("colorscheme catppuccin-mocha")
|
||||
@@ -0,0 +1,8 @@
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers for easier navigation jumps
|
||||
vim.opt.shiftwidth = 2 -- 2-space indents
|
||||
vim.opt.tabstop = 2 -- Tab spacing
|
||||
vim.opt.expandtab = true -- Convert tabs to spaces
|
||||
vim.opt.smartindent = true -- Intelligent auto-indenting based on file syntax
|
||||
vim.opt.wrap = false -- Disable automatic line wrapping
|
||||
vim.opt.termguicolors = true -- Enable 24-bit RGB terminal colors
|
||||
@@ -0,0 +1,35 @@
|
||||
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,
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
# Enable True Color (24-bit RGB) support inside Tmux for editor colorschemes
|
||||
set -ag terminal-overrides ",xterm-256color:RGB"
|
||||
|
||||
# Vim-style bindings for switching between active Tmux panes
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
# Place status bar at the top of the terminal screen rather than the bottom
|
||||
set-option -g status-position top
|
||||
@@ -44,16 +44,7 @@
|
||||
vimAlias = true; # Symlink `vim` to `nvim`
|
||||
|
||||
## Core Editor Settings (Lua-based)
|
||||
initLua = ''
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers for easier navigation jumps
|
||||
vim.opt.shiftwidth = 2 -- 2-space indents
|
||||
vim.opt.tabstop = 2 -- Tab spacing
|
||||
vim.opt.expandtab = true -- Convert tabs to spaces
|
||||
vim.opt.smartindent = true -- Intelligent auto-indenting based on file syntax
|
||||
vim.opt.wrap = false -- Disable automatic line wrapping
|
||||
vim.opt.termguicolors = true -- Enable 24-bit RGB terminal colors
|
||||
'';
|
||||
initLua = builtins.readFile ./config/nvim/init.lua;
|
||||
|
||||
## Declarative Plugin Management
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
@@ -61,10 +52,7 @@
|
||||
{
|
||||
plugin = catppuccin-nvim;
|
||||
type = "lua";
|
||||
config = ''
|
||||
vim.cmd("packadd catppuccin-nvim")
|
||||
vim.cmd("colorscheme catppuccin-mocha")
|
||||
'';
|
||||
config = builtins.readFile ./config/nvim/catppuccin.lua;
|
||||
}
|
||||
|
||||
# Advanced Syntax Highlighting for developer workflows (Python, Rust, Java, Nix)
|
||||
@@ -77,6 +65,13 @@
|
||||
javascript
|
||||
markdown
|
||||
]))
|
||||
|
||||
# LSP Configuration & Python Language Servers
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
type = "lua";
|
||||
config = builtins.readFile ./config/nvim/lsp.lua;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -43,19 +43,7 @@
|
||||
vim-tmux-navigator # Seamless navigation switching between Vim panes and Tmux splits (Ctrl+h/j/k/l)
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# Enable True Color (24-bit RGB) support inside Tmux for editor colorschemes
|
||||
set -ag terminal-overrides ",xterm-256color:RGB"
|
||||
|
||||
# Vim-style bindings for switching between active Tmux panes
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
# Place status bar at the top of the terminal screen rather than the bottom
|
||||
set-option -g status-position top
|
||||
'';
|
||||
extraConfig = builtins.readFile ./config/tmux.conf;
|
||||
};
|
||||
|
||||
# Cross-Shell Prompt (Starship)
|
||||
|
||||
Reference in new issue
Block a user