diff --git a/modules/user/config/nvim/catppuccin.lua b/modules/user/config/nvim/catppuccin.lua new file mode 100644 index 0000000..4c9fcaf --- /dev/null +++ b/modules/user/config/nvim/catppuccin.lua @@ -0,0 +1,2 @@ +vim.cmd("packadd catppuccin-nvim") +vim.cmd("colorscheme catppuccin-mocha") diff --git a/modules/user/config/nvim/init.lua b/modules/user/config/nvim/init.lua new file mode 100644 index 0000000..af5edcc --- /dev/null +++ b/modules/user/config/nvim/init.lua @@ -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 diff --git a/modules/user/config/nvim/lsp.lua b/modules/user/config/nvim/lsp.lua new file mode 100644 index 0000000..8affa30 --- /dev/null +++ b/modules/user/config/nvim/lsp.lua @@ -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', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', '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, +}) diff --git a/modules/user/config/tmux.conf b/modules/user/config/tmux.conf new file mode 100644 index 0000000..a8a4391 --- /dev/null +++ b/modules/user/config/tmux.conf @@ -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 diff --git a/modules/user/graphical.nix b/modules/user/graphical.nix index 7388746..233c58a 100644 --- a/modules/user/graphical.nix +++ b/modules/user/graphical.nix @@ -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; + } ]; }; diff --git a/modules/user/terminal.nix b/modules/user/terminal.nix index 3d3c4b1..41c5dc3 100644 --- a/modules/user/terminal.nix +++ b/modules/user/terminal.nix @@ -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)