treewide: Reformat with nixfmt

This commit is contained in:
traxys 2024-05-05 19:39:35 +02:00
parent c6281260dc
commit 62f32bfc71
459 changed files with 28139 additions and 26377 deletions

View file

@ -5,92 +5,100 @@
pkgs,
...
}:
with lib; let
with lib;
let
cfg = config.plugins.chadtree;
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
in {
options.plugins.chadtree =
helpers.neovim-plugin.extraOptionsOptions
// {
enable = mkEnableOption "chadtree";
in
{
options.plugins.chadtree = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "chadtree";
package = helpers.mkPackageOption "chadtree" pkgs.vimPlugins.chadtree;
package = helpers.mkPackageOption "chadtree" pkgs.vimPlugins.chadtree;
options = {
follow = helpers.defaultNullOpts.mkBool true ''
CHADTree will highlight currently open file, and open all its parents.
options = {
follow = helpers.defaultNullOpts.mkBool true ''
CHADTree will highlight currently open file, and open all its parents.
'';
lang = helpers.mkNullOrOption types.str ''
CHADTree will guess your locale from unix environmental variables.
Set to `c` to disable emojis.
'';
mimetypes = {
warn = mkListStr ''["audio" "font" "image" "video"]'' ''
Show a warning before opening these datatypes.
'';
lang = helpers.mkNullOrOption types.str ''
CHADTree will guess your locale from unix environmental variables.
Set to `c` to disable emojis.
allowExts = mkListStr ''[".ts"]'' ''
Skip warning for these extensions.
'';
mimetypes = {
warn = mkListStr ''["audio" "font" "image" "video"]'' ''
Show a warning before opening these datatypes.
'';
allowExts = mkListStr ''[".ts"]'' ''
Skip warning for these extensions.
'';
};
pageIncrement = helpers.defaultNullOpts.mkInt 5 ''
Change how many lines `{` and `}` scroll.
'';
pollingRate = helpers.defaultNullOpts.mkNum 2.0 ''
CHADTree's background refresh rate.
'';
session = helpers.defaultNullOpts.mkBool true ''
Save & restore currently open folders.
'';
showHidden = helpers.defaultNullOpts.mkBool false ''
Hide some files and folders by default. By default this can be toggled using the `.` key.
see `chadtree_settings.ignore` for more details.
'';
versionControl = helpers.defaultNullOpts.mkBool true ''
Enable version control. This can also be toggled. But unlike `show_hidden`, does not have a default keybind.
'';
ignore = {
nameExact = mkListStr ''[".DS_Store" ".directory" "thumbs.db" ".git"]'' ''
Files whose name match these exactly will be ignored.
'';
nameGlob = mkListStr "[]" ''
Files whose name match these glob patterns will be ignored.
ie. `*.py` will match all python files
'';
pathGlob = mkListStr "[]" ''
Files whose full path match these glob patterns will be ignored.
'';
};
};
view = {
openDirection = helpers.defaultNullOpts.mkEnum ["left" "right"] "left" ''
Which way does CHADTree open?
pageIncrement = helpers.defaultNullOpts.mkInt 5 ''
Change how many lines `{` and `}` scroll.
'';
pollingRate = helpers.defaultNullOpts.mkNum 2.0 ''
CHADTree's background refresh rate.
'';
session = helpers.defaultNullOpts.mkBool true ''
Save & restore currently open folders.
'';
showHidden = helpers.defaultNullOpts.mkBool false ''
Hide some files and folders by default. By default this can be toggled using the `.` key.
see `chadtree_settings.ignore` for more details.
'';
versionControl = helpers.defaultNullOpts.mkBool true ''
Enable version control. This can also be toggled. But unlike `show_hidden`, does not have a default keybind.
'';
ignore = {
nameExact = mkListStr ''[".DS_Store" ".directory" "thumbs.db" ".git"]'' ''
Files whose name match these exactly will be ignored.
'';
sortBy = mkListStr ''["is_folder" "ext" "file_name"]'' ''
CHADTree can sort by the following criterion.
Reorder them if you want a different sorting order.
legal keys: some of
`["is_folder" "ext" "file_name"]`
nameGlob = mkListStr "[]" ''
Files whose name match these glob patterns will be ignored.
ie. `*.py` will match all python files
'';
width = helpers.defaultNullOpts.mkInt 40 ''
How big is CHADTree when initially opened?
pathGlob = mkListStr "[]" ''
Files whose full path match these glob patterns will be ignored.
'';
};
};
windowOptions =
helpers.defaultNullOpts.mkAttributeSet ''
view = {
openDirection =
helpers.defaultNullOpts.mkEnum
[
"left"
"right"
]
"left"
''
Which way does CHADTree open?
'';
sortBy = mkListStr ''["is_folder" "ext" "file_name"]'' ''
CHADTree can sort by the following criterion.
Reorder them if you want a different sorting order.
legal keys: some of
`["is_folder" "ext" "file_name"]`
'';
width = helpers.defaultNullOpts.mkInt 40 ''
How big is CHADTree when initially opened?
'';
windowOptions =
helpers.defaultNullOpts.mkAttributeSet
''
{
cursorline = true;
number = false;
@ -103,34 +111,44 @@ in {
''
Set of window local options to for CHADTree windows.
'';
};
};
theme = {
highlights = {
ignored = helpers.defaultNullOpts.mkStr "Comment" ''
These are used for files that are ignored by user supplied pattern
in `chadtree.ignore` and by version control.
'';
bookmarks = helpers.defaultNullOpts.mkStr "Title" ''
These are used to show bookmarks.
'';
quickfix = helpers.defaultNullOpts.mkStr "Label" ''
These are used to notify the number of times a file / folder appears in the `quickfix` list.
'';
versionControl = helpers.defaultNullOpts.mkStr "Comment" ''
These are used to put a version control status beside each file.
'';
};
iconGlyphSet = helpers.defaultNullOpts.mkEnum ["devicons" "emoji" "ascii" "ascii_hollow"] "devicons" ''
Icon glyph set to use.
theme = {
highlights = {
ignored = helpers.defaultNullOpts.mkStr "Comment" ''
These are used for files that are ignored by user supplied pattern
in `chadtree.ignore` and by version control.
'';
textColourSet =
helpers.defaultNullOpts.mkEnum [
bookmarks = helpers.defaultNullOpts.mkStr "Title" ''
These are used to show bookmarks.
'';
quickfix = helpers.defaultNullOpts.mkStr "Label" ''
These are used to notify the number of times a file / folder appears in the `quickfix` list.
'';
versionControl = helpers.defaultNullOpts.mkStr "Comment" ''
These are used to put a version control status beside each file.
'';
};
iconGlyphSet =
helpers.defaultNullOpts.mkEnum
[
"devicons"
"emoji"
"ascii"
"ascii_hollow"
]
"devicons"
''
Icon glyph set to use.
'';
textColourSet =
helpers.defaultNullOpts.mkEnum
[
"env"
"solarized_dark_256"
"solarized_dark"
@ -140,7 +158,9 @@ in {
"trapdoor"
"nerdtree_syntax_light"
"nerdtree_syntax_dark"
] "env" ''
]
"env"
''
On `unix`, the command `ls` can produce coloured results based on the `LS_COLORS` environmental variable.
CHADTree can pretend it's `ls` by setting `chadtree.theme.textColourSet` to `env`.
@ -148,282 +168,294 @@ in {
If you are not happy with that, you can choose one of the many others.
'';
iconColourSet = helpers.defaultNullOpts.mkEnum ["github" "none"] "github" ''
Right now you all the file icons are coloured according to Github colours.
iconColourSet =
helpers.defaultNullOpts.mkEnum
[
"github"
"none"
]
"github"
''
Right now you all the file icons are coloured according to Github colours.
You may also disable colouring if you wish.
You may also disable colouring if you wish.
'';
};
keymap = {
windowManagement = {
quit = mkListStr ''["q"]'' ''
Close CHADTree window, quit if it is the last window.
'';
bigger = mkListStr ''["+" "="]'' ''
Resize CHADTree window bigger.
'';
smaller = mkListStr ''["-" "_"]'' ''
Resize CHADTree window smaller.
'';
refresh = mkListStr ''["<c-r>"]'' ''
Refresh CHADTree.
'';
};
keymap = {
windowManagement = {
quit = mkListStr ''["q"]'' ''
Close CHADTree window, quit if it is the last window.
'';
rerooting = {
changeDir = mkListStr ''["b"]'' ''
Change vim's working directory.
'';
bigger = mkListStr ''["+" "="]'' ''
Resize CHADTree window bigger.
'';
changeFocus = mkListStr ''["c"]'' ''
Set CHADTree's root to folder at cursor. Does not change working directory.
'';
smaller = mkListStr ''["-" "_"]'' ''
Resize CHADTree window smaller.
'';
changeFocusUp = mkListStr ''["C"]'' ''
Set CHADTree's root one level up.
'';
};
refresh = mkListStr ''["<c-r>"]'' ''
Refresh CHADTree.
'';
};
openFileFolder = {
primary = mkListStr ''["<enter>"]'' ''
Open file at cursor.
'';
rerooting = {
changeDir = mkListStr ''["b"]'' ''
Change vim's working directory.
'';
secondary = mkListStr ''["<tab> <2-leftmouse>"]'' ''
Open file at cursor, keep cursor in CHADTree's window.
'';
changeFocus = mkListStr ''["c"]'' ''
Set CHADTree's root to folder at cursor. Does not change working directory.
'';
tertiary = mkListStr ''["<m-enter>" <middlemouse>]'' ''
Open file at cursor in a new tab.
'';
changeFocusUp = mkListStr ''["C"]'' ''
Set CHADTree's root one level up.
'';
};
vSplit = mkListStr ''["w"]'' ''
Open file at cursor in vertical split.
'';
openFileFolder = {
primary = mkListStr ''["<enter>"]'' ''
Open file at cursor.
'';
hSplit = mkListStr ''["W"]'' ''
Open file at cursor in horizontal split.
'';
secondary = mkListStr ''["<tab> <2-leftmouse>"]'' ''
Open file at cursor, keep cursor in CHADTree's window.
'';
openSys = mkListStr ''["o"]'' ''
Open file with GUI tools using `open` or `xdg open`.
This will open third party tools such as Finder or KDE Dolphin or GNOME nautilus, etc.
Depends on platform and user setup.
'';
tertiary = mkListStr ''["<m-enter>" <middlemouse>]'' ''
Open file at cursor in a new tab.
'';
collapse = mkListStr ''["o"]'' ''
Collapse all subdirectories for directory at cursor.
'';
};
vSplit = mkListStr ''["w"]'' ''
Open file at cursor in vertical split.
'';
cursor = {
refocus = mkListStr ''["~"]'' ''
Put cursor at the root of CHADTree.
'';
hSplit = mkListStr ''["W"]'' ''
Open file at cursor in horizontal split.
'';
jumpToCurrent = mkListStr ''["J"]'' ''
Position cursor in CHADTree at currently open buffer, if the buffer points to a location visible under CHADTree.
'';
openSys = mkListStr ''["o"]'' ''
Open file with GUI tools using `open` or `xdg open`.
This will open third party tools such as Finder or KDE Dolphin or GNOME nautilus, etc.
Depends on platform and user setup.
'';
stat = mkListStr ''["K"]'' ''
Print `ls --long` stat for file under cursor.
'';
collapse = mkListStr ''["o"]'' ''
Collapse all subdirectories for directory at cursor.
'';
};
copyName = mkListStr ''["y"]'' ''
Copy paths of files under cursor or visual block.
'';
cursor = {
refocus = mkListStr ''["~"]'' ''
Put cursor at the root of CHADTree.
'';
copyBasename = mkListStr ''["Y"]'' ''
Copy names of files under cursor or visual block.
'';
jumpToCurrent = mkListStr ''["J"]'' ''
Position cursor in CHADTree at currently open buffer, if the buffer points to a location visible under CHADTree.
'';
copyRelname = mkListStr ''["<c-y>"]'' ''
Copy relative paths of files under cursor or visual block.
'';
};
stat = mkListStr ''["K"]'' ''
Print `ls --long` stat for file under cursor.
'';
filtering = {
filter = mkListStr ''["f"]'' ''
Set a glob pattern to narrow down visible files.
'';
copyName = mkListStr ''["y"]'' ''
Copy paths of files under cursor or visual block.
'';
clearFilter = mkListStr ''["F"]'' ''
Clear filter.
'';
};
copyBasename = mkListStr ''["Y"]'' ''
Copy names of files under cursor or visual block.
'';
bookmarks = {
bookmarkGoto = mkListStr ''["m"]'' ''
Goto bookmark `A-Z`.
'';
};
copyRelname = mkListStr ''["<c-y>"]'' ''
Copy relative paths of files under cursor or visual block.
'';
};
selecting = {
select = mkListStr ''["s"]'' ''
Select files under cursor or visual block.
'';
filtering = {
filter = mkListStr ''["f"]'' ''
Set a glob pattern to narrow down visible files.
'';
clearSelection = mkListStr ''["S"]'' ''
Clear selection.
'';
};
clearFilter = mkListStr ''["F"]'' ''
Clear filter.
'';
};
fileOperations = {
new = mkListStr ''["a"]'' ''
Create new file at location under cursor. Files ending with platform specific path separator will be folders.
bookmarks = {
bookmarkGoto = mkListStr ''["m"]'' ''
Goto bookmark `A-Z`.
'';
};
Intermediary folders are created automatically.
selecting = {
select = mkListStr ''["s"]'' ''
Select files under cursor or visual block.
'';
ie. `uwu/owo/` under unix will create `uwu/` then `owo/` under it. Both are folders.
'';
clearSelection = mkListStr ''["S"]'' ''
Clear selection.
'';
};
link = mkListStr ''["A"]'' ''
Create links at location under cursor from selection.
fileOperations = {
new = mkListStr ''["a"]'' ''
Create new file at location under cursor. Files ending with platform specific path separator will be folders.
Links are always relative.
Intermediary folders are created automatically.
Intermediary folders are created automatically.
'';
ie. `uwu/owo/` under unix will create `uwu/` then `owo/` under it. Both are folders.
'';
rename = mkListStr ''["r"]'' ''
Rename file under cursor.
'';
link = mkListStr ''["A"]'' ''
Create links at location under cursor from selection.
toggleExec = mkListStr ''["X"]'' ''
Toggle all the `+x` bits of the selected / highlighted files.
Links are always relative.
Except for directories, where `-x` will prevent reading.
'';
Intermediary folders are created automatically.
'';
copy = mkListStr ''["p"]'' ''
Copy the selected files to location under cursor.
'';
rename = mkListStr ''["r"]'' ''
Rename file under cursor.
'';
cut = mkListStr ''["x"]'' ''
Move the selected files to location under cursor.
'';
toggleExec = mkListStr ''["X"]'' ''
Toggle all the `+x` bits of the selected / highlighted files.
delete = mkListStr ''["d"]'' ''
Delete the selected files. Items deleted cannot be recovered.
'';
Except for directories, where `-x` will prevent reading.
'';
trash = mkListStr ''[t]'' ''
Trash the selected files using platform specific `trash` command, if they are available.
Items trashed may be recovered.
'';
};
copy = mkListStr ''["p"]'' ''
Copy the selected files to location under cursor.
'';
toggles = {
toggleHidden = mkListStr ''["."]'' ''
Toggle show_hidden on and off. See `chadtree.showHidden` for details.
'';
cut = mkListStr ''["x"]'' ''
Move the selected files to location under cursor.
'';
toggleFollow = mkListStr ''["u"]'' ''
Toggle `follow` on and off. See `chadtree.follow` for details.
'';
delete = mkListStr ''["d"]'' ''
Delete the selected files. Items deleted cannot be recovered.
'';
trash = mkListStr ''[t]'' ''
Trash the selected files using platform specific `trash` command, if they are available.
Items trashed may be recovered.
'';
};
toggles = {
toggleHidden = mkListStr ''["."]'' ''
Toggle show_hidden on and off. See `chadtree.showHidden` for details.
'';
toggleFollow = mkListStr ''["u"]'' ''
Toggle `follow` on and off. See `chadtree.follow` for details.
'';
toggleVersionControl = mkListStr ''["i"]'' ''
Toggle version control integration on and off.
'';
};
toggleVersionControl = mkListStr ''["i"]'' ''
Toggle version control integration on and off.
'';
};
};
};
config = let
setupOptions = with cfg; {
xdg = true;
options = with options; {
inherit follow;
inherit lang;
mimetypes = with mimetypes; {
inherit warn;
allow_exts = allowExts;
};
page_increment = pageIncrement;
polling_rate = pollingRate;
inherit session;
show_hidden = showHidden;
version_control = versionControl;
ignore = with ignore; {
name_exact = nameExact;
name_glob = nameGlob;
path_glob = pathGlob;
};
};
view = with view; {
open_direction = openDirection;
sort_by = sortBy;
inherit width;
window_options = windowOptions;
};
theme = with theme; {
highlights = with highlights; {
inherit ignored;
inherit bookmarks;
inherit quickfix;
config =
let
setupOptions = with cfg; {
xdg = true;
options = with options; {
inherit follow;
inherit lang;
mimetypes = with mimetypes; {
inherit warn;
allow_exts = allowExts;
};
page_increment = pageIncrement;
polling_rate = pollingRate;
inherit session;
show_hidden = showHidden;
version_control = versionControl;
ignore = with ignore; {
name_exact = nameExact;
name_glob = nameGlob;
path_glob = pathGlob;
};
};
icon_glyph_set = iconGlyphSet;
text_colour_set = textColourSet;
icon_colour_set = iconColourSet;
view = with view; {
open_direction = openDirection;
sort_by = sortBy;
inherit width;
window_options = windowOptions;
};
theme = with theme; {
highlights = with highlights; {
inherit ignored;
inherit bookmarks;
inherit quickfix;
version_control = versionControl;
};
icon_glyph_set = iconGlyphSet;
text_colour_set = textColourSet;
icon_colour_set = iconColourSet;
};
keymap =
with keymap;
with windowManagement;
with rerooting;
with openFileFolder;
with cursor;
with filtering;
with bookmarks;
with selecting;
with fileOperations;
with toggles;
{
inherit quit;
inherit bigger;
inherit smaller;
inherit refresh;
change_dir = changeDir;
change_focus = changeFocus;
change_focus_up = changeFocusUp;
inherit primary;
inherit secondary;
inherit tertiary;
v_split = vSplit;
h_split = hSplit;
open_sys = openSys;
inherit collapse;
inherit refocus;
jump_to_current = jumpToCurrent;
inherit stat;
copy_name = copyName;
copy_basename = copyBasename;
copy_relname = copyRelname;
inherit filter;
clear_filter = clearFilter;
bookmark_goto = bookmarkGoto;
inherit select;
clear_selection = clearSelection;
inherit new;
inherit link;
inherit rename;
toggle_exec = toggleExec;
inherit copy;
inherit cut;
inherit delete;
inherit trash;
toggle_hidden = toggleHidden;
toggle_follow = toggleFollow;
toggle_version_control = toggleVersionControl;
};
};
keymap = with keymap;
with windowManagement;
with rerooting;
with openFileFolder;
with cursor;
with filtering;
with bookmarks;
with selecting;
with fileOperations;
with toggles; {
inherit quit;
inherit bigger;
inherit smaller;
inherit refresh;
change_dir = changeDir;
change_focus = changeFocus;
change_focus_up = changeFocusUp;
inherit primary;
inherit secondary;
inherit tertiary;
v_split = vSplit;
h_split = hSplit;
open_sys = openSys;
inherit collapse;
inherit refocus;
jump_to_current = jumpToCurrent;
inherit stat;
copy_name = copyName;
copy_basename = copyBasename;
copy_relname = copyRelname;
inherit filter;
clear_filter = clearFilter;
bookmark_goto = bookmarkGoto;
inherit select;
clear_selection = clearSelection;
inherit new;
inherit link;
inherit rename;
toggle_exec = toggleExec;
inherit copy;
inherit cut;
inherit delete;
inherit trash;
toggle_hidden = toggleHidden;
toggle_follow = toggleFollow;
toggle_version_control = toggleVersionControl;
};
};
in
in
mkIf cfg.enable {
extraPlugins =
[cfg.package]
++ (optional (cfg.theme == null || cfg.theme.iconGlyphSet == "devicons") pkgs.vimPlugins.nvim-web-devicons);
[ cfg.package ]
++ (optional (
cfg.theme == null || cfg.theme.iconGlyphSet == "devicons"
) pkgs.vimPlugins.nvim-web-devicons);
extraConfigLua = ''
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff