{inputs, pkgs, ...}: { imports = [ inputs.nixvim.homeModules.nixvim ]; programs = { nixvim = { enable = true; # Color scheme colorschemes = { catppuccin = { enable = true; }; }; # ======================================== # BASIC VIM OPTIONS # ======================================== opts = { # Line numbers number = true; # Show absolute line numbers relativenumber = true; # Show relative line numbers (great for vim motions) # Indentation tabstop = 2; # Number of spaces a tab counts for shiftwidth = 2; # Number of spaces for each indentation level expandtab = true; # Convert tabs to spaces autoindent = true; # Copy indent from current line when starting new line smartindent = true; # Smart autoindenting when starting a new line # Search ignorecase = true; # Ignore case in search patterns smartcase = true; # Override ignorecase if search contains uppercase hlsearch = true; # Highlight search results incsearch = true; # Show search matches as you type # UI termguicolors = true; # Enable 24-bit RGB colors cursorline = true; # Highlight the current line signcolumn = "yes"; # Always show sign column (prevents text shifting) scrolloff = 8; # Keep 8 lines above/below cursor when scrolling sidescrolloff = 8; # Keep 8 columns left/right of cursor # Performance updatetime = 300; # Faster completion (default is 4000ms) # Splits splitright = true; # Vertical splits open to the right splitbelow = true; # Horizontal splits open below # Other mouse = "a"; # Enable mouse support clipboard = "unnamedplus"; # Use system clipboard undofile = true; # Persistent undo backup = false; # Don't create backup files #swapfile = false; # Don't create swap files }; # ======================================== # PLUGINS # ======================================== plugins = { # Status line lualine = { enable = true; }; web-devicons = { enable = true; }; # File tree neo-tree = { enable = true; settings = { close_if_last_window = true; window = { width = 30; }; }; }; # Fuzzy finder telescope = { enable = true; keymaps = { "ff" = "find_files"; "fg" = "live_grep"; "fb" = "buffers"; "fh" = "help_tags"; }; }; # Git integration gitsigns = { enable = true; }; # Auto pairs nvim-autopairs = { enable = true; }; # Comment toggling comment = { enable = true; }; # Treesitter for better syntax highlighting treesitter = { enable = true; settings = { highlight = { enable = true; }; indent = { enable = true; }; }; }; # ======================================== # LSP CONFIGURATION # ======================================== lsp = { enable = true; # LSP servers servers = { # Nix language server nixd = { enable = true; }; cmake-language-server = { enable = true; }; # C++ language server clangd = { enable = true; # You can add custom settings here # cmd = ["clangd" "--background-index"]; }; # Optional: other language servers you might want # bashls.enable = true; # Bash # pyright.enable = true; # Python # gopls.enable = true; # Go # rust-analyzer.enable = true; # Rust }; # LSP keymaps - these work when an LSP is attached keymaps = { diagnostic = { "j" = "goto_next"; "k" = "goto_prev"; }; lspBuf = { "gd" = "definition"; "gD" = "declaration"; "gr" = "references"; "gi" = "implementation"; "K" = "hover"; "rn" = "rename"; "ca" = "code_action"; }; }; }; # ======================================== # COMPLETION # ======================================== cmp = { enable = true; settings = { # Snippet support (required for nvim-cmp) snippet = { expand = "function(args) require('luasnip').lsp_expand(args.body) end"; }; # Completion sources sources = [ { name = "nvim_lsp"; } # LSP completions { name = "path"; } # Path completions { name = "buffer"; } # Buffer completions { name = "luasnip"; } # Snippet completions ]; # Keybindings for completion menu mapping = { "" = "cmp.mapping.complete()"; "" = "cmp.mapping.close()"; "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; "" = "cmp.mapping.scroll_docs(-4)"; "" = "cmp.mapping.scroll_docs(4)"; }; }; }; # Snippet engine (required by cmp) luasnip = { enable = true; }; # ======================================== # QUALITY OF LIFE PLUGINS # ======================================== # Which-key: shows available keybindings which-key = { enable = true; }; # Better buffer management bufferline = { enable = true; }; # Indent guides indent-blankline = { enable = true; }; # Color highlighter (shows colors inline) nvim-colorizer = { enable = true; }; }; # ======================================== # CUSTOM KEYMAPS # ======================================== keymaps = [ # Leader key { mode = "n"; key = ""; action = ""; options = { silent = true; }; } # File tree toggle { mode = "n"; key = "e"; action = ":Neotree toggle"; options = { silent = true; desc = "Toggle file tree"; }; } # Better window navigation { mode = "n"; key = ""; action = "h"; options = { desc = "Move to left window"; }; } { mode = "n"; key = ""; action = "j"; options = { desc = "Move to lower window"; }; } { mode = "n"; key = ""; action = "k"; options = { desc = "Move to upper window"; }; } { mode = "n"; key = ""; action = "l"; options = { desc = "Move to right window"; }; } # Resize windows { mode = "n"; key = ""; action = ":resize +2"; options = { silent = true; desc = "Increase window height"; }; } { mode = "n"; key = ""; action = ":resize -2"; options = { silent = true; desc = "Decrease window height"; }; } { mode = "n"; key = ""; action = ":vertical resize -2"; options = { silent = true; desc = "Decrease window width"; }; } { mode = "n"; key = ""; action = ":vertical resize +2"; options = { silent = true; desc = "Increase window width"; }; } # Buffer navigation { mode = "n"; key = ""; action = ":bnext"; options = { silent = true; desc = "Next buffer"; }; } { mode = "n"; key = ""; action = ":bprevious"; options = { silent = true; desc = "Previous buffer"; }; } # Save file { mode = "n"; key = ""; action = ":w"; options = { silent = true; desc = "Save file"; }; } # Clear search highlight { mode = "n"; key = "h"; action = ":nohlsearch"; options = { silent = true; desc = "Clear search highlight"; }; } # Better indenting in visual mode { mode = "v"; key = "<"; action = "