{ inputs, pkgs, lib, theme, ... }: { imports = [ ./alpha.nix ./keymaps.nix inputs.nixvim.homeManagerModules.nixvim ] ++ lib.optional (builtins.isString theme) ../../../../../stylix/themes/${theme}/home-manager/nixvim.nix; # https://github.com/nix-community/nixvim # Docs: # https://nix-community.github.io/nixvim/ programs.nixvim = { enable = true; viAlias = true; vimAlias = true; globals.mapleader = " "; globals.maplocalleader = " "; options = { number = true; wrap = false; cursorline = true; cursorcolumn = true; shiftwidth = 2; breakindent = true; colorcolumn = "100"; showmode = false; termguicolors = true; }; plugins = { # Git related # Gutter information for git modifications gitsigns.enable = true; # git plugin for vim fugitive.enable = true; # pretty stuff # Rainbow matching {} [] () 's rainbow-delimiters.enable = true; # Colorize hex colors inline nvim-colorizer.enable = true; # Fancy popups, etc for vim noice = { enable = true; popupmenu.enabled = true; }; notify = { enable = true; topDown = true; fps = 60; stages = "slide"; }; # Nix related # Nix language syntax highlighting / file type associations nix.enable = true; # Run nix develop / shell without exiting vim nix-develop.enable = true; # Efficiency # Multicursor support multicursors.enable = true; # auto bracket completion nvim-autopairs.enable = true; # Indentation guides indent-blankline.enable = true; # Surround text blocks surround.enable = true; # Automatic indent intellitab.enable = true; # Code navigation navbuddy.enable = true; navbuddy.lsp.autoAttach = true; # Layout Related # winbar that uses nvim-navic in order to get LSP context from your language server. barbecue.enable = true; # tab bar like Firefox or Chrome bufferline.enable = true; # sidebar file browser nvim-tree.enable = true; # Terminal in vim toggleterm.enable = true; # Alerts / CodeActions trouble.enable = true; # Code Related # Parser generator tool treesitter.enable = true; # Snippet engine for neovim luasnip.enable = true; cmp_luasnip.enable = true; # CMP Addons # cmp-buffer.enable = true; # cmp-path.enable = true; # cmp-nvim-lsp.enable = true; # cmp-nvim-lsp-document-symbol.enable = true; # cmp-nvim-lsp-signature-help.enable = true; # List of linters for nixvim lint = { enable = true; lintersByFt = { text = ["vale"]; json = ["jsonlint"]; markdown = ["vale"]; rst = ["vale"]; ruby = ["ruby"]; janet = ["janet"]; inko = ["inko"]; clojure = ["clj-kondo"]; dockerfile = ["hadolint"]; terraform = ["tflint"]; yaml = ["yamllint"]; nix = ["nix"]; }; }; # Popup to show shortcuts which-key = { enable = true; registrations = { "b" = "Manage buffers..."; "c" = "Colorscheme..."; "g" = "Git Options..."; "l" = "LSP Options..."; "n" = "NvimTree / Noice..."; "t" = "Trouble..."; "T" = "ToggleTerm..."; "w" = "Manage Windows..."; "wo" = "Open New..."; "wr" = "Resize..."; "m" = "Multicursor..."; }; }; # Airline / Powerline alternative lualine = { enable = true; componentSeparators = { right = "«"; left = "»"; }; sectionSeparators = { right = ""; left = ""; }; }; telescope = { enable = true; extensions.fzf-native.enable = true; keymaps = { "" = { action = "find_files"; desc = "Search files by name"; }; "s" = { action = "live_grep"; desc = "Search by live grep"; }; "bl" = { action = "buffers"; desc = "[L]list open [B]uffers"; }; "h" = { action = "help_tags"; desc = "Search [H]elp"; }; "W" = { action = "grep_string"; desc = "Search for [W]ord under cursor"; }; "gs" = { action = "git_status"; desc = "Search [G]it [S]tatus"; }; "gl" = { action = "git_commits"; desc = "View [G]it [L]ogs"; }; "r" = { action = "oldfiles"; desc = "Search [R]ecently opened files by name"; }; "cs" = { action = "colorscheme"; desc = "Change [C]olor[s]cheme"; }; }; }; nvim-cmp = { enable = true; autoEnableSources = true; mapping = { "" = "cmp.mapping.complete()"; "" = "cmp.mapping.scroll_docs(-4)"; "" = "cmp.mapping.close()"; "" = "cmp.mapping.scroll_docs(4)"; "" = "cmp.mapping.confirm({ select = true })"; "" = { action = "cmp.mapping.select_prev_item()"; modes = [ "i" "s" ]; }; "" = { action = "cmp.mapping.select_next_item()"; modes = [ "i" "s" ]; }; }; sources = [ # { name = "nvim_lua"; } { name = "nvim_lsp"; } { name = "nvim_lsp_signature_help"; } { name = "calc"; } { name = "path"; } { name = "buffer"; } { name = "luasnip"; } ]; snippet.expand = "luasnip"; window = { completion.border = "rounded"; documentation.border = "rounded"; }; formatting = { fields = [ "menu" "abbr" "kind" ]; # https://rsdlt.github.io/posts/rust-nvim-ide-guide-walkthrough-development-debug/ format = '' function(entry, item) local menu_icon = { nvim_lsp = 'λ', luasnip = '⋗', buffer = 'Ω', path = '🖫', } item.menu = menu_icon[entry.source.name] return item end, ''; }; }; }; colorschemes = { tokyonight.enable = true; gruvbox.enable = true; catppuccin.enable = true; dracula.enable = true; oxocarbon.enable = true; ayu.enable = true; kanagawa.enable = true; }; extraPlugins = with pkgs.vimPlugins; [ everforest onedark-nvim rose-pine ]; }; }