mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-10 12:55:28 +02:00
treesitter-refactor: package option + formatting
This commit is contained in:
parent
4e116aad44
commit
7cd4a44462
1 changed files with 114 additions and 102 deletions
|
@ -1,20 +1,28 @@
|
||||||
{
|
{ pkgs
|
||||||
pkgs,
|
, config
|
||||||
config,
|
, lib
|
||||||
lib,
|
, ...
|
||||||
...
|
|
||||||
}:
|
}:
|
||||||
with lib; {
|
with lib; {
|
||||||
options.plugins.treesitter-refactor = let
|
options.plugins.treesitter-refactor =
|
||||||
|
let
|
||||||
disable = mkOption {
|
disable = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "List of languages to disable the module on";
|
description = "List of languages to disable the module on";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
enable =
|
enable =
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
"Enable treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
"Enable treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.vimPlugins.nvim-treesitter-refactor;
|
||||||
|
description = "Plugin to use for treesitter-refactor";
|
||||||
|
};
|
||||||
|
|
||||||
highlightDefinitions = {
|
highlightDefinitions = {
|
||||||
inherit disable;
|
inherit disable;
|
||||||
enable =
|
enable =
|
||||||
|
@ -95,11 +103,13 @@ with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
cfg = config.plugins.treesitter-refactor;
|
cfg = config.plugins.treesitter-refactor;
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
extraPlugins = with pkgs.vimPlugins; [nvim-treesitter-refactor];
|
extraPlugins = [ cfg.package ];
|
||||||
|
|
||||||
plugins.treesitter.moduleConfig.refactor = {
|
plugins.treesitter.moduleConfig.refactor = {
|
||||||
highlight_definitions = {
|
highlight_definitions = {
|
||||||
inherit (cfg.highlightDefinitions) enable disable;
|
inherit (cfg.highlightDefinitions) enable disable;
|
||||||
|
@ -112,9 +122,11 @@ with lib; {
|
||||||
};
|
};
|
||||||
navigation = {
|
navigation = {
|
||||||
inherit (cfg.navigation) enable disable;
|
inherit (cfg.navigation) enable disable;
|
||||||
keymaps = let
|
keymaps =
|
||||||
|
let
|
||||||
cfgK = cfg.navigation.keymaps;
|
cfgK = cfg.navigation.keymaps;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
goto_definition = cfgK.gotoDefinition;
|
goto_definition = cfgK.gotoDefinition;
|
||||||
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
|
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
|
||||||
list_definitions = cfgK.listDefinitons;
|
list_definitions = cfgK.listDefinitons;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue