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

@ -6,117 +6,219 @@
...
}:
with lib;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "oil";
originalName = "oil.nvim";
defaultPackage = pkgs.vimPlugins.oil-nvim;
helpers.neovim-plugin.mkNeovimPlugin config {
name = "oil";
originalName = "oil.nvim";
defaultPackage = pkgs.vimPlugins.oil-nvim;
maintainers = [maintainers.GaetanLepage];
maintainers = [ maintainers.GaetanLepage ];
# TODO introduced 2024-03-18: remove 2024-05-18
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"defaultFileExplorer"
["bufOptions" "buflisted"]
["bufOptions" "bufhidden"]
["winOptions" "wrap"]
["winOptions" "signcolumn"]
["winOptions" "cursorcolumn"]
["winOptions" "foldcolumn"]
["winOptions" "spell"]
["winOptions" "list"]
["winOptions" "conceallevel"]
["winOptions" "concealcursor"]
"deleteToTrash"
"skipConfirmForSimpleEdits"
"promptSaveOnSelectNewEntry"
"cleanupDelayMs"
"keymaps"
"useDefaultKeymaps"
["viewOptions" "showHidden"]
["viewOptions" "isHiddenFile"]
["viewOptions" "isAlwaysHidden"]
["float" "padding"]
["float" "maxWidth"]
["float" "maxHeight"]
["float" "border"]
["float" "winOptions" "winblend"]
["preview" "maxWidth"]
["preview" "minWidth"]
["preview" "width"]
["preview" "maxHeight"]
["preview" "minHeight"]
["preview" "height"]
["preview" "border"]
["preview" "winOptions" "winblend"]
["progress" "maxWidth"]
["progress" "minWidth"]
["progress" "width"]
["progress" "maxHeight"]
["progress" "minHeight"]
["progress" "height"]
["progress" "border"]
["progress" "winOptions" "winblend"]
["progress" "minimizedBorder"]
];
imports = let
basePluginPath = ["plugins" "oil"];
settingsPath = basePluginPath ++ ["settings"];
in [
(
mkRemovedOptionModule
(basePluginPath ++ ["columns"])
"Use `plugins.oil.settings.columns` instead but beware, the format has changed."
)
(
mkRenamedOptionModule
(basePluginPath ++ ["lspRenameAutosave"])
(settingsPath ++ ["lsp_file_method" "autosave_changes"])
)
(
mkRemovedOptionModule
(basePluginPath ++ ["trashCommand"])
"This option has been deprecated by upstream."
)
(
mkRemovedOptionModule
(basePluginPath ++ ["restoreWinOptions"])
"This option has been deprecated by upstream."
)
# TODO introduced 2024-03-18: remove 2024-05-18
deprecateExtraOptions = true;
optionsRenamedToSettings = [
"defaultFileExplorer"
[
"bufOptions"
"buflisted"
]
[
"bufOptions"
"bufhidden"
]
[
"winOptions"
"wrap"
]
[
"winOptions"
"signcolumn"
]
[
"winOptions"
"cursorcolumn"
]
[
"winOptions"
"foldcolumn"
]
[
"winOptions"
"spell"
]
[
"winOptions"
"list"
]
[
"winOptions"
"conceallevel"
]
[
"winOptions"
"concealcursor"
]
"deleteToTrash"
"skipConfirmForSimpleEdits"
"promptSaveOnSelectNewEntry"
"cleanupDelayMs"
"keymaps"
"useDefaultKeymaps"
[
"viewOptions"
"showHidden"
]
[
"viewOptions"
"isHiddenFile"
]
[
"viewOptions"
"isAlwaysHidden"
]
[
"float"
"padding"
]
[
"float"
"maxWidth"
]
[
"float"
"maxHeight"
]
[
"float"
"border"
]
[
"float"
"winOptions"
"winblend"
]
[
"preview"
"maxWidth"
]
[
"preview"
"minWidth"
]
[
"preview"
"width"
]
[
"preview"
"maxHeight"
]
[
"preview"
"minHeight"
]
[
"preview"
"height"
]
[
"preview"
"border"
]
[
"preview"
"winOptions"
"winblend"
]
[
"progress"
"maxWidth"
]
[
"progress"
"minWidth"
]
[
"progress"
"width"
]
[
"progress"
"maxHeight"
]
[
"progress"
"minHeight"
]
[
"progress"
"height"
]
[
"progress"
"border"
]
[
"progress"
"winOptions"
"winblend"
]
[
"progress"
"minimizedBorder"
]
];
imports =
let
basePluginPath = [
"plugins"
"oil"
];
settingsPath = basePluginPath ++ [ "settings" ];
in
[
(mkRemovedOptionModule (
basePluginPath ++ [ "columns" ]
) "Use `plugins.oil.settings.columns` instead but beware, the format has changed.")
(mkRenamedOptionModule (basePluginPath ++ [ "lspRenameAutosave" ]) (
settingsPath
++ [
"lsp_file_method"
"autosave_changes"
]
))
(mkRemovedOptionModule (
basePluginPath ++ [ "trashCommand" ]
) "This option has been deprecated by upstream.")
(mkRemovedOptionModule (
basePluginPath ++ [ "restoreWinOptions" ]
) "This option has been deprecated by upstream.")
];
settingsOptions = let
dimensionType = with types;
settingsOptions =
let
dimensionType =
with types;
oneOf [
ints.unsigned
(numbers.between 0.0 1.0)
(
listOf
(
either
ints.unsigned
(numbers.between 0.0 1.0)
)
)
(listOf (either ints.unsigned (numbers.between 0.0 1.0)))
];
in {
in
{
default_file_explorer = helpers.defaultNullOpts.mkBool true ''
Oil will take over directory buffers (e.g. `vim .` or `:e src/`).
Set to false if you still want to use netrw.
'';
columns = mkOption {
type = with helpers.nixvimTypes;
listOf
(
oneOf
[
str
(attrsOf anything)
rawLua
]
);
default = [];
type =
with helpers.nixvimTypes;
listOf (oneOf [
str
(attrsOf anything)
rawLua
]);
default = [ ];
description = ''
Columns can be specified as a string to use default arguments (e.g. `"icon"`),
or as a table to pass parameters (e.g. `{"size", highlight = "Special"}`)
@ -175,20 +277,13 @@ with lib;
'';
cleanup_delay_ms =
helpers.defaultNullOpts.mkNullable
(
with types;
either
types.ints.unsigned
(enum [false])
)
"2000"
''
Oil will automatically delete hidden buffers after this delay.
You can set the delay to false to disable cleanup entirely.
Note that the cleanup process only starts when none of the oil buffers are currently
displayed.
'';
helpers.defaultNullOpts.mkNullable (with types; either types.ints.unsigned (enum [ false ])) "2000"
''
Oil will automatically delete hidden buffers after this delay.
You can set the delay to false to disable cleanup entirely.
Note that the cleanup process only starts when none of the oil buffers are currently
displayed.
'';
lsp_file_method = {
timeout_ms = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
@ -202,18 +297,11 @@ with lib;
};
constrain_cursor =
helpers.defaultNullOpts.mkNullable
(
with types;
either
str
(enum [false])
)
"editable"
''
Constrain the cursor to the editable parts of the oil buffer.
Set to `false` to disable, or "name" to keep it on the file names.
'';
helpers.defaultNullOpts.mkNullable (with types; either str (enum [ false ])) "editable"
''
Constrain the cursor to the editable parts of the oil buffer.
Set to `false` to disable, or "name" to keep it on the file names.
'';
experimental_watch_for_changes = helpers.defaultNullOpts.mkBool false ''
Set to true to watch the filesystem for changes and reload oil.
@ -221,44 +309,43 @@ with lib;
keymaps =
helpers.defaultNullOpts.mkAttrsOf
(
with types;
oneOf
[
(
with types;
oneOf [
str
(attrsOf anything)
(enum [false])
(enum [ false ])
]
)
''
{
"g?" = "actions.show_help";
"<CR>" = "actions.select";
"<C-s>" = "actions.select_vsplit";
"<C-h>" = "actions.select_split";
"<C-t>" = "actions.select_tab";
"<C-p>" = "actions.preview";
"<C-c>" = "actions.close";
"<C-l>" = "actions.refresh";
"-" = "actions.parent";
"_" = "actions.open_cwd";
"`" = "actions.cd";
"~" = "actions.tcd";
"gs" = "actions.change_sort";
"gx" = "actions.open_external";
"g." = "actions.toggle_hidden";
"g\\" = "actions.toggle_trash";
}
''
''
Keymaps in oil buffer.
Can be any value that `vim.keymap.set` accepts OR a table of keymap options with a
`callback` (e.g. `{ callback = function() ... end, desc = "", mode = "n" }`).
Additionally, if it is a string that matches "actions.<name>", it will use the mapping at
`require("oil.actions").<name>`.
Set to `false` to remove a keymap.
See `:help oil-actions` for a list of all available actions.
'';
)
''
{
"g?" = "actions.show_help";
"<CR>" = "actions.select";
"<C-s>" = "actions.select_vsplit";
"<C-h>" = "actions.select_split";
"<C-t>" = "actions.select_tab";
"<C-p>" = "actions.preview";
"<C-c>" = "actions.close";
"<C-l>" = "actions.refresh";
"-" = "actions.parent";
"_" = "actions.open_cwd";
"`" = "actions.cd";
"~" = "actions.tcd";
"gs" = "actions.change_sort";
"gx" = "actions.open_external";
"g." = "actions.toggle_hidden";
"g\\" = "actions.toggle_trash";
}
''
''
Keymaps in oil buffer.
Can be any value that `vim.keymap.set` accepts OR a table of keymap options with a
`callback` (e.g. `{ callback = function() ... end, desc = "", mode = "n" }`).
Additionally, if it is a string that matches "actions.<name>", it will use the mapping at
`require("oil.actions").<name>`.
Set to `false` to remove a keymap.
See `:help oil-actions` for a list of all available actions.
'';
keymaps_help = helpers.defaultNullOpts.mkAttrsOf types.anything ''{border = "rounded";}'' ''
Configuration for the floating keymaps help window.
@ -273,23 +360,17 @@ with lib;
Show files and directories that start with "."
'';
is_hidden_file =
helpers.defaultNullOpts.mkLuaFn
''
function(name, bufnr)
return vim.startswith(name, ".")
end
''
"This function defines what is considered a 'hidden' file.";
is_hidden_file = helpers.defaultNullOpts.mkLuaFn ''
function(name, bufnr)
return vim.startswith(name, ".")
end
'' "This function defines what is considered a 'hidden' file.";
is_always_hidden =
helpers.defaultNullOpts.mkLuaFn
''
function(name, bufnr)
return false
end
''
"This function defines what will never be shown, even when `show_hidden` is set.";
is_always_hidden = helpers.defaultNullOpts.mkLuaFn ''
function(name, bufnr)
return false
end
'' "This function defines what will never be shown, even when `show_hidden` is set.";
natural_order = helpers.defaultNullOpts.mkBool true ''
Sort file names in a more intuitive order for humans.
@ -298,16 +379,16 @@ with lib;
sort =
helpers.defaultNullOpts.mkListOf (with types; listOf str)
''
[
["type" "asc"]
["name" "asc"]
]
''
''
Sort order can be "asc" or "desc".
See `:help oil-columns` to see which columns are sortable.
'';
''
[
["type" "asc"]
["name" "asc"]
]
''
''
Sort order can be "asc" or "desc".
See `:help oil-columns` to see which columns are sortable.
'';
};
float = {
@ -325,15 +406,15 @@ with lib;
override =
helpers.defaultNullOpts.mkLuaFn
''
function(conf)
return conf
end
''
''
This is the config that will be passed to `nvim_open_win`.
Change values here to customize the layout.
'';
''
function(conf)
return conf
end
''
''
This is the config that will be passed to `nvim_open_win`.
Change values here to customize the layout.
'';
};
preview = {
@ -349,15 +430,9 @@ with lib;
`min_width = [40 0.4]` means "the greater of 40 columns or 40% of total".
'';
width =
helpers.mkNullOrOption
(
with types;
either
int
(numbers.between 0.0 1.0)
)
"Optionally define an integer/float for the exact width of the preview window.";
width = helpers.mkNullOrOption (
with types; either int (numbers.between 0.0 1.0)
) "Optionally define an integer/float for the exact width of the preview window.";
max_height = helpers.defaultNullOpts.mkNullable dimensionType "0.9" ''
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
@ -371,15 +446,9 @@ with lib;
`min_height = [5 0.1]` means "the greater of 5 columns or 10% of total".
'';
height =
helpers.mkNullOrOption
(
with types;
either
int
(numbers.between 0.0 1.0)
)
"Optionally define an integer/float for the exact height of the preview window.";
height = helpers.mkNullOrOption (
with types; either int (numbers.between 0.0 1.0)
) "Optionally define an integer/float for the exact height of the preview window.";
border = helpers.defaultNullOpts.mkStr "rounded" "";
@ -405,15 +474,9 @@ with lib;
`min_width = [40 0.4]` means "the greater of 40 columns or 40% of total".
'';
width =
helpers.mkNullOrOption
(
with types;
either
int
(numbers.between 0.0 1.0)
)
"Optionally define an integer/float for the exact width of the preview window.";
width = helpers.mkNullOrOption (
with types; either int (numbers.between 0.0 1.0)
) "Optionally define an integer/float for the exact width of the preview window.";
max_height = helpers.defaultNullOpts.mkNullable dimensionType "0.9" ''
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
@ -427,15 +490,9 @@ with lib;
`min_height = [5 0.1]` means "the greater of 5 columns or 10% of total".
'';
height =
helpers.mkNullOrOption
(
with types;
either
int
(numbers.between 0.0 1.0)
)
"Optionally define an integer/float for the exact height of the preview window.";
height = helpers.mkNullOrOption (
with types; either int (numbers.between 0.0 1.0)
) "Optionally define an integer/float for the exact height of the preview window.";
border = helpers.defaultNullOpts.mkStr "rounded" "";
@ -453,26 +510,26 @@ with lib;
};
};
settingsExample = {
columns = ["icon"];
view_options.show_hidden = false;
win_options = {
wrap = false;
signcolumn = "no";
cursorcolumn = false;
foldcolumn = "0";
spell = false;
list = false;
conceallevel = 3;
concealcursor = "ncv";
};
keymaps = {
"<C-c>" = false;
"<leader>qq" = "actions.close";
"<C-l>" = false;
"<C-r>" = "actions.refresh";
"y." = "actions.copy_entry_path";
};
skip_confirm_for_simple_edits = true;
settingsExample = {
columns = [ "icon" ];
view_options.show_hidden = false;
win_options = {
wrap = false;
signcolumn = "no";
cursorcolumn = false;
foldcolumn = "0";
spell = false;
list = false;
conceallevel = 3;
concealcursor = "ncv";
};
}
keymaps = {
"<C-c>" = false;
"<leader>qq" = "actions.close";
"<C-l>" = false;
"<C-r>" = "actions.refresh";
"y." = "actions.copy_entry_path";
};
skip_confirm_for_simple_edits = true;
};
}