plugins/chadtree: iconsPackage -> icons provider options

This commit is contained in:
Austin Horstman 2024-09-20 09:47:05 -05:00
parent 81ae3febd2
commit 23a903f13c
No known key found for this signature in database
2 changed files with 168 additions and 133 deletions

View file

@ -3,6 +3,7 @@
helpers, helpers,
config, config,
pkgs, pkgs,
options,
... ...
}: }:
with lib; with lib;
@ -11,6 +12,20 @@ let
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str); mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
in in
{ {
# TODO: added 2024-09-20 remove after 24.11
imports = [
(lib.mkRemovedOptionModule
[
"plugins"
"chadtree"
"iconsPackage"
]
''
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
''
)
];
options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // { options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "chadtree"; enable = mkEnableOption "chadtree";
@ -21,11 +36,6 @@ in
]; ];
}; };
iconsPackage = lib.mkPackageOption pkgs [
"vimPlugins"
"nvim-web-devicons"
] { nullable = true; };
options = { options = {
follow = helpers.defaultNullOpts.mkBool true '' follow = helpers.defaultNullOpts.mkBool true ''
CHADTree will highlight currently open file, and open all its parents. CHADTree will highlight currently open file, and open all its parents.
@ -415,7 +425,7 @@ in
let let
setupOptions = with cfg; { setupOptions = with cfg; {
xdg = true; xdg = true;
options = with options; { options = with cfg.options; {
inherit follow; inherit follow;
inherit lang; inherit lang;
mimetypes = with mimetypes; { mimetypes = with mimetypes; {
@ -502,11 +512,33 @@ in
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = # TODO: added 2024-09-20 remove after 24.11
[ cfg.package ] plugins.web-devicons =
++ (optional ( lib.mkIf
cfg.iconsPackage != null && (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons") (
) cfg.iconsPackage); (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons")
&& !(
config.plugins.mini.enable
&& config.plugins.mini.modules ? icons
&& config.plugins.mini.mockDevIcons
)
)
{
enable = lib.mkOverride 1490 false;
};
warnings =
optional
(
(cfg.theme == null || cfg.theme.iconGlyphSet == "devicons")
&& options.plugins.web-devicons.enable.highestPrio == 1490
)
''
Nixvim (plugins.chadtree) `web-devicons` automatic installation is deprecated.
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
'';
extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions}) vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})

View file

@ -4,139 +4,142 @@
}; };
example = { example = {
plugins.chadtree = { plugins = {
enable = true; web-devicons.enable = true;
chadtree = {
enable = true;
options = { options = {
follow = true; follow = true;
mimetypes = { mimetypes = {
warn = [ warn = [
"audio" "audio"
"font" "font"
"image" "image"
"video" "video"
];
allowExts = [ ".ts" ];
};
pageIncrement = 5;
pollingRate = 2.0;
session = true;
showHidden = false;
versionControl = true;
ignore = {
nameExact = [
".DS_Store"
".directory"
"thumbs.db"
".git"
];
nameGlob = [ ];
pathGlob = [ ];
};
};
view = {
openDirection = "left";
sortBy = [
"is_folder"
"ext"
"file_name"
]; ];
allowExts = [ ".ts" ]; width = 40;
windowOptions = {
cursorline = true;
number = false;
relativenumber = false;
signcolumn = "no";
winfixwidth = true;
wrap = false;
};
}; };
pageIncrement = 5; theme = {
pollingRate = 2.0; highlights = {
session = true; ignored = "Comment";
showHidden = false; bookmarks = "Title";
versionControl = true; quickfix = "Label";
ignore = { versionControl = "Comment";
nameExact = [ };
".DS_Store" iconGlyphSet = "devicons";
".directory" textColourSet = "env";
"thumbs.db" iconColourSet = "github";
".git"
];
nameGlob = [ ];
pathGlob = [ ];
}; };
}; keymap = {
view = { windowManagement = {
openDirection = "left"; quit = [ "q" ];
sortBy = [ bigger = [
"is_folder" "+"
"ext" "="
"file_name" ];
]; smaller = [
width = 40; "-"
windowOptions = { "_"
cursorline = true; ];
number = false; refresh = [ "<c-r>" ];
relativenumber = false; };
signcolumn = "no"; rerooting = {
winfixwidth = true; changeDir = [ "b" ];
wrap = false; changeFocus = [ "c" ];
}; changeFocusUp = [ "C" ];
}; };
theme = { openFileFolder = {
highlights = { primary = [ "<enter>" ];
ignored = "Comment"; secondary = [
bookmarks = "Title"; "<tab>"
quickfix = "Label"; "<2-leftmouse>"
versionControl = "Comment"; ];
}; tertiary = [
iconGlyphSet = "devicons"; "<m-enter>"
textColourSet = "env"; "<middlemouse>"
iconColourSet = "github"; ];
}; vSplit = [ "w" ];
keymap = { hSplit = [ "W" ];
windowManagement = { openSys = [ "o" ];
quit = [ "q" ]; collapse = [ "o" ];
bigger = [ };
"+" cursor = {
"=" refocus = [ "~" ];
]; jumpToCurrent = [ "J" ];
smaller = [ stat = [ "K" ];
"-" copyName = [ "y" ];
"_" copyBasename = [ "Y" ];
]; copyRelname = [ "<c-y>" ];
refresh = [ "<c-r>" ]; };
}; filtering = {
rerooting = { filter = [ "f" ];
changeDir = [ "b" ]; clearFilter = [ "F" ];
changeFocus = [ "c" ]; };
changeFocusUp = [ "C" ]; bookmarks = {
}; bookmarkGoto = [ "m" ];
openFileFolder = { };
primary = [ "<enter>" ]; selecting = {
secondary = [ select = [ "s" ];
"<tab>" clearSelection = [ "S" ];
"<2-leftmouse>" };
]; fileOperations = {
tertiary = [ new = [ "a" ];
"<m-enter>" link = [ "A" ];
"<middlemouse>" rename = [ "r" ];
]; toggleExec = [ "X" ];
vSplit = [ "w" ]; copy = [ "p" ];
hSplit = [ "W" ]; cut = [ "x" ];
openSys = [ "o" ]; delete = [ "d" ];
collapse = [ "o" ]; trash = [ "t" ];
}; };
cursor = { toggles = {
refocus = [ "~" ]; toggleHidden = [ "." ];
jumpToCurrent = [ "J" ]; toggleFollow = [ "u" ];
stat = [ "K" ]; toggleVersionControl = [ "i" ];
copyName = [ "y" ]; };
copyBasename = [ "Y" ];
copyRelname = [ "<c-y>" ];
};
filtering = {
filter = [ "f" ];
clearFilter = [ "F" ];
};
bookmarks = {
bookmarkGoto = [ "m" ];
};
selecting = {
select = [ "s" ];
clearSelection = [ "S" ];
};
fileOperations = {
new = [ "a" ];
link = [ "A" ];
rename = [ "r" ];
toggleExec = [ "X" ];
copy = [ "p" ];
cut = [ "x" ];
delete = [ "d" ];
trash = [ "t" ];
};
toggles = {
toggleHidden = [ "." ];
toggleFollow = [ "u" ];
toggleVersionControl = [ "i" ];
}; };
}; };
}; };
}; };
no-packages = { no-icons = {
plugins.web-devicons.enable = false;
plugins.chadtree = { plugins.chadtree = {
enable = true; enable = true;
iconsPackage = null;
}; };
}; };
} }