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,
config,
pkgs,
options,
...
}:
with lib;
@ -11,6 +12,20 @@ let
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
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 // {
enable = mkEnableOption "chadtree";
@ -21,11 +36,6 @@ in
];
};
iconsPackage = lib.mkPackageOption pkgs [
"vimPlugins"
"nvim-web-devicons"
] { nullable = true; };
options = {
follow = helpers.defaultNullOpts.mkBool true ''
CHADTree will highlight currently open file, and open all its parents.
@ -415,7 +425,7 @@ in
let
setupOptions = with cfg; {
xdg = true;
options = with options; {
options = with cfg.options; {
inherit follow;
inherit lang;
mimetypes = with mimetypes; {
@ -502,11 +512,33 @@ in
};
in
mkIf cfg.enable {
extraPlugins =
[ cfg.package ]
++ (optional (
cfg.iconsPackage != null && (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons")
) cfg.iconsPackage);
# TODO: added 2024-09-20 remove after 24.11
plugins.web-devicons =
lib.mkIf
(
(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 = ''
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})

View file

@ -4,139 +4,142 @@
};
example = {
plugins.chadtree = {
enable = true;
plugins = {
web-devicons.enable = true;
chadtree = {
enable = true;
options = {
follow = true;
mimetypes = {
warn = [
"audio"
"font"
"image"
"video"
options = {
follow = true;
mimetypes = {
warn = [
"audio"
"font"
"image"
"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;
pollingRate = 2.0;
session = true;
showHidden = false;
versionControl = true;
ignore = {
nameExact = [
".DS_Store"
".directory"
"thumbs.db"
".git"
];
nameGlob = [ ];
pathGlob = [ ];
theme = {
highlights = {
ignored = "Comment";
bookmarks = "Title";
quickfix = "Label";
versionControl = "Comment";
};
iconGlyphSet = "devicons";
textColourSet = "env";
iconColourSet = "github";
};
};
view = {
openDirection = "left";
sortBy = [
"is_folder"
"ext"
"file_name"
];
width = 40;
windowOptions = {
cursorline = true;
number = false;
relativenumber = false;
signcolumn = "no";
winfixwidth = true;
wrap = false;
};
};
theme = {
highlights = {
ignored = "Comment";
bookmarks = "Title";
quickfix = "Label";
versionControl = "Comment";
};
iconGlyphSet = "devicons";
textColourSet = "env";
iconColourSet = "github";
};
keymap = {
windowManagement = {
quit = [ "q" ];
bigger = [
"+"
"="
];
smaller = [
"-"
"_"
];
refresh = [ "<c-r>" ];
};
rerooting = {
changeDir = [ "b" ];
changeFocus = [ "c" ];
changeFocusUp = [ "C" ];
};
openFileFolder = {
primary = [ "<enter>" ];
secondary = [
"<tab>"
"<2-leftmouse>"
];
tertiary = [
"<m-enter>"
"<middlemouse>"
];
vSplit = [ "w" ];
hSplit = [ "W" ];
openSys = [ "o" ];
collapse = [ "o" ];
};
cursor = {
refocus = [ "~" ];
jumpToCurrent = [ "J" ];
stat = [ "K" ];
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" ];
keymap = {
windowManagement = {
quit = [ "q" ];
bigger = [
"+"
"="
];
smaller = [
"-"
"_"
];
refresh = [ "<c-r>" ];
};
rerooting = {
changeDir = [ "b" ];
changeFocus = [ "c" ];
changeFocusUp = [ "C" ];
};
openFileFolder = {
primary = [ "<enter>" ];
secondary = [
"<tab>"
"<2-leftmouse>"
];
tertiary = [
"<m-enter>"
"<middlemouse>"
];
vSplit = [ "w" ];
hSplit = [ "W" ];
openSys = [ "o" ];
collapse = [ "o" ];
};
cursor = {
refocus = [ "~" ];
jumpToCurrent = [ "J" ];
stat = [ "K" ];
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 = {
enable = true;
iconsPackage = null;
};
};
}