treesitter: fix it properly!

This commit is contained in:
Pedro Alves 2021-02-01 16:40:07 +00:00
parent 0a380bc90d
commit ea1a5a1a10
2 changed files with 21 additions and 22 deletions

View file

@ -54,6 +54,8 @@
enable = true; enable = true;
servers.clangd.enable = true; servers.clangd.enable = true;
}; };
plugins.treesitter.enable = true;
}; };
}) })
]; ];

View file

@ -30,10 +30,9 @@ in
incrementalSelection = let incrementalSelection = let
keymap = default: mkOption { keymap = default: mkOption {
type = types.str; type = types.str;
default = default; inherit default;
}; };
in mkOption { in {
type = types.nullOr (types.submodule {
enable = mkEnableOption "Incremental selection based on the named nodes from the grammar"; enable = mkEnableOption "Incremental selection based on the named nodes from the grammar";
keymaps = { keymaps = {
initSelection = keymap "gnn"; initSelection = keymap "gnn";
@ -41,8 +40,6 @@ in
scopeIncremental = keymap "grc"; scopeIncremental = keymap "grc";
nodeDecremental = keymap "grm"; nodeDecremental = keymap "grm";
}; };
});
default = null;
}; };
indent = mkEnableOption "Enable tree-sitter based indentation"; indent = mkEnableOption "Enable tree-sitter based indentation";
@ -60,17 +57,17 @@ in
custom_captures = mkIf (cfg.customCaptures != {}) cfg.customCaptures; custom_captures = mkIf (cfg.customCaptures != {}) cfg.customCaptures;
}; };
incremental_selection = mkIf cfg.incrementalSelection.enable { # incremental_selection = mkIf cfg.incrementalSelection.enable {
enable = true; # enable = true;
keymaps = { # keymaps = {
init_selection = cfg.incrementalSelection.keymaps.initSelection; # init_selection = cfg.incrementalSelection.keymaps.initSelection;
node_incremental = cfg.incrementalSelection.keymaps.nodeIncremental; # node_incremental = cfg.incrementalSelection.keymaps.nodeIncremental;
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental; # scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental; # node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
}; # };
}; # };
indent = mkIf cfg.indent.enable { indent = mkIf cfg.indent {
enable = true; enable = true;
}; };