diff options
Diffstat (limited to 'modules/neovim/default.nix')
| -rw-r--r-- | modules/neovim/default.nix | 197 |
1 files changed, 139 insertions, 58 deletions
diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index f3200b3..8399307 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -2,16 +2,53 @@ let cfg = config.modules.neovim; scheme = config.modules.scheme; - fromGitHub = ref: repo: pkgs.vimUtils.buildVimPlugin { - pname = "${lib.strings.sanitizeDerivationName repo}"; version = ref; src = builtins.fetchGit { - url = "https://github.com/${repo}.git"; - ref = ref; - }; - doCheck = false; - }; tsparsers = pkgs.symlinkJoin { + # if we don't symlink, startuptime grows by an order of magnitude because of long runtimepath name = "tsparsers"; - paths = (pkgs.vimPlugins.nvim-treesitter.withAllGrammars).dependencies; + # paths = (pkgs.vimPlugins.nvim-treesitter.withAllGrammars).dependencies; + paths = (pkgs.vimPlugins.nvim-treesitter.withPlugins (p: with p; [ + tree-sitter-nix + tree-sitter-nu + tree-sitter-go + tree-sitter-rst + tree-sitter-lua + tree-sitter-css + tree-sitter-yaml + tree-sitter-toml + tree-sitter-scss + tree-sitter-json + tree-sitter-html + tree-sitter-fish + tree-sitter-bash + tree-sitter-query + tree-sitter-ocaml + tree-sitter-ocaml-interface + tree-sitter-latex + tree-sitter-python + tree-sitter-bibtex + tree-sitter-verilog + tree-sitter-comment + tree-sitter-dockerfile + tree-sitter-make + tree-sitter-cmake + tree-sitter-verilog + tree-sitter-scheme + tree-sitter-llvm + tree-sitter-html + tree-sitter-glsl + tree-sitter-devicetree + tree-sitter-cuda + tree-sitter-c + tree-sitter-cpp + tree-sitter-lua + tree-sitter-zig + tree-sitter-rust + tree-sitter-haskell + tree-sitter-toml + tree-sitter-markdown + tree-sitter-markdown-inline + tree-sitter-tablegen + ])).dependencies; }; in { @@ -30,11 +67,6 @@ in recursive = true; }; - xdg.configFile."nvim/colors" = { - source = ./nvim/colors; - recursive = true; - }; - # home.sessionVariables.MANPAGER = "nvim +Man!"; programs.neovim = { @@ -44,9 +76,16 @@ in vimAlias = false; vimdiffAlias = true; plugins = with pkgs.vimPlugins; [ + # lazy loading + lz-n + + # preconfigured treesitter parsers nvim-treesitter + tsparsers + + # colorschemes. TODO: delete base16-nvim - # nvim-treesitter.withAllGrammars + { plugin = nvim-highlight-colors; type = "lua"; @@ -61,61 +100,103 @@ in } ''; } - # (nvim-treesitter.withPlugins (p: with p; [ - # tree-sitter-nix - # tree-sitter-make - # tree-sitter-cmake - # tree-sitter-verilog - # tree-sitter-scheme - # tree-sitter-llvm - # tree-sitter-html - # tree-sitter-glsl - # tree-sitter-devicetree - # tree-sitter-cuda - # tree-sitter-c - # tree-sitter-cpp - # tree-sitter-lua - # tree-sitter-zig - # tree-sitter-rust - # tree-sitter-haskell - # tree-sitter-toml - # tree-sitter-markdown - # tree-sitter-markdown-inline - # tree-sitter-tablegen - # ])) { plugin = lean-nvim; - config = + optional = true; + type = "lua"; + config = # lua '' - require('lean').setup{ mappings = true } + require("lz.n").load({ + "lean", + ft = "lean", + after = function() + require('lean').setup({ mappings = true }) + end, + }) ''; - type = "lua"; } - plenary-nvim - mini-icons - oil-nvim + tmux-nvim - # noice-nvim nvim-lspconfig - # blink-cmp - telescope-nvim + + { + plugin = telescope-nvim; + optional = true; + type = "lua"; + config = + # lua + '' + require("lz.n").load({ + "telescope.nvim", + cmd = "Telescope", + after = function() + require('telescope').setup({}) + require('telescope').load_extension('fzf') + end, + }) + ''; + } telescope-fzf-native-nvim - # fzf-lua -# https://github.com/ibhagwan/fzf-lua/commit/26095d98c2969730457bf5b483919280e2cfb8bb - # (fromGitHub "HEAD" "ibhagwan/fzf-lua") - # fzf-lua.overrideAttrs (finalAttrs: previousAttrs: { - # previousAttrs.doCheck = false; - # }) - vim-obsession - (pkgs.neovimUtils.buildNeovimPlugin { - luaAttr = pkgs.luaPackages.fzf-lua; - doCheck = false; - }) + + # textobjects + mini-ai + { + plugin = mini-pairs; + type = "lua"; + config = + # lua + '' + require("mini.pairs").setup() + ''; + } + { + plugin = mini-surround; + type = "lua"; + config = + # lua + '' + require("mini.surround").setup({ silent = true }) + ''; + } + { + plugin = mini-trailspace; + type = "lua"; + config = + # lua + '' + require("mini.trailspace").setup() + ''; + } + { + plugin = mini-splitjoin; + type = "lua"; + config = + # lua + '' + require("mini.splitjoin").setup({ + mappings = { toggle = "", split = "", join = "" }, + }) + ''; + } + { + plugin = treesj; + type = "lua"; + config = + # lua + '' + require("treesj").setup({ use_default_keymaps = false, notify = false}) + --require("lz.n").load({ + -- "treesj", + -- cmd = {'TSJSplit', 'TSJToggle', 'TSJJoin'}, + -- after = function() + -- require("treesj").setup(use_default_keymaps = false) + -- end, + -- }) + ''; + } ]; - # extraLuaPackages = ps: with ps; [ - # ]; extraLuaConfig = '' ${builtins.readFile ./nvim/init.lua} |