2023-11-18 23:38:20 +00:00
|
|
|
{ pkgs, lib, config, ... }: {
|
2022-11-28 00:21:18 +00:00
|
|
|
|
|
|
|
plugins = [
|
2023-07-02 02:22:03 +00:00
|
|
|
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
|
2023-11-18 23:38:20 +00:00
|
|
|
with pkgs.tree-sitter-grammars;
|
|
|
|
[
|
2023-07-09 20:50:41 +00:00
|
|
|
tree-sitter-bash
|
2024-01-28 04:46:40 +00:00
|
|
|
tree-sitter-c
|
2023-07-09 20:50:41 +00:00
|
|
|
tree-sitter-fish
|
2023-07-09 23:22:41 +00:00
|
|
|
tree-sitter-ini
|
2023-07-09 20:50:41 +00:00
|
|
|
tree-sitter-json
|
2023-07-02 02:22:03 +00:00
|
|
|
tree-sitter-lua
|
2023-07-09 20:50:41 +00:00
|
|
|
tree-sitter-markdown
|
|
|
|
tree-sitter-markdown-inline
|
2023-07-02 02:22:03 +00:00
|
|
|
tree-sitter-nix
|
2023-07-09 23:22:41 +00:00
|
|
|
tree-sitter-puppet
|
|
|
|
tree-sitter-rasi
|
2023-07-02 02:22:03 +00:00
|
|
|
tree-sitter-toml
|
2024-01-28 04:46:40 +00:00
|
|
|
tree-sitter-vimdoc
|
2023-07-02 02:22:03 +00:00
|
|
|
tree-sitter-yaml
|
2023-11-18 23:38:20 +00:00
|
|
|
] ++ (if config.python.enable then [ tree-sitter-python ] else [ ])
|
|
|
|
++ (if config.terraform.enable then [ tree-sitter-hcl ] else [ ])))
|
2022-11-28 00:21:18 +00:00
|
|
|
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
2023-07-09 20:50:41 +00:00
|
|
|
pkgs.vimPlugins.playground # Tree-sitter experimenting
|
2022-11-28 00:21:18 +00:00
|
|
|
pkgs.vimPlugins.nginx-vim
|
2023-07-19 03:36:09 +00:00
|
|
|
pkgs.baleia-nvim # Clean ANSI from kitty scrollback
|
2023-08-04 05:14:05 +00:00
|
|
|
# pkgs.hmts-nvim # Tree-sitter injections for home-manager
|
2023-10-08 15:17:55 +00:00
|
|
|
(pkgs.vimUtils.buildVimPlugin {
|
2023-07-09 20:50:41 +00:00
|
|
|
pname = "nmasur";
|
|
|
|
version = "0.1";
|
|
|
|
src = ../plugin;
|
|
|
|
})
|
2023-11-18 23:38:20 +00:00
|
|
|
] ++ (if config.kubernetes.enable then [ pkgs.vimPlugins.vim-helm ] else [ ]);
|
2022-11-28 00:21:18 +00:00
|
|
|
|
|
|
|
setup."nvim-treesitter.configs" = {
|
|
|
|
highlight = { enable = true; };
|
|
|
|
indent = { enable = true; };
|
2023-07-09 23:22:41 +00:00
|
|
|
matchup = { enable = true; }; # Uses vim-matchup
|
2022-11-28 00:21:18 +00:00
|
|
|
|
|
|
|
textobjects = {
|
|
|
|
select = {
|
|
|
|
enable = true;
|
|
|
|
lookahead = true; # Jump forward automatically
|
|
|
|
|
|
|
|
keymaps = {
|
|
|
|
"['af']" = "@function.outer";
|
|
|
|
"['if']" = "@function.inner";
|
|
|
|
"['ac']" = "@class.outer";
|
|
|
|
"['ic']" = "@class.inner";
|
|
|
|
"['al']" = "@loop.outer";
|
|
|
|
"['il']" = "@loop.inner";
|
|
|
|
"['aa']" = "@call.outer";
|
|
|
|
"['ia']" = "@call.inner";
|
|
|
|
"['ar']" = "@parameter.outer";
|
|
|
|
"['ir']" = "@parameter.inner";
|
|
|
|
"['aC']" = "@comment.outer";
|
|
|
|
"['iC']" = "@comment.outer";
|
|
|
|
"['a/']" = "@comment.outer";
|
|
|
|
"['i/']" = "@comment.outer";
|
|
|
|
"['a;']" = "@statement.outer";
|
|
|
|
"['i;']" = "@statement.outer";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-07-06 18:07:29 +00:00
|
|
|
# Use mkAfter to ensure tree-sitter is already loaded
|
|
|
|
lua = lib.mkAfter ''
|
|
|
|
-- Use HCL parser with .tf files
|
|
|
|
vim.treesitter.language.register('hcl', 'terraform')
|
|
|
|
'';
|
|
|
|
|
2022-11-28 00:21:18 +00:00
|
|
|
}
|