{ pkgs, lib, ... }: let in { home.packages = with pkgs; [ # Required clipboard provider xclip # Required for find in file ripgrep ]; programs.nixvim = { enable = true; viAlias = true; vimAlias = true; globals = { mapleader = " "; }; options = { autoindent = true; expandtab = true; foldlevel=20; guifont = "MesloLGS\ NF\ 10"; number = true; shiftwidth = 4; tabstop = 4; }; keymaps = [ # Modes: https://superuser.com/questions/1702308/how-can-i-configure-shortcut-keys-in-all-modes-of-vim # n - normal # i - insert # c - cmd # v - visual select # x - visual only # s - selection # o - oper # t - terminal # l - lang { # Open new vertical split and starts a new terminal window mode = "n"; key = "ot"; action = "vs | te"; } { # toggle the left tree panel mode = "n"; key = "op"; action = "NvimTreeToggle"; } { # Open cwd filename fuzzy search mode = "n"; key = "o."; action = "Telescope file_browser"; } { # Open fuzzy filename recursive search mode = "n"; key = "."; action = "Telescope find_files"; } { # Search file contents of cwd mode = "n"; key = "of"; action = "Telescope live_grep"; } { # Keep cursor centered while navigating mode = "n"; key = ""; action = "zz"; } { # Keep cursor centered while navigating mode = "n"; key = ""; action = "zz"; } { # Keep cursor centered while skipping to search results mode = "n"; key = "n"; action = "nzzzv"; } { # Keep cursor centered while skipping to search results mode = "n"; key = "N"; action = "Nzzzv"; } { # Yank to system clipboard mode = "n"; key = "y"; action = "\"+y"; } { # Yank to system clipboard mode = "n"; key = "Y"; action = "\"+Y"; } { # Delete into the void mode = "n"; key = "d"; action = "\"_d"; } { # Move visual selection up one row mode = "v"; key = "J"; action = ":m '>+1gv=gv"; } { # Move visual selection down one row mode = "v"; key = "K"; action = ":m '<-2gv=gv"; } { # Yank selection to system clipboard mode = "v"; key = "y"; action = "\"+y"; } { # Delete selection into void mode = "v"; key = "d"; action = "\"_d"; } { # leader+p delete the selection to the void, then paste mode = "x"; key = "p"; action = "\"_dP"; } ]; plugins = { nvim-tree = { enable = true; openOnSetup = true; }; nvim-autopairs = { enable = true; checkTs = true; }; treesitter = { enable = true; folding = true; indent = true; ensureInstalled = [ "rust" "toml" "lua" ]; }; rainbow-delimiters.enable = true; treesitter-refactor = { enable = true; #highlightCurrentScope.enable = true; navigation.enable = true; smartRename.enable = true; }; comment-nvim = { enable = true; toggler = { line = ""; block = ""; }; }; floaterm = { enable = true; position = "auto"; keymaps = { toggle = "t"; }; }; telescope.enable = true; rust-tools.enable = true; nvim-cmp.enable = true; cmp-nvim-lsp.enable = true; # Read settings here: https://github.com/mfussenegger/nvim-dap#Usage # See :help dap.txt, :help dap-mapping and :help dap-api. cmp-dap.enable = true; cmp-buffer.enable = true; cmp-nvim-lsp-signature-help.enable = true; cmp-nvim-lua.enable = true; cmp-path.enable = true; presence-nvim.enable = true; nix.enable = true; airline = { enable = true; powerline = true; }; }; extraConfigLua = builtins.readFile ./../rsrcs/nvim.lua; extraPlugins = with pkgs.vimPlugins; [ telescope-file-browser-nvim monokai-pro-nvim nvim-lspconfig vim-vsnip hop-nvim ]; }; }