{ pkgs, lib, zls, ... }: 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 = " "; }; filetype.extension = { templ = "templ"; }; opts = { 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"; } { mode = "v"; key = ">"; action = ">gv"; } { mode = "v"; key = "<"; action = "