diff --git a/checks/nvim.nix b/checks/nvim.nix new file mode 100644 index 0000000..8316b44 --- /dev/null +++ b/checks/nvim.nix @@ -0,0 +1,9 @@ +{ nvim +, system +, nixvim +, ... +}: +nixvim.lib.${system}.check.mkTestDerivationFromNvim { + inherit nvim; + name = "A nixvim configuration"; +} diff --git a/flake.lock b/flake.lock index a688ec6..10ab0cf 100644 --- a/flake.lock +++ b/flake.lock @@ -17,6 +17,20 @@ } }, "flake-compat_2": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1696426674, @@ -51,27 +65,8 @@ } }, "flake-parts_2": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" - }, - "locked": { - "lastModified": 1706830856, - "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_3": { "inputs": { "nixpkgs-lib": [ - "nixvim", "nixvim", "nixpkgs" ] @@ -129,7 +124,6 @@ "gitignore": { "inputs": { "nixpkgs": [ - "nixvim", "nixvim", "pre-commit-hooks", "nixpkgs" @@ -169,42 +163,19 @@ "type": "github" } }, - "home-manager_2": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1706955260, - "narHash": "sha256-W3y0j77IDVbmbajudHoUr46RpswujUCl+D5Vru53UsI=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "880d9bc2110f7cae59698f715b8ca42cdc53670c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, "nix-darwin": { "inputs": { "nixpkgs": [ - "nixvim", "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1706833576, - "narHash": "sha256-w7BL0EWRts+nD1lbLECIuz6fRzmmV+z8oWwoY7womR0=", + "lastModified": 1707707289, + "narHash": "sha256-YuDt/eSTXMEHv8jS8BEZJgqCcG8Tr3cyqaZjJFXZHsw=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "bdbae6ecff8fcc322bf6b9053c0b984912378af7", + "rev": "44f50a5ecaab72a61d5fd8e5c5717bc4bf9c25dd", "type": "github" }, "original": { @@ -269,77 +240,25 @@ "type": "github" } }, - "nixpkgs-lib_2": { - "locked": { - "dir": "lib", - "lastModified": 1706550542, - "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1706732774, - "narHash": "sha256-hqJlyJk4MRpcItGYMF+3uHe8HvxNETWvlGtLuVpqLU0=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b8b232ae7b8b144397fdb12d20f592e5e7c1a64d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixvim": { "inputs": { + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts_2", + "home-manager": [ + "home-manager" + ], + "nix-darwin": "nix-darwin", "nixpkgs": [ "nixpkgs" ], - "nixvim": "nixvim_2" - }, - "locked": { - "lastModified": 1708033516, - "narHash": "sha256-+QFsJfRbY7VN68S/f6FKMP3DjyIo/WmI5rY6d1N5Gkw=", - "owner": "ecarlson94", - "repo": "nixvim", - "rev": "569efbbe645317a08708234cb059f57ac1712ea5", - "type": "github" - }, - "original": { - "owner": "ecarlson94", - "repo": "nixvim", - "rev": "569efbbe645317a08708234cb059f57ac1712ea5", - "type": "github" - } - }, - "nixvim_2": { - "inputs": { - "flake-parts": "flake-parts_3", - "home-manager": "home-manager_2", - "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs_2", "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1707344886, - "narHash": "sha256-icqj994+jxpkNMP8r6csF3MoEwYzme4CM0rPF4044oM=", + "lastModified": 1708033886, + "narHash": "sha256-uJP+bYDMrIHdOBrKHfRRuqsEIT1zEjCqE8oKHeVC6+Y=", "owner": "nix-community", "repo": "nixvim", - "rev": "ec07263b1693ebbd74080b1e21d9b88ae7b74d18", + "rev": "dcbe894bea41567e4d751367666b249cfd489704", "type": "github" }, "original": { @@ -350,26 +269,24 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "flake-utils": "flake-utils_2", "gitignore": "gitignore", "nixpkgs": [ - "nixvim", "nixvim", "nixpkgs" ], "nixpkgs-stable": [ - "nixvim", "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1706424699, - "narHash": "sha256-Q3RBuOpZNH2eFA1e+IHgZLAOqDD9SKhJ/sszrL8bQD4=", + "lastModified": 1708018599, + "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf", + "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index dcdac6f..a6c1f60 100644 --- a/flake.nix +++ b/flake.nix @@ -12,19 +12,19 @@ home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - nixvim.url = "github:ecarlson94/nixvim/569efbbe645317a08708234cb059f57ac1712ea5"; + nixvim.url = "github:nix-community/nixvim"; nixvim.inputs.nixpkgs.follows = "nixpkgs"; + nixvim.inputs.home-manager.follows = "home-manager"; }; outputs = { flake-parts , nixpkgs , home-manager + , nixvim + , self , ... } @ inputs: - let - # config = import ./config; # import the nixvim module directly - in flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" @@ -59,26 +59,19 @@ , system , ... }: - let - # nixvimLib = nixvim.lib.${system}; - # nixvim' = nixvim.legacyPackages.${system}; - # nvim = nixvim'.makeNixvimWithModule { - # inherit pkgs; - # module = config; - # # You can use `extraSpecialArgs` to pass additional arguments to your module files - # extraSpecialArgs = { - # # inherit (inputs) foo; - # }; - # }; - in { checks = let - args = { inherit inputs; }; + nvim = self.packages.${system}.nvim; in { - nixpkgs-fmt = pkgs.callPackage ./checks/nixpkgs-fmt.nix args; + nixpkgs-fmt = pkgs.callPackage ./checks/nixpkgs-fmt.nix { inherit inputs; }; + nvim = pkgs.callPackage ./checks/nvim.nix { inherit nixvim nvim system; }; }; + + packages = { + nvim = pkgs.callPackage ./modules/nvim/makeNvim.nix { inherit inputs system nixvim; }; + }; }; }; } diff --git a/machines/wsl/configuration.nix b/machines/wsl/configuration.nix index 79b73fb..9dc6d45 100644 --- a/machines/wsl/configuration.nix +++ b/machines/wsl/configuration.nix @@ -30,7 +30,6 @@ environment.systemPackages = with pkgs; [ # Flakes use Git to pull dependencies from data sources git - inputs.nixvim.packages."x86_64-linux".default (import ./bin/rebuild.nix { inherit pkgs; }) ]; diff --git a/modules/nvim/core/autocmds.nix b/modules/nvim/core/autocmds.nix new file mode 100644 index 0000000..e92d52b --- /dev/null +++ b/modules/nvim/core/autocmds.nix @@ -0,0 +1,10 @@ +{ + autoCmd = [ + # Automatically trim all whitespace an save + { + event = [ "BufWritePre" ]; + pattern = [ "*" ]; + command = ":%s/\\s\\+$//e"; + } + ]; +} diff --git a/modules/nvim/core/default.nix b/modules/nvim/core/default.nix new file mode 100644 index 0000000..3998d5d --- /dev/null +++ b/modules/nvim/core/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./options.nix + ./autocmds.nix + ./theme.nix + ./keymaps.nix + ]; +} diff --git a/modules/nvim/core/keymaps.nix b/modules/nvim/core/keymaps.nix new file mode 100644 index 0000000..3226861 --- /dev/null +++ b/modules/nvim/core/keymaps.nix @@ -0,0 +1,77 @@ +{ + keymaps = [ + # Saving + { mode = [ "i" "x" "n" "s" "v" ]; key = ""; action = "wa"; options.desc = "Save all files"; } + { mode = [ "x" "n" "s" "v" ]; key = "fs"; action = "wa"; options.desc = "Save all files"; } + + # Better up/down + { mode = [ "x" "n" ]; key = "j"; action = "v:count == 0 ? 'gj' : 'j'"; options = { expr = true; silent = true; }; } + { mode = [ "x" "n" ]; key = ""; action = "v:count == 0 ? 'gj' : 'j'"; options = { expr = true; silent = true; }; } + { mode = [ "x" "n" ]; key = "k"; action = "v:count == 0 ? 'gk' : 'k'"; options = { expr = true; silent = true; }; } + { mode = [ "x" "n" ]; key = ""; action = "v:count == 0 ? 'gk' : 'k'"; options = { expr = true; silent = true; }; } + + # Move to window using the hjkl keys + { mode = [ "n" ]; key = ""; action = "h"; options = { desc = "Go to left window"; remap = true; }; } + { mode = [ "n" ]; key = ""; action = "j"; options = { desc = "Go to lower window"; remap = true; }; } + { mode = [ "n" ]; key = ""; action = "k"; options = { desc = "Go to upper window"; remap = true; }; } + { mode = [ "n" ]; key = ""; action = "l"; options = { desc = "Go to right window"; remap = true; }; } + + # Resize window using HJKL keys + # Vim cannot differentiate between hjkl and HJKL for bindings, find a new binding for these that doesn't use arrow keys + # { mode = [ "n" ]; key = ""; action = "resize -2"; options.desc = "Decrease window height"; } + # { mode = [ "n" ]; key = ""; action = "resize +2"; options.desc = "Increase window height"; } + # { mode = [ "n" ]; key = ""; action = "vertical resize -2"; options.desc = "Decrease window width"; } + # { mode = [ "n" ]; key = ""; action = "vertical resize +2"; options.desc = "Increase window width"; } + + # Move lines + { mode = [ "n" ]; key = ""; action = "m .+1=="; options.desc = "Move down"; } + { mode = [ "n" ]; key = ""; action = "m .-2=="; options.desc = "Move up"; } + { mode = [ "i" ]; key = ""; action = "m .+1==gi"; options.desc = "Move down"; } + { mode = [ "i" ]; key = ""; action = "m .-2==gi"; options.desc = "Move up"; } + { mode = [ "v" ]; key = ""; action = ":m '>+1gv=gv"; options.desc = "Move down"; } + { mode = [ "v" ]; key = ""; action = ":m '<-2gv=gv"; options.desc = "Move up"; } + + # Buffers + { mode = [ "n" "v" ]; key = "bd"; action = "bd"; options.desc = "Delete current buffer"; } + { mode = [ "n" ]; key = ""; action = "bprevious"; options.desc = "Prev buffer"; } + { mode = [ "n" ]; key = ""; action = "bnext"; options.desc = "Next buffer"; } + { mode = [ "n" ]; key = "[b"; action = "bprevious"; options.desc = "Prev buffer"; } + { mode = [ "n" ]; key = "]b"; action = "bnext"; options.desc = "Next buffer"; } + + # Clear search with + { mode = [ "i" "n" ]; key = ""; action = "noh"; options.desc = "Escape and clear hlsearch"; } + + # Saner behovior of n and N + { mode = [ "n" ]; key = "n"; action = "'Nn'[v:searchforward].'zv'"; options = { desc = "Next search result"; expr = true; }; } + { mode = [ "x" "o" ]; key = "n"; action = "'Nn'[v:searchforward]"; options = { desc = "Next search result"; expr = true; }; } + { mode = [ "n" ]; key = "N"; action = "'nN'[v:searchforward].'zv'"; options = { desc = "Prev search result"; expr = true; }; } + { mode = [ "x" "o" ]; key = "N"; action = "'nN'[v:searchforward]"; options = { desc = "Prev search result"; expr = true; }; } + + # Better indenting + { mode = [ "v" ]; key = ">"; action = ">gv"; } + { mode = [ "v" ]; key = "<"; action = " string|string[]` + root_spec = [ "lsp" [ ".git" "lua" ] "cwd" ]; + }; + + config.options = { + autowrite = true; # Enable auto write + clipboard = "unnamedplus"; # Sync with system clipboard + completeopt = "menu,menuone,noselect"; + conceallevel = 0; + confirm = true; # Confirm to save changes before exiting modified buffer + cursorline = true; # Enable highlighting of the current line + expandtab = true; # Use spaces instead of tabs + formatoptions = "jcroqlnt"; # tcqj + grepformat = "%f:%l:%c:%m"; + grepprg = "rg --vimgrep"; + ignorecase = true; # Ignore case + inccommand = "nosplit"; # preview incremental substitute + laststatus = 3; # global statusline + list = true; # Show some invisible characters (tabs... + listchars = { + space = "·"; + nbsp = "·"; + tab = ">-"; + extends = ">"; + precedes = "<"; + trail = "~"; + eol = "¬"; + }; + mouse = "a"; # Enable mouse mode + number = true; # Print line number + pumblend = 10; # Popup blend + pumheight = 10; # Maximum number of entries in a popup + relativenumber = false; # Relative line numbers + scrolloff = 4; # Lines of context + sessionoptions = [ "buffers" "curdir" "tabpages" "winsize" "help" "globals" "skiprtp" "folds" ]; + shiftround = true; # Round indent + shiftwidth = 2; # Size of an indent + # opt.shortmess:append({ W = true, I = true, c = true, C = true }) + showmode = false; # Dont show mode since we have a statusline + sidescrolloff = 8; # Columns of context + signcolumn = "yes"; # Always show the signcolumn, otherwise it would shift the text each time + smartcase = true; # Don't ignore case with capitals + smartindent = true; # Insert indents automatically + # smoothscroll = true; + softtabstop = 2; + spelllang = [ "en" ]; + splitbelow = true; # Put new windows below current + splitkeep = "screen"; + splitright = true; # Put new windows right of current + tabstop = 2; # Number of spaces tabs count for + termguicolors = true; # True color support + timeoutlen = 300; + undofile = true; + undolevels = 10000; + updatetime = 200; # Save swap file and trigger CursorHold + virtualedit = "block"; # Allow cursor to move where there is no text in visual block mode + wildmode = "longest:full,full"; # Command-line completion mode + winminwidth = 5; # Minimum window width + wrap = false; # Disable line wrap + fillchars = { + foldopen = ""; + foldclose = ""; + fold = " "; + foldsep = " "; + diff = "╱"; + eob = " "; + }; + }; +} diff --git a/modules/nvim/core/theme.nix b/modules/nvim/core/theme.nix new file mode 100644 index 0000000..c792f68 --- /dev/null +++ b/modules/nvim/core/theme.nix @@ -0,0 +1,15 @@ +{ + colorschemes.catppuccin = { + enable = true; + integrations = { + flash = true; + gitsigns = true; + leap = true; + mini.enabled = true; + telescope.enabled = true; + treesitter = true; + treesitter_context = true; + which_key = true; + }; + }; +} diff --git a/modules/nvim/default.nix b/modules/nvim/default.nix new file mode 100644 index 0000000..a02db10 --- /dev/null +++ b/modules/nvim/default.nix @@ -0,0 +1,7 @@ +{ + # Import all your configuration modules here + imports = [ + ./core + ./plugins + ]; +} diff --git a/modules/nvim/makeNvim.nix b/modules/nvim/makeNvim.nix new file mode 100644 index 0000000..1ac508a --- /dev/null +++ b/modules/nvim/makeNvim.nix @@ -0,0 +1,17 @@ +{ pkgs +, nixvim +, system +, ... +}: +let + config = import ./default.nix; + nixvim' = nixvim.legacyPackages.${system}; +in +nixvim'.makeNixvimWithModule { + inherit pkgs; + module = config; + # You can use `extraSpecialArgs` to pass additional arguments to your module files + extraSpecialArgs = { + # inherit (inputs) foo; + }; +} diff --git a/modules/nvim/plugins/default.nix b/modules/nvim/plugins/default.nix new file mode 100644 index 0000000..f4b38ed --- /dev/null +++ b/modules/nvim/plugins/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./editor + ./treesitter + ./which-key + ]; +} diff --git a/modules/nvim/plugins/editor/default.nix b/modules/nvim/plugins/editor/default.nix new file mode 100644 index 0000000..5a3fec9 --- /dev/null +++ b/modules/nvim/plugins/editor/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./telescope.nix + ./mini.nix + ./toggleterm.nix + ]; +} diff --git a/modules/nvim/plugins/editor/mini.nix b/modules/nvim/plugins/editor/mini.nix new file mode 100644 index 0000000..536da1f --- /dev/null +++ b/modules/nvim/plugins/editor/mini.nix @@ -0,0 +1,9 @@ +{ + plugins.mini = { + enable = true; + + modules = { + surround = { }; + }; + }; +} diff --git a/modules/nvim/plugins/editor/telescope.nix b/modules/nvim/plugins/editor/telescope.nix new file mode 100644 index 0000000..83aa4e0 --- /dev/null +++ b/modules/nvim/plugins/editor/telescope.nix @@ -0,0 +1,51 @@ +{ + plugins.telescope = { + enable = true; + + extensions.ui-select.enable = true; + extensions.fzf-native.enable = true; + + extraOptions = { + pickers.find_files = { + hidden = true; + }; + pickers.git_files = { + hidden = true; + }; + }; + + keymaps = { + "," = { action = "buffers"; desc = "Switch Buffers"; }; + "/" = { action = "live_grep"; desc = "Grep (root dir)"; }; + ":" = { action = "command_history"; desc = "Command History"; }; + "" = { action = "git_files"; desc = "Git Files"; }; + + # Find + "fb" = { action = "buffers"; desc = "Buffers"; }; + "ff" = { action = "find_files"; desc = "Find Files"; }; + "fg" = { action = "git_files"; desc = "Git Files"; }; + "fr" = { action = "oldfiles"; desc = "Recent Files"; }; + + # Git + "gc" = { action = "git_commits"; desc = "Git Commits"; }; + "gs" = { action = "git_status"; desc = "Git Status"; }; + + # Search + "sa" = { action = "autocommands"; desc = "Auto Commands"; }; + "sb" = { action = "current_buffer_fuzzy_find"; desc = "Current Buffer"; }; + "sc" = { action = "command_history"; desc = "Command History"; }; + "sC" = { action = "commands"; desc = "Commands"; }; + "sg" = { action = "live_grep"; desc = "Grep"; }; + "sh" = { action = "help_tags"; desc = "Help Pages"; }; + "sH" = { action = "highlights"; desc = "Highlight Groups"; }; + "sk" = { action = "keymaps"; desc = "Key Maps"; }; + "sm" = { action = "marks"; desc = "Go to Mark"; }; + "sM" = { action = "man_pages"; desc = "Man Pages"; }; + "so" = { action = "vim_options"; desc = "Options"; }; + "sr" = { action = "registers"; desc = "Registers"; }; + "sR" = { action = "resume"; desc = "Resume"; }; + "ss" = { action = "lsp_document_symbols"; desc = "Go to Symbol"; }; + "sS" = { action = "lsp_dynamic_workspace_symbols"; desc = "Go to Symbol (Workspace)"; }; + }; + }; +} diff --git a/modules/nvim/plugins/editor/toggleterm.nix b/modules/nvim/plugins/editor/toggleterm.nix new file mode 100644 index 0000000..f150bb2 --- /dev/null +++ b/modules/nvim/plugins/editor/toggleterm.nix @@ -0,0 +1,27 @@ +{ + plugins.toggleterm = { + enable = true; + + autoScroll = true; + closeOnExit = true; + direction = "horizontal"; + hideNumbers = true; + persistMode = true; + persistSize = true; + shadeTerminals = true; + shadingFactor = -30; + size = 15; + startInInsert = true; + }; + + keymaps = [ + { mode = [ "t" "n" ]; key = "th"; action = "1ToggleTerm"; options.desc = "Open/Close Terminal 1"; } + { mode = [ "t" "n" ]; key = "tn"; action = "2ToggleTerm"; options.desc = "Open/Close Terminal 2"; } + { mode = [ "t" "n" ]; key = "tf"; action = "3ToggleTerm direction=float"; options.desc = "Open/Close Floating Terminal"; } + { mode = [ "t" ]; key = "jk"; action = ""; options.desc = "Quick exit terminal mode"; } + { mode = [ "t" ]; key = ""; action = "wincmd h"; options.desc = "Go to left window"; } + { mode = [ "t" ]; key = ""; action = "wincmd j"; options.desc = "Go to lower window"; } + { mode = [ "t" ]; key = ""; action = "wincmd k"; options.desc = "Go to upper window"; } + { mode = [ "t" ]; key = ""; action = "wincmd l"; options.desc = "Go to right window"; } + ]; +} diff --git a/modules/nvim/plugins/treesitter/context.nix b/modules/nvim/plugins/treesitter/context.nix new file mode 100644 index 0000000..220d5aa --- /dev/null +++ b/modules/nvim/plugins/treesitter/context.nix @@ -0,0 +1,14 @@ +{ + plugins.treesitter-context = { + enable = true; + }; + + keymaps = [ + { + mode = "n"; + key = "ut"; + action = "TSContextToggle"; + options.desc = "Toggle treesitter context"; + } + ]; +} diff --git a/modules/nvim/plugins/treesitter/default.nix b/modules/nvim/plugins/treesitter/default.nix new file mode 100644 index 0000000..cd22203 --- /dev/null +++ b/modules/nvim/plugins/treesitter/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ + ./treesitter.nix + ./context.nix + ./textobjects.nix + ./ts-autotag.nix + ]; +} diff --git a/modules/nvim/plugins/treesitter/textobjects.nix b/modules/nvim/plugins/treesitter/textobjects.nix new file mode 100644 index 0000000..9488b62 --- /dev/null +++ b/modules/nvim/plugins/treesitter/textobjects.nix @@ -0,0 +1,25 @@ +{ + plugins.treesitter-textobjects = { + enable = true; + move = { + enable = true; + + gotoNextStart = { + "]f" = "@function.outer"; + "]c" = "@class.outer"; + }; + gotoNextEnd = { + "]F" = "@function.outer"; + "]C" = "@class.outer"; + }; + gotoPreviousStart = { + "[f" = "@function.outer"; + "[c" = "@class.outer"; + }; + gotoPreviousEnd = { + "[F" = "@function.outer"; + "[C" = "@class.outer"; + }; + }; + }; +} diff --git a/modules/nvim/plugins/treesitter/treesitter.nix b/modules/nvim/plugins/treesitter/treesitter.nix new file mode 100644 index 0000000..60ca3a4 --- /dev/null +++ b/modules/nvim/plugins/treesitter/treesitter.nix @@ -0,0 +1,15 @@ +{ + plugins.treesitter = { + enable = true; + indent = true; + + incrementalSelection = { + enable = true; + keymaps = { + initSelection = ""; + nodeDecremental = ""; + nodeIncremental = ""; + }; + }; + }; +} diff --git a/modules/nvim/plugins/treesitter/ts-autotag.nix b/modules/nvim/plugins/treesitter/ts-autotag.nix new file mode 100644 index 0000000..9fa6d84 --- /dev/null +++ b/modules/nvim/plugins/treesitter/ts-autotag.nix @@ -0,0 +1,5 @@ +{ + plugins.ts-autotag = { + enable = true; + }; +} diff --git a/modules/nvim/plugins/which-key/default.nix b/modules/nvim/plugins/which-key/default.nix new file mode 100644 index 0000000..536de2f --- /dev/null +++ b/modules/nvim/plugins/which-key/default.nix @@ -0,0 +1,26 @@ +{ + plugins.which-key = { + enable = true; + + plugins.spelling.enabled = true; + + registrations = { + "g" = "+goto"; + "gs" = "+surround"; + "]" = "+next"; + "[" = "+previous"; + "" = "+tabs"; + "b" = "+buffers"; + "c" = "+code"; + "f" = "+file/find"; + "g" = "+git"; + "gh" = "+hunks"; + "q" = "+quit/session"; + "s" = "+search"; + "u" = "+ui"; + "w" = "+windows"; + "x" = "+diagnostics/quickfix"; + "t" = "+test/terminal"; + }; + }; +}