2024-03-24 23:39:49 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: {
|
2024-05-29 20:40:03 +02:00
|
|
|
options.user.nvim.enable-treesitter = lib.mkEnableOption "enable nvim treesitter";
|
|
|
|
|
2024-03-24 23:39:49 +01:00
|
|
|
config =
|
2024-05-29 20:40:03 +02:00
|
|
|
lib.mkIf (config.user.nvim.enable-treesitter && config.user.nvim.enable)
|
2024-03-24 23:39:49 +01:00
|
|
|
{
|
2024-05-29 20:40:03 +02:00
|
|
|
user.nvim.enable-completions = true;
|
2024-03-24 23:39:49 +01:00
|
|
|
programs.nixvim = {
|
2024-07-28 02:11:57 +02:00
|
|
|
opts.foldmethod = "expr";
|
2024-03-24 23:39:49 +01:00
|
|
|
plugins.treesitter = {
|
|
|
|
enable = true;
|
|
|
|
folding = true;
|
2024-07-28 02:11:57 +02:00
|
|
|
settings.indent.enable = true;
|
2024-03-24 23:39:49 +01:00
|
|
|
nixvimInjections = true;
|
|
|
|
};
|
|
|
|
plugins.treesitter-context.enable = true;
|
|
|
|
plugins.indent-blankline.enable = true;
|
|
|
|
extraPlugins = with pkgs.vimPlugins; [
|
|
|
|
treesj
|
|
|
|
];
|
2024-04-23 18:04:37 +02:00
|
|
|
extraConfigLua = ''
|
|
|
|
require("treesj").setup({
|
|
|
|
use_default_keymaps=false,
|
|
|
|
})
|
|
|
|
'';
|
|
|
|
keymaps = [
|
2024-06-16 21:52:04 +02:00
|
|
|
{
|
|
|
|
action = ":TSContextToggle<CR>";
|
|
|
|
key = "<leader>x";
|
|
|
|
mode = "n";
|
|
|
|
options = {
|
|
|
|
silent = true;
|
|
|
|
desc = "tree context toggle";
|
|
|
|
};
|
|
|
|
}
|
2024-04-23 18:04:37 +02:00
|
|
|
{
|
|
|
|
action = ":TSJToggle<CR>";
|
|
|
|
key = "<leader>j";
|
|
|
|
mode = "n";
|
|
|
|
options = {
|
|
|
|
silent = true;
|
|
|
|
desc = "tree sitter join toggle";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2024-03-24 23:39:49 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
imports = [
|
|
|
|
./rainbow-delimiters.nix
|
|
|
|
./arial.nix
|
2024-03-30 14:31:36 +01:00
|
|
|
./tree-sitter-nu.nix
|
2024-03-24 23:39:49 +01:00
|
|
|
];
|
|
|
|
}
|