From 23a903f13c42f897063addc1958160a366295b16 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 20 Sep 2024 09:47:05 -0500 Subject: [PATCH] plugins/chadtree: iconsPackage -> icons provider options --- plugins/by-name/chadtree/default.nix | 54 +++- .../plugins/by-name/chadtree/default.nix | 247 +++++++++--------- 2 files changed, 168 insertions(+), 133 deletions(-) diff --git a/plugins/by-name/chadtree/default.nix b/plugins/by-name/chadtree/default.nix index a975c825..d28134d8 100644 --- a/plugins/by-name/chadtree/default.nix +++ b/plugins/by-name/chadtree/default.nix @@ -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}) diff --git a/tests/test-sources/plugins/by-name/chadtree/default.nix b/tests/test-sources/plugins/by-name/chadtree/default.nix index e0155f10..53bb902d 100644 --- a/tests/test-sources/plugins/by-name/chadtree/default.nix +++ b/tests/test-sources/plugins/by-name/chadtree/default.nix @@ -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 = [ "" ]; - }; - rerooting = { - changeDir = [ "b" ]; - changeFocus = [ "c" ]; - changeFocusUp = [ "C" ]; - }; - openFileFolder = { - primary = [ "" ]; - secondary = [ - "" - "<2-leftmouse>" - ]; - tertiary = [ - "" - "" - ]; - vSplit = [ "w" ]; - hSplit = [ "W" ]; - openSys = [ "o" ]; - collapse = [ "o" ]; - }; - cursor = { - refocus = [ "~" ]; - jumpToCurrent = [ "J" ]; - stat = [ "K" ]; - copyName = [ "y" ]; - copyBasename = [ "Y" ]; - copyRelname = [ "" ]; - }; - 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 = [ "" ]; + }; + rerooting = { + changeDir = [ "b" ]; + changeFocus = [ "c" ]; + changeFocusUp = [ "C" ]; + }; + openFileFolder = { + primary = [ "" ]; + secondary = [ + "" + "<2-leftmouse>" + ]; + tertiary = [ + "" + "" + ]; + vSplit = [ "w" ]; + hSplit = [ "W" ]; + openSys = [ "o" ]; + collapse = [ "o" ]; + }; + cursor = { + refocus = [ "~" ]; + jumpToCurrent = [ "J" ]; + stat = [ "K" ]; + copyName = [ "y" ]; + copyBasename = [ "Y" ]; + copyRelname = [ "" ]; + }; + 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; }; }; }