mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 16:39:00 +02:00
undotree: init plugin
This commit is contained in:
parent
f97e2f6ffc
commit
2ca3c09635
3 changed files with 136 additions and 0 deletions
|
@ -49,6 +49,7 @@
|
||||||
powerline = true;
|
powerline = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins.undotree.enable = true;
|
||||||
plugins.gitgutter.enable = true;
|
plugins.gitgutter.enable = true;
|
||||||
|
|
||||||
plugins.lsp = {
|
plugins.lsp = {
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
./git/gitgutter.nix
|
./git/gitgutter.nix
|
||||||
|
|
||||||
|
./utils/undotree.nix
|
||||||
|
|
||||||
./languages/treesitter.nix
|
./languages/treesitter.nix
|
||||||
|
|
||||||
./nvim-lsp
|
./nvim-lsp
|
||||||
|
|
133
plugins/utils/undotree.nix
Normal file
133
plugins/utils/undotree.nix
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.programs.nixvim.plugins.undotree;
|
||||||
|
helpers = import ../helpers.nix { inherit lib; };
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
programs.nixvim.plugins.undotree = {
|
||||||
|
enable = mkEnableOption "Enable undotree";
|
||||||
|
|
||||||
|
windowLayout = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = "Window layour for undotree. Check https://github.com/mbbill/undotree/blob/master/plugin/undotree.vim#L29 for reference";
|
||||||
|
};
|
||||||
|
|
||||||
|
shortIndicators = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "E.g. use 'd' instead of 'days'";
|
||||||
|
};
|
||||||
|
|
||||||
|
windowWidth = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = "Undotree window width";
|
||||||
|
};
|
||||||
|
|
||||||
|
diffHeight = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = "Undotree diff panel height";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoOpenDiff = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Auto open diff window";
|
||||||
|
};
|
||||||
|
|
||||||
|
focusOnToggle = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Focus undotree after being opened";
|
||||||
|
};
|
||||||
|
|
||||||
|
treeNodeShape = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Tree node shape";
|
||||||
|
};
|
||||||
|
|
||||||
|
diffCommand = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Diff command";
|
||||||
|
};
|
||||||
|
|
||||||
|
relativeTimestamp = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Use a relative timestamp";
|
||||||
|
};
|
||||||
|
|
||||||
|
highlightChangedText = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Highlight changed text";
|
||||||
|
};
|
||||||
|
|
||||||
|
highlightChangesWithSign = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Highlight changes with a sign in the gutter";
|
||||||
|
};
|
||||||
|
|
||||||
|
highlightSyntaxAdd = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Added lines highlight group";
|
||||||
|
};
|
||||||
|
|
||||||
|
highlightSyntaxChange = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Changed lines highlight group";
|
||||||
|
};
|
||||||
|
|
||||||
|
highlightSyntaxDel = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Deleted lines highlight group";
|
||||||
|
};
|
||||||
|
|
||||||
|
showHelpLine = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Show help line";
|
||||||
|
};
|
||||||
|
|
||||||
|
showCursorLine = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Show cursor line";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.nixvim = {
|
||||||
|
extraPlugins = [ pkgs.vimPlugins.undotree ];
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
undotree_WindowLayout = mkIf (cfg.windowLayout != null) cfg.windowLayout;
|
||||||
|
undotree_ShortIndicators = mkIf cfg.shortIndicators 1;
|
||||||
|
undotree_SplitWidth = mkIf (cfg.windowWidth != null) cfg.windowWidth;
|
||||||
|
undotree_DiffpanelHeight = mkIf (cfg.diffHeight != null) cfg.diffHeight;
|
||||||
|
undotree_DiffAutoOpen = mkIf (!cfg.autoOpenDiff) 0;
|
||||||
|
undotree_SetFocusWhenToggle = mkIf cfg.focusOnToggle 1;
|
||||||
|
undotree_TreeNodeShape = mkIf (cfg.treeNodeShape != null) cfg.treeNodeShape;
|
||||||
|
undotree_DiffCommand = mkIf (cfg.diffCommand != null) cfg.diffCommand;
|
||||||
|
undotree_RelativeTimestamp = mkIf (!cfg.relativeTimestamp) 0;
|
||||||
|
undotree_HighlightChangedText = mkIf (!cfg.highlightChangedText) 0;
|
||||||
|
undotree_HighlightChangedWithSign = mkIf (!cfg.highlightChangesWithSign) 0;
|
||||||
|
undotree_HighlightSyntaxAdd = mkIf (cfg.highlightSyntaxAdd != null) cfg.highlightSyntaxAdd;
|
||||||
|
undotree_HighlightSyntaxChange = mkIf (cfg.highlightSyntaxChange != null) cfg.highlightSyntaxAdd;
|
||||||
|
undotree_HighlightSyntaxDel = mkIf (cfg.highlightSyntaxDel != null) cfg.highlightSyntaxDel;
|
||||||
|
undotree_HelpLine = mkIf (!cfg.showHelpLine) 0;
|
||||||
|
undotree_CursorLine = mkIf (!cfg.showCursorLine) 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue