Skip to content

Commit

Permalink
treesitter: fix it properly!
Browse files Browse the repository at this point in the history
  • Loading branch information
pta2002 committed Feb 1, 2021
1 parent 0a380bc commit ea1a5a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
enable = true;
servers.clangd.enable = true;
};

plugins.treesitter.enable = true;
};
})
];
Expand Down
41 changes: 19 additions & 22 deletions plugins/languages/treesitter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,16 @@ in
incrementalSelection = let
keymap = default: mkOption {
type = types.str;
default = default;
inherit default;
};
in {
enable = mkEnableOption "Incremental selection based on the named nodes from the grammar";
keymaps = {
initSelection = keymap "gnn";
nodeIncremental = keymap "grn";
scopeIncremental = keymap "grc";
nodeDecremental = keymap "grm";
};
in mkOption {
type = types.nullOr (types.submodule {
enable = mkEnableOption "Incremental selection based on the named nodes from the grammar";
keymaps = {
initSelection = keymap "gnn";
nodeIncremental = keymap "grn";
scopeIncremental = keymap "grc";
nodeDecremental = keymap "grm";
};
});
default = null;
};

indent = mkEnableOption "Enable tree-sitter based indentation";
Expand All @@ -60,17 +57,17 @@ in
custom_captures = mkIf (cfg.customCaptures != {}) cfg.customCaptures;
};

incremental_selection = mkIf cfg.incrementalSelection.enable {
enable = true;
keymaps = {
init_selection = cfg.incrementalSelection.keymaps.initSelection;
node_incremental = cfg.incrementalSelection.keymaps.nodeIncremental;
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
};
};
# incremental_selection = mkIf cfg.incrementalSelection.enable {
# enable = true;
# keymaps = {
# init_selection = cfg.incrementalSelection.keymaps.initSelection;
# node_incremental = cfg.incrementalSelection.keymaps.nodeIncremental;
# scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
# node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
# };
# };

indent = mkIf cfg.indent.enable {
indent = mkIf cfg.indent {
enable = true;
};

Expand Down

0 comments on commit ea1a5a1

Please sign in to comment.