mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-09 12:25:03 +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,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
with lib; {
|
||||
options.plugins.treesitter-refactor = let
|
||||
options.plugins.treesitter-refactor =
|
||||
let
|
||||
disable = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "List of languages to disable the module on";
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
enable =
|
||||
mkEnableOption
|
||||
"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 = {
|
||||
inherit disable;
|
||||
enable =
|
||||
|
@ -95,11 +103,13 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.treesitter-refactor;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [nvim-treesitter-refactor];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.treesitter.moduleConfig.refactor = {
|
||||
highlight_definitions = {
|
||||
inherit (cfg.highlightDefinitions) enable disable;
|
||||
|
@ -108,13 +118,15 @@ with lib; {
|
|||
highlight_current_scope = cfg.highlightCurrentScope;
|
||||
smart_rename = {
|
||||
inherit (cfg.smartRename) enable disable;
|
||||
keymaps = {smart_rename = cfg.smartRename.keymaps.smartRename;};
|
||||
keymaps = { smart_rename = cfg.smartRename.keymaps.smartRename; };
|
||||
};
|
||||
navigation = {
|
||||
inherit (cfg.navigation) enable disable;
|
||||
keymaps = let
|
||||
keymaps =
|
||||
let
|
||||
cfgK = cfg.navigation.keymaps;
|
||||
in {
|
||||
in
|
||||
{
|
||||
goto_definition = cfgK.gotoDefinition;
|
||||
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
|
||||
list_definitions = cfgK.listDefinitons;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue