mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
treewide: make lib calls explicit
This commit is contained in:
parent
a7531186a8
commit
974bfcc78e
56 changed files with 589 additions and 496 deletions
|
@ -3,14 +3,18 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkMerge nvim optionalString boolToString mkBinding;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.visuals;
|
||||
in {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.indentBlankline.enable {
|
||||
vim.startPlugins = ["indent-blankline"];
|
||||
vim.luaConfigRC.indent-blankline = nvim.dag.entryAnywhere ''
|
||||
vim.luaConfigRC.indent-blankline = entryAnywhere ''
|
||||
-- highlight error: https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
|
||||
-- vim.wo.colorcolumn = "99999"
|
||||
vim.opt.list = true
|
||||
|
@ -42,7 +46,7 @@ in {
|
|||
|
||||
(mkIf cfg.cursorline.enable {
|
||||
vim.startPlugins = ["nvim-cursorline"];
|
||||
vim.luaConfigRC.cursorline = nvim.dag.entryAnywhere ''
|
||||
vim.luaConfigRC.cursorline = entryAnywhere ''
|
||||
require('nvim-cursorline').setup {
|
||||
cursorline = {
|
||||
timeout = ${toString cfg.cursorline.lineTimeout},
|
||||
|
@ -58,7 +62,7 @@ in {
|
|||
|
||||
(mkIf cfg.scrollBar.enable {
|
||||
vim.startPlugins = ["scrollbar-nvim"];
|
||||
vim.luaConfigRC.scrollBar = nvim.dag.entryAnywhere ''
|
||||
vim.luaConfigRC.scrollBar = entryAnywhere ''
|
||||
require('scrollbar').setup{
|
||||
excluded_filetypes = {
|
||||
'prompt',
|
||||
|
@ -77,7 +81,7 @@ in {
|
|||
|
||||
(mkIf cfg.smoothScroll.enable {
|
||||
vim.startPlugins = ["cinnamon-nvim"];
|
||||
vim.luaConfigRC.smoothScroll = nvim.dag.entryAnywhere ''
|
||||
vim.luaConfigRC.smoothScroll = entryAnywhere ''
|
||||
require('cinnamon').setup()
|
||||
'';
|
||||
})
|
||||
|
@ -87,7 +91,7 @@ in {
|
|||
|
||||
vim.maps.normal = mkBinding cfg.cellularAutomaton.mappings.makeItRain "<cmd>CellularAutomaton make_it_rain<CR>" "Make it rain";
|
||||
|
||||
vim.luaConfigRC.cellularAUtomaton = nvim.dag.entryAnywhere ''
|
||||
vim.luaConfigRC.cellularAUtomaton = entryAnywhere ''
|
||||
local config = {
|
||||
fps = 50,
|
||||
name = 'slide',
|
||||
|
@ -115,7 +119,7 @@ in {
|
|||
|
||||
(mkIf cfg.highlight-undo.enable {
|
||||
vim.startPlugins = ["highlight-undo"];
|
||||
vim.luaConfigRC.highlight-undo = nvim.dag.entryAnywhere ''
|
||||
vim.luaConfigRC.highlight-undo = entryAnywhere ''
|
||||
require('highlight-undo').setup({
|
||||
duration = ${toString cfg.highlight-undo.duration},
|
||||
highlight_for_count = ${boolToString cfg.highlight-undo.highlightForCount},
|
||||
|
|
|
@ -3,14 +3,17 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.visuals.fidget-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["fidget-nvim"];
|
||||
|
||||
vim.luaConfigRC.fidget-nvim = nvim.dag.entryAnywhere ''
|
||||
require'fidget'.setup(${nvim.lua.toLuaObject cfg.setupOpts})
|
||||
vim.luaConfigRC.fidget-nvim = entryAnywhere ''
|
||||
require'fidget'.setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,13 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkRemovedOptionModule mkEnableOption mkOption mapAttrs toUpper nvim types mkRenamedOptionModule;
|
||||
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
inherit (lib.strings) toUpper;
|
||||
inherit (lib.types) int float bool str enum listOf attrsOf;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
|
||||
rawLua = lua: {__raw = lua;};
|
||||
in {
|
||||
imports = [
|
||||
|
@ -15,31 +21,31 @@ in {
|
|||
options.vim.visuals.fidget-nvim = {
|
||||
enable = mkEnableOption "nvim LSP UI element [fidget-nvim]";
|
||||
|
||||
setupOpts = nvim.types.mkPluginSetupOption "Fidget" {
|
||||
setupOpts = mkPluginSetupOption "Fidget" {
|
||||
progress = {
|
||||
poll_rate = mkOption {
|
||||
description = "How frequently to poll for LSP progress messages";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 0;
|
||||
};
|
||||
suppress_on_insert = mkOption {
|
||||
description = "Suppress new messages when in insert mode";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
ignore_done_already = mkOption {
|
||||
description = "Ignore new tasks that are already done";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
ignore_empty_message = mkOption {
|
||||
description = "Ignore new tasks with empty messages";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
clear_on_detach = mkOption {
|
||||
description = "Clear notification group when LSP server detaches";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
apply = clear:
|
||||
if clear
|
||||
|
@ -54,7 +60,7 @@ in {
|
|||
};
|
||||
notification_group = mkOption {
|
||||
description = "How to get a progress message's notification group key";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''
|
||||
function(msg)
|
||||
return msg.lsp_client.name
|
||||
|
@ -64,40 +70,40 @@ in {
|
|||
};
|
||||
ignore = mkOption {
|
||||
description = "Ignore LSP servers by name";
|
||||
type = types.listOf types.str;
|
||||
type = listOf str;
|
||||
default = [];
|
||||
};
|
||||
|
||||
display = {
|
||||
render_limit = mkOption {
|
||||
description = "Maximum number of messages to render";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 16;
|
||||
};
|
||||
done_ttl = mkOption {
|
||||
description = "How long a message should persist when complete";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 3;
|
||||
};
|
||||
done_icon = mkOption {
|
||||
description = "Icon shown when LSP progress tasks are completed";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "✓";
|
||||
};
|
||||
done_style = mkOption {
|
||||
description = "Highlight group for completed LSP tasks";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "Constant";
|
||||
};
|
||||
progress_ttl = mkOption {
|
||||
description = "How long a message should persist when in progress";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 99999;
|
||||
};
|
||||
progress_icon = {
|
||||
pattern = mkOption {
|
||||
description = "Pattern shown when LSP progress tasks are in progress";
|
||||
type = types.enum [
|
||||
type = enum [
|
||||
"dots"
|
||||
"dots_negative"
|
||||
"dots_snake"
|
||||
|
@ -136,38 +142,38 @@ in {
|
|||
};
|
||||
period = mkOption {
|
||||
description = "Period of the pattern";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 1;
|
||||
};
|
||||
};
|
||||
progress_style = mkOption {
|
||||
description = "Highlight group for in-progress LSP tasks";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "WarningMsg";
|
||||
};
|
||||
group_style = mkOption {
|
||||
description = "Highlight group for group name (LSP server name)";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "Title";
|
||||
};
|
||||
icon_style = mkOption {
|
||||
description = "Highlight group for group icons";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "Question";
|
||||
};
|
||||
priority = mkOption {
|
||||
description = "Priority of the progress notification";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 30;
|
||||
};
|
||||
skip_history = mkOption {
|
||||
description = "Skip adding messages to history";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
format_message = mkOption {
|
||||
description = "How to format a progress message";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''
|
||||
require("fidget.progress.display").default_format_message
|
||||
'';
|
||||
|
@ -175,7 +181,7 @@ in {
|
|||
};
|
||||
format_annote = mkOption {
|
||||
description = "How to format a progress annotation";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''
|
||||
function(msg) return msg.title end
|
||||
'';
|
||||
|
@ -183,7 +189,7 @@ in {
|
|||
};
|
||||
format_group_name = mkOption {
|
||||
description = "How to format a progress notification group's name";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''
|
||||
function(group) return tostring(group) end
|
||||
'';
|
||||
|
@ -191,7 +197,7 @@ in {
|
|||
};
|
||||
overrides = mkOption {
|
||||
description = "Override options from the default notification config";
|
||||
type = types.attrsOf types.str;
|
||||
type = attrsOf str;
|
||||
default = {rust_analyzer = "{ name = 'rust-analyzer' }";};
|
||||
apply = mapAttrs (key: lua: rawLua lua);
|
||||
};
|
||||
|
@ -200,12 +206,12 @@ in {
|
|||
lsp = {
|
||||
progress_ringbuf_size = mkOption {
|
||||
description = "Nvim's LSP client ring buffer size";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 100;
|
||||
};
|
||||
log_handler = mkOption {
|
||||
description = "Log `$/progress` handler invocations";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
|
@ -214,34 +220,34 @@ in {
|
|||
notification = {
|
||||
poll_rate = mkOption {
|
||||
description = "How frequently to update and render notifications";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 10;
|
||||
};
|
||||
filter = mkOption {
|
||||
description = "Minimum notifications level";
|
||||
type = types.enum ["debug" "info" "warn" "error"];
|
||||
type = enum ["debug" "info" "warn" "error"];
|
||||
default = "info";
|
||||
apply = filter: rawLua "vim.log.levels.${toUpper filter}";
|
||||
};
|
||||
history_size = mkOption {
|
||||
description = "Number of removed messages to retain in history";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 128;
|
||||
};
|
||||
override_vim_notify = mkOption {
|
||||
description = "Automatically override vim.notify() with Fidget";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
configs = mkOption {
|
||||
description = "How to configure notification groups when instantiated";
|
||||
type = types.attrsOf types.str;
|
||||
type = attrsOf str;
|
||||
default = {default = "require('fidget.notification').default_config";};
|
||||
apply = mapAttrs (key: lua: rawLua lua);
|
||||
};
|
||||
redirect = mkOption {
|
||||
description = "Conditionally redirect notifications to another backend";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''
|
||||
function(msg, level, opts)
|
||||
if opts and opts.on_open then
|
||||
|
@ -255,27 +261,27 @@ in {
|
|||
view = {
|
||||
stack_upwards = mkOption {
|
||||
description = "Display notification items from bottom to top";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
icon_separator = mkOption {
|
||||
description = "Separator between group name and icon";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = " ";
|
||||
};
|
||||
group_separator = mkOption {
|
||||
description = "Separator between notification groups";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "---";
|
||||
};
|
||||
group_separator_hl = mkOption {
|
||||
description = "Highlight group used for group separator";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "Comment";
|
||||
};
|
||||
render_message = mkOption {
|
||||
description = "How to render notification messages";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''
|
||||
function(msg, cnt)
|
||||
return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
|
||||
|
@ -288,17 +294,17 @@ in {
|
|||
window = {
|
||||
normal_hl = mkOption {
|
||||
description = "Base highlight group in the notification window";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "Comment";
|
||||
};
|
||||
winblend = mkOption {
|
||||
description = "Background color opacity in the notification window";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 100;
|
||||
};
|
||||
border = mkOption {
|
||||
description = "Border style of the notification window";
|
||||
type = types.enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||
default =
|
||||
if config.vim.ui.borders.enable
|
||||
then config.vim.ui.borders.globalStyle
|
||||
|
@ -306,37 +312,37 @@ in {
|
|||
};
|
||||
zindex = mkOption {
|
||||
description = "Stacking priority of the notification window";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 45;
|
||||
};
|
||||
max_width = mkOption {
|
||||
description = "Maximum width of the notification window";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 0;
|
||||
};
|
||||
max_height = mkOption {
|
||||
description = "Maximum height of the notification window";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 0;
|
||||
};
|
||||
x_padding = mkOption {
|
||||
description = "Padding from right edge of window boundary";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 1;
|
||||
};
|
||||
y_padding = mkOption {
|
||||
description = "Padding from bottom edge of window boundary";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 0;
|
||||
};
|
||||
align = mkOption {
|
||||
description = "How to align the notification window";
|
||||
type = types.enum ["top" "bottom"];
|
||||
type = enum ["top" "bottom"];
|
||||
default = "bottom";
|
||||
};
|
||||
relative = mkOption {
|
||||
description = "What the notification window position is relative to";
|
||||
type = types.enum ["editor" "win"];
|
||||
type = enum ["editor" "win"];
|
||||
default = "editor";
|
||||
};
|
||||
};
|
||||
|
@ -346,7 +352,7 @@ in {
|
|||
nvim-tree = {
|
||||
enable = mkOption {
|
||||
description = "Integrate with nvim-tree/nvim-tree.lua (if enabled)";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default =
|
||||
if config.vim.filetree.nvimTree.enable
|
||||
then true
|
||||
|
@ -356,7 +362,7 @@ in {
|
|||
xcodebuild-nvim = {
|
||||
enable = mkOption {
|
||||
description = "Integrate with wojciech-kulik/xcodebuild.nvim (if enabled)";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
@ -365,23 +371,23 @@ in {
|
|||
logger = {
|
||||
level = mkOption {
|
||||
description = "Minimum logging level";
|
||||
type = types.enum ["debug" "error" "info" "trace" "warn" "off"];
|
||||
type = enum ["debug" "error" "info" "trace" "warn" "off"];
|
||||
default = "warn";
|
||||
apply = logLevel: rawLua "vim.log.levels.${toUpper logLevel}";
|
||||
};
|
||||
max_size = mkOption {
|
||||
description = "Maximum log file size, in KB";
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 10000;
|
||||
};
|
||||
float_precision = mkOption {
|
||||
description = "Limit the number of decimals displayed for floats";
|
||||
type = types.float;
|
||||
type = float;
|
||||
default = 0.01;
|
||||
};
|
||||
path = mkOption {
|
||||
description = "Where Fidget writes its logs to";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = ''
|
||||
string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache"))
|
||||
'';
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkMappingOption mkOption types literalExpression mkRenamedOptionModule mkRemovedOptionModule;
|
||||
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.types) int bool str nullOr;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
|
||||
cfg = config.vim.visuals;
|
||||
in {
|
||||
|
@ -34,13 +37,13 @@ in {
|
|||
enable = mkEnableOption "line hightlighting on the cursor [nvim-cursorline]";
|
||||
|
||||
lineTimeout = mkOption {
|
||||
type = types.int;
|
||||
type = int;
|
||||
description = "Time in milliseconds for cursorline to appear";
|
||||
default = 0;
|
||||
};
|
||||
|
||||
lineNumbersOnly = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
description = "Hightlight only in the presence of line numbers";
|
||||
default = true;
|
||||
};
|
||||
|
@ -49,21 +52,21 @@ in {
|
|||
indentBlankline = {
|
||||
enable = mkEnableOption "indentation guides [indent-blankline]";
|
||||
debounce = mkOption {
|
||||
type = types.int;
|
||||
type = int;
|
||||
description = "Debounce time in milliseconds";
|
||||
default = 200;
|
||||
};
|
||||
|
||||
viewportBuffer = {
|
||||
min = mkOption {
|
||||
type = types.int;
|
||||
type = int;
|
||||
description = "Number of lines above and below of what is currently
|
||||
visible in the window";
|
||||
default = 30;
|
||||
};
|
||||
|
||||
max = mkOption {
|
||||
type = types.int;
|
||||
type = int;
|
||||
description = "Number of lines above and below of what is currently
|
||||
visible in the window";
|
||||
default = 500;
|
||||
|
@ -72,34 +75,34 @@ in {
|
|||
|
||||
indent = {
|
||||
char = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
description = "Character for indentation line";
|
||||
default = "│";
|
||||
};
|
||||
};
|
||||
|
||||
listChar = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
description = "Character for indentation line";
|
||||
default = "│";
|
||||
};
|
||||
|
||||
fillChar = mkOption {
|
||||
description = "Character to fill indents";
|
||||
type = with types; nullOr types.str;
|
||||
type = nullOr str;
|
||||
default = "⋅";
|
||||
};
|
||||
|
||||
eolChar = mkOption {
|
||||
description = "Character at end of line";
|
||||
type = with types; nullOr types.str;
|
||||
type = nullOr str;
|
||||
default = "↴";
|
||||
};
|
||||
|
||||
scope = {
|
||||
enabled = mkOption {
|
||||
description = "Highlight current scope from treesitter";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = config.vim.treesitter.enable;
|
||||
defaultText = literalExpression "config.vim.treesitter.enable";
|
||||
};
|
||||
|
@ -109,7 +112,7 @@ in {
|
|||
Displays the end of line character set by [](#opt-vim.visuals.indentBlankline.eolChar) instead of the
|
||||
indent guide on line returns.
|
||||
'';
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = cfg.indentBlankline.eolChar != null;
|
||||
defaultText = literalExpression "config.vim.visuals.indentBlankline.eolChar != null";
|
||||
};
|
||||
|
@ -120,7 +123,7 @@ in {
|
|||
enable = mkEnableOption "highlight undo [highlight-undo]";
|
||||
|
||||
highlightForCount = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enable support for highlighting when a <count> is provided before the key
|
||||
|
@ -129,14 +132,14 @@ in {
|
|||
};
|
||||
|
||||
duration = mkOption {
|
||||
type = types.int;
|
||||
type = int;
|
||||
description = "Duration of highlight";
|
||||
default = 500;
|
||||
};
|
||||
|
||||
undo = {
|
||||
hlGroup = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
description = "Highlight group for undo";
|
||||
default = "HighlightUndo";
|
||||
};
|
||||
|
@ -144,7 +147,7 @@ in {
|
|||
|
||||
redo = {
|
||||
hlGroup = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
description = "Highlight group for redo";
|
||||
default = "HighlightUndo";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue