mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/utils: move to by-name
This commit is contained in:
parent
faff32b9f1
commit
52f125679f
195 changed files with 2 additions and 102 deletions
203
plugins/by-name/alpha/default.nix
Normal file
203
plugins/by-name/alpha/default.nix
Normal file
|
@ -0,0 +1,203 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.alpha;
|
||||
|
||||
sectionType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = types.enum [
|
||||
"button"
|
||||
"group"
|
||||
"padding"
|
||||
"text"
|
||||
"terminal"
|
||||
];
|
||||
description = "Type of section";
|
||||
};
|
||||
|
||||
val = helpers.mkNullOrOption (
|
||||
with helpers.nixvimTypes;
|
||||
nullOr (oneOf [
|
||||
# "button", "text"
|
||||
str
|
||||
# "padding"
|
||||
int
|
||||
(listOf (
|
||||
either
|
||||
# "text" (list of strings)
|
||||
str
|
||||
# "group"
|
||||
(attrsOf anything)
|
||||
))
|
||||
])
|
||||
) "Value for section";
|
||||
|
||||
opts = mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
default = { };
|
||||
description = "Additional options for the section";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.alpha = {
|
||||
enable = mkEnableOption "alpha-nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "alpha-nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"alpha-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
# TODO: deprecated 2024-08-29 remove after 24.11
|
||||
iconsEnabled = mkOption {
|
||||
type = types.bool;
|
||||
description = "Toggle icon support. Installs nvim-web-devicons.";
|
||||
visible = false;
|
||||
};
|
||||
|
||||
iconsPackage = lib.mkPackageOption pkgs [
|
||||
"vimPlugins"
|
||||
"nvim-web-devicons"
|
||||
] { nullable = true; };
|
||||
|
||||
theme = mkOption {
|
||||
type = with helpers.nixvimTypes; nullOr (maybeRaw str);
|
||||
apply = v: if isString v then helpers.mkRaw "require'alpha.themes.${v}'.config" else v;
|
||||
default = null;
|
||||
example = "dashboard";
|
||||
description = "You can directly use a pre-defined theme.";
|
||||
};
|
||||
|
||||
layout = mkOption {
|
||||
type = types.listOf sectionType;
|
||||
default = [ ];
|
||||
description = "List of sections to layout for the dashboard";
|
||||
example = [
|
||||
{
|
||||
type = "padding";
|
||||
val = 2;
|
||||
}
|
||||
{
|
||||
type = "text";
|
||||
val = [
|
||||
"███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||
"████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||
"██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||
"██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||
"██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||
"╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||
];
|
||||
opts = {
|
||||
position = "center";
|
||||
hl = "Type";
|
||||
};
|
||||
}
|
||||
{
|
||||
type = "padding";
|
||||
val = 2;
|
||||
}
|
||||
{
|
||||
type = "group";
|
||||
val = [
|
||||
{
|
||||
type = "button";
|
||||
val = " New file";
|
||||
on_press.__raw = "function() vim.cmd[[ene]] end";
|
||||
opts.shortcut = "n";
|
||||
}
|
||||
{
|
||||
type = "button";
|
||||
val = " Quit Neovim";
|
||||
on_press.__raw = "function() vim.cmd[[qa]] end";
|
||||
opts.shortcut = "q";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
type = "padding";
|
||||
val = 2;
|
||||
}
|
||||
{
|
||||
type = "text";
|
||||
val = "Inspiring quote here.";
|
||||
opts = {
|
||||
position = "center";
|
||||
hl = "Keyword";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
opts = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
Optional global options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
layoutDefined = cfg.layout != [ ];
|
||||
themeDefined = cfg.theme != null;
|
||||
|
||||
opt = options.plugins.alpha;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
# TODO: deprecated 2024-08-29 remove after 24.11
|
||||
warnings = lib.mkIf opt.iconsEnabled.isDefined [
|
||||
''
|
||||
nixvim (plugins.alpha):
|
||||
The option definition `plugins.alpha.iconsEnabled' in ${showFiles opt.iconsEnabled.files} has been deprecated; please remove it.
|
||||
You should use `plugins.alpha.iconsPackage' instead.
|
||||
''
|
||||
];
|
||||
|
||||
extraPlugins =
|
||||
[ cfg.package ]
|
||||
++ lib.optional (
|
||||
cfg.iconsPackage != null && (opt.iconsEnabled.isDefined -> cfg.iconsEnabled)
|
||||
) cfg.iconsPackage;
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = themeDefined || layoutDefined;
|
||||
message = ''
|
||||
Nixvim (plugins.alpha): You have to either set a `theme` or define some sections in `layout`.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = !(themeDefined && layoutDefined);
|
||||
message = ''
|
||||
Nixvim (plugins.alpha): You can't define both a `theme` and custom options.
|
||||
Set `plugins.alpha.theme = null` if you want to configure alpha manually using the `layout` option.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
if themeDefined then
|
||||
cfg.theme
|
||||
else
|
||||
(with cfg; {
|
||||
inherit layout opts;
|
||||
});
|
||||
in
|
||||
''
|
||||
require('alpha').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
216
plugins/by-name/arrow/default.nix
Normal file
216
plugins/by-name/arrow/default.nix
Normal file
|
@ -0,0 +1,216 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "arrow";
|
||||
originalName = "arrow.nvim";
|
||||
package = "arrow-nvim";
|
||||
|
||||
maintainers = [ maintainers.hmajid2301 ];
|
||||
|
||||
settingsOptions = {
|
||||
show_icons = helpers.defaultNullOpts.mkBool false ''
|
||||
If true will show icons.
|
||||
'';
|
||||
|
||||
always_show_path = helpers.defaultNullOpts.mkBool false ''
|
||||
If true will show path.
|
||||
'';
|
||||
|
||||
separate_by_branch = helpers.defaultNullOpts.mkBool false ''
|
||||
If true will split bookmarks by git branch.
|
||||
'';
|
||||
|
||||
hide_handbook = helpers.defaultNullOpts.mkBool false ''
|
||||
If true to hide the shortcuts on menu.
|
||||
'';
|
||||
|
||||
save_path = helpers.defaultNullOpts.mkLuaFn ''
|
||||
function()
|
||||
return vim.fn.stdpath("cache") .. "/arrow"
|
||||
end
|
||||
'' "Function used to determine where to save arrow data.";
|
||||
|
||||
mapping = {
|
||||
edit = helpers.defaultNullOpts.mkStr "e" ''
|
||||
Mapping to edit bookmarks.
|
||||
'';
|
||||
|
||||
delete_mode = helpers.defaultNullOpts.mkStr "d" ''
|
||||
Mapping to go to delete mode, where you can remove bookmarks.
|
||||
'';
|
||||
|
||||
clear_all_items = helpers.defaultNullOpts.mkStr "C" ''
|
||||
Mapping to clear all bookmarks.
|
||||
'';
|
||||
|
||||
toggle = helpers.defaultNullOpts.mkStr "s" ''
|
||||
Mapping to save if `separate_save_and_remove` is true.
|
||||
'';
|
||||
|
||||
open_vertical = helpers.defaultNullOpts.mkStr "v" ''
|
||||
Mapping to open bookmarks in vertical split.
|
||||
'';
|
||||
|
||||
open_horizontal = helpers.defaultNullOpts.mkStr "-" ''
|
||||
Mapping to open bookmarks in horizontal split.
|
||||
'';
|
||||
|
||||
quit = helpers.defaultNullOpts.mkStr "q" ''
|
||||
Mapping to quit arrow.
|
||||
'';
|
||||
|
||||
remove = helpers.defaultNullOpts.mkStr "x" ''
|
||||
Mapping to remove bookmarks. Only used if `separate_save_and_remove` is true.
|
||||
'';
|
||||
|
||||
next_item = helpers.defaultNullOpts.mkStr "]" ''
|
||||
Mapping to go to next bookmark.
|
||||
'';
|
||||
|
||||
prev_item = helpers.defaultNullOpts.mkStr "[" ''
|
||||
Mapping to go to previous bookmark.
|
||||
'';
|
||||
};
|
||||
|
||||
custom_actions = {
|
||||
open =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(target_file_name, current_file_name) end
|
||||
''
|
||||
''
|
||||
- `target_file_name`: file selected to be open
|
||||
- `current_file_name`: filename from where this was called
|
||||
'';
|
||||
|
||||
split_vertical = helpers.defaultNullOpts.mkLuaFn ''
|
||||
function(target_file_name, current_file_name) end
|
||||
'' "";
|
||||
|
||||
split_horizontal = helpers.defaultNullOpts.mkLuaFn ''
|
||||
function(target_file_name, current_file_name) end
|
||||
'' "";
|
||||
};
|
||||
|
||||
window =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.anything
|
||||
{
|
||||
relative = "editor";
|
||||
width = "auto";
|
||||
height = "auto";
|
||||
row = "auto";
|
||||
col = "auto";
|
||||
style = "minimal";
|
||||
border = "single";
|
||||
}
|
||||
''
|
||||
Controls the appearance and position of an arrow window.
|
||||
See `:h nvim_open_win()` for all options.
|
||||
'';
|
||||
|
||||
per_buffer_config = {
|
||||
lines = helpers.defaultNullOpts.mkInt 4 ''
|
||||
Number of lines on preview.
|
||||
'';
|
||||
|
||||
sort_automatically = helpers.defaultNullOpts.mkBool true ''
|
||||
If true will sort buffer marks automatically.
|
||||
'';
|
||||
|
||||
satellite = {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
If true will display arrow index in scrollbar at every update.
|
||||
'';
|
||||
|
||||
overlap = helpers.defaultNullOpts.mkBool false '''';
|
||||
|
||||
priority = helpers.defaultNullOpts.mkInt 1000 '''';
|
||||
};
|
||||
|
||||
zindex = helpers.defaultNullOpts.mkInt 50 ''
|
||||
Z index of the buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
separate_save_and_remove = helpers.defaultNullOpts.mkBool false ''
|
||||
If true will remove the toggle and create the save/remove keymaps.
|
||||
'';
|
||||
|
||||
leader_key = helpers.defaultNullOpts.mkStr ";" ''
|
||||
The leader key to use for arrow. Will precede all mappings.
|
||||
Recommended to be a single character.
|
||||
'';
|
||||
|
||||
save_key = helpers.defaultNullOpts.mkStr "cwd" ''
|
||||
What will be used as root to save the bookmarks. Can be also `git_root`.
|
||||
'';
|
||||
|
||||
global_bookmarks = helpers.defaultNullOpts.mkBool false ''
|
||||
If true arrow will save files globally (ignores `separate_by_branch`).
|
||||
'';
|
||||
|
||||
index_keys = helpers.defaultNullOpts.mkStr "123456789zxcbnmZXVBNM,afghjklAFGHJKLwrtyuiopWRTYUIOP" ''
|
||||
Keys mapped to bookmark index.
|
||||
'';
|
||||
|
||||
full_path_list = helpers.defaultNullOpts.mkListOf types.str [ "update_stuff" ] ''
|
||||
Filenames on this list will ALWAYS show the file path too
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
show_icons = true;
|
||||
always_show_path = false;
|
||||
separate_by_branch = false;
|
||||
hide_handbook = false;
|
||||
save_path = ''
|
||||
function()
|
||||
return vim.fn.stdpath("cache") .. "/arrow"
|
||||
end
|
||||
'';
|
||||
mappings = {
|
||||
edit = "e";
|
||||
delete_mode = "d";
|
||||
clear_all_items = "C";
|
||||
toggle = "s";
|
||||
open_vertical = "v";
|
||||
open_horizontal = "-";
|
||||
quit = "q";
|
||||
remove = "x";
|
||||
next_item = "]";
|
||||
prev_item = "[";
|
||||
};
|
||||
custom_actions = {
|
||||
open = "function(target_file_name, current_file_name) end";
|
||||
split_vertical = "function(target_file_name, current_file_name) end";
|
||||
split_horizontal = "function(target_file_name, current_file_name) end";
|
||||
};
|
||||
window = {
|
||||
width = "auto";
|
||||
height = "auto";
|
||||
row = "auto";
|
||||
col = "auto";
|
||||
border = "double";
|
||||
};
|
||||
per_buffer_config = {
|
||||
lines = 4;
|
||||
sort_automatically = true;
|
||||
satellite = {
|
||||
enable = false;
|
||||
overlap = true;
|
||||
priority = 1000;
|
||||
};
|
||||
zindex = 10;
|
||||
};
|
||||
separate_save_and_remove = false;
|
||||
leader_key = ";";
|
||||
save_key = "cwd";
|
||||
global_bookmarks = false;
|
||||
index_keys = "123456789zxcbnmZXVBNM,afghjklAFGHJKLwrtyuiopWRTYUIOP";
|
||||
full_path_list = [ "update_stuff" ];
|
||||
};
|
||||
}
|
178
plugins/by-name/auto-save/default.nix
Normal file
178
plugins/by-name/auto-save/default.nix
Normal file
|
@ -0,0 +1,178 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "auto-save";
|
||||
originalName = "auto-save.nvim";
|
||||
package = "auto-save-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.braindefender ];
|
||||
|
||||
# TODO: introduced 2024-06-21, remove after 24.11
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
[
|
||||
"executionMessage"
|
||||
"message"
|
||||
]
|
||||
[
|
||||
"executionMessage"
|
||||
"dim"
|
||||
]
|
||||
[
|
||||
"executionMessage"
|
||||
"cleaningInterval"
|
||||
]
|
||||
"triggerEvents"
|
||||
"writeAllBuffers"
|
||||
"debounceDelay"
|
||||
];
|
||||
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"auto-save"
|
||||
];
|
||||
settingsPath = basePluginPath ++ [ "settings" ];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "enableAutoSave" ]) (settingsPath ++ [ "enabled" ]))
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "keymaps" ]) ''
|
||||
Use the top-level `keymaps` option to create a keymap that runs :ASToggle
|
||||
|
||||
keymaps = [
|
||||
{ key = "<leader>s"; action = "<cmd>ASToggle<CR>"; }
|
||||
];
|
||||
'')
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to start auto-save when the plugin is loaded.
|
||||
'';
|
||||
|
||||
execution_message = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Show execution message after successful auto-save.
|
||||
'';
|
||||
|
||||
message =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
{
|
||||
__raw = ''
|
||||
function()
|
||||
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
|
||||
end
|
||||
'';
|
||||
}
|
||||
''
|
||||
The message to print on save.
|
||||
This can be a lua function that returns a string.
|
||||
'';
|
||||
|
||||
dim = helpers.defaultNullOpts.mkNullable (types.numbers.between 0
|
||||
1
|
||||
) 0.18 "Dim the color of `message`.";
|
||||
|
||||
cleaning_interval = helpers.defaultNullOpts.mkUnsignedInt 1250 ''
|
||||
Time (in milliseconds) to wait before automatically cleaning MsgArea after displaying
|
||||
`message`.
|
||||
See `:h MsgArea`.
|
||||
'';
|
||||
};
|
||||
|
||||
trigger_events = {
|
||||
immediate_save =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"BufLeave"
|
||||
"FocusLost"
|
||||
]
|
||||
''
|
||||
Vim events that trigger an immediate save.\
|
||||
See `:h events` for events description.
|
||||
'';
|
||||
|
||||
defer_save =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"InsertLeave"
|
||||
"TextChanged"
|
||||
]
|
||||
''
|
||||
Vim events that trigger a deferred save (saves after `debounceDelay`).\
|
||||
See `:h events` for events description.
|
||||
'';
|
||||
|
||||
cancel_defered_save = helpers.defaultNullOpts.mkListOf types.str [ "InsertEnter" ] ''
|
||||
Vim events that cancel a pending deferred save.\
|
||||
See `:h events` for events description.
|
||||
'';
|
||||
};
|
||||
|
||||
condition = helpers.defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault = null;
|
||||
description = ''
|
||||
Function that determines whether to save the current buffer or not.
|
||||
- return true: if buffer is ok to be saved
|
||||
- return false: if it's not ok to be saved
|
||||
|
||||
In this example, the second argument of `utils.not_in(..., {})`
|
||||
determines which filetypes will be ignored by auto-save plugin.
|
||||
|
||||
Buffers that are `nomodifiable` are not saved by default.
|
||||
'';
|
||||
example = ''
|
||||
function(buf)
|
||||
local fn = vim.fn
|
||||
local utils = require("auto-save.utils.data")
|
||||
|
||||
if utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
write_all_buffers = helpers.defaultNullOpts.mkBool false ''
|
||||
Write all buffers when the current one meets `condition`.
|
||||
'';
|
||||
|
||||
noautocmd = helpers.defaultNullOpts.mkBool false ''
|
||||
Do not execute autocmds when saving.
|
||||
'';
|
||||
|
||||
lockmarks = helpers.defaultNullOpts.mkBool false ''
|
||||
Lock marks when saving, see `:h lockmarks` for more details.
|
||||
'';
|
||||
|
||||
debounce_delay = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
|
||||
Saves the file at most every `debounce_delay` milliseconds.
|
||||
'';
|
||||
|
||||
debug = helpers.defaultNullOpts.mkBool false ''
|
||||
Log debug messages to `auto-save.log` file in NeoVim cache directory.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
condition = ''
|
||||
function(buf)
|
||||
local fn = vim.fn
|
||||
local utils = require("auto-save.utils.data")
|
||||
|
||||
if utils.not_in(fn.getbufvar(buf, "&filetype"), {'oil'}) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
'';
|
||||
write_all_buffers = true;
|
||||
debounce_delay = 1000;
|
||||
};
|
||||
}
|
184
plugins/by-name/auto-session/default.nix
Normal file
184
plugins/by-name/auto-session/default.nix
Normal file
|
@ -0,0 +1,184 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.auto-session;
|
||||
in
|
||||
{
|
||||
options.plugins.auto-session = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "auto-session";
|
||||
|
||||
package = lib.mkPackageOption pkgs "auto-session" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"auto-session"
|
||||
];
|
||||
};
|
||||
|
||||
logLevel = helpers.defaultNullOpts.mkEnum [
|
||||
"debug"
|
||||
"info"
|
||||
"warn"
|
||||
"error"
|
||||
] "error" "Sets the log level of the plugin.";
|
||||
|
||||
autoSession = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enables/disables auto creating, saving and restoring.
|
||||
'';
|
||||
|
||||
enableLastSession = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to enable the "last session" feature.
|
||||
'';
|
||||
|
||||
rootDir = helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath 'data' .. '/sessions/'"; } ''
|
||||
Root directory for session files.
|
||||
Can be either a string or lua code (using `{__raw = 'foo';}`).
|
||||
'';
|
||||
|
||||
createEnabled = helpers.mkNullOrOption types.bool ''
|
||||
Whether to enable auto creating new sessions
|
||||
'';
|
||||
|
||||
suppressDirs = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
Suppress session create/restore if in one of the list of dirs.
|
||||
'';
|
||||
|
||||
allowedDirs = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
Allow session create/restore if in one of the list of dirs.
|
||||
'';
|
||||
|
||||
useGitBranch = helpers.mkNullOrOption types.bool ''
|
||||
Include git branch name in session name to differentiate between sessions for different
|
||||
git branches.
|
||||
'';
|
||||
};
|
||||
|
||||
autoSave = {
|
||||
enabled = helpers.defaultNullOpts.mkNullable types.bool null ''
|
||||
Whether to enable auto saving session.
|
||||
'';
|
||||
};
|
||||
|
||||
autoRestore = {
|
||||
enabled = helpers.defaultNullOpts.mkNullable types.bool null ''
|
||||
Whether to enable auto restoring session.
|
||||
'';
|
||||
};
|
||||
|
||||
cwdChangeHandling =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either (enum [ false ]) (submodule {
|
||||
options = {
|
||||
restoreUpcomingSession = helpers.defaultNullOpts.mkBool true ''
|
||||
Restore session for upcoming cwd on cwd change.
|
||||
'';
|
||||
|
||||
preCwdChangedHook = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
lua function hook.
|
||||
This is called after auto_session code runs for the `DirChangedPre` autocmd.
|
||||
'';
|
||||
|
||||
postCwdChangedHook = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
lua function hook.
|
||||
This is called after auto_session code runs for the `DirChanged` autocmd.
|
||||
'';
|
||||
};
|
||||
})
|
||||
)
|
||||
false
|
||||
''
|
||||
Config for handling the DirChangePre and DirChanged autocmds.
|
||||
Set to `false` to disable the feature.
|
||||
'';
|
||||
|
||||
bypassSessionSaveFileTypes = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
List of file types to bypass auto save when the only buffer open is one of the file types
|
||||
listed.
|
||||
'';
|
||||
|
||||
sessionLens = {
|
||||
loadOnSetup = helpers.defaultNullOpts.mkBool true ''
|
||||
If `loadOnSetup` is set to false, one needs to eventually call
|
||||
`require("auto-session").setup_session_lens()` if they want to use session-lens.
|
||||
'';
|
||||
|
||||
themeConf = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
winblend = 10;
|
||||
border = true;
|
||||
} "Theme configuration.";
|
||||
|
||||
previewer = helpers.defaultNullOpts.mkBool false ''
|
||||
Use default previewer config by setting the value to `null` if some sets previewer to
|
||||
true in the custom config.
|
||||
Passing in the boolean value errors out in the telescope code with the picker trying to
|
||||
index a boolean instead of a table.
|
||||
This fixes it but also allows for someone to pass in a table with the actual preview
|
||||
configs if they want to.
|
||||
'';
|
||||
|
||||
sessionControl = {
|
||||
controlDir =
|
||||
helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath 'data' .. '/auto_session/'"; }
|
||||
''
|
||||
Auto session control dir, for control files, like alternating between two sessions
|
||||
with session-lens.
|
||||
'';
|
||||
|
||||
controlFilename = helpers.defaultNullOpts.mkStr "session_control.json" ''
|
||||
File name of the session control file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
log_level = cfg.logLevel;
|
||||
auto_session_enable_last_session = cfg.autoSession.enableLastSession;
|
||||
auto_session_root_dir = cfg.autoSession.rootDir;
|
||||
auto_session_enabled = cfg.autoSession.enabled;
|
||||
auto_session_create_enabled = cfg.autoSession.createEnabled;
|
||||
auto_save_enabled = cfg.autoSave.enabled;
|
||||
auto_restore_enabled = cfg.autoRestore.enabled;
|
||||
auto_session_suppress_dirs = cfg.autoSession.suppressDirs;
|
||||
auto_session_allowed_dirs = cfg.autoSession.allowedDirs;
|
||||
auto_session_use_git_branch = cfg.autoSession.useGitBranch;
|
||||
cwd_change_handling =
|
||||
if isAttrs cfg.cwdChangeHandling then
|
||||
with cfg.cwdChangeHandling;
|
||||
{
|
||||
restore_upcoming_session = restoreUpcomingSession;
|
||||
pre_cwd_changed_hook = preCwdChangedHook;
|
||||
post_cwd_changed_hook = postCwdChangedHook;
|
||||
}
|
||||
else
|
||||
cfg.cwdChangeHandling;
|
||||
bypass_session_save_file_types = cfg.bypassSessionSaveFileTypes;
|
||||
session_lens = with cfg.sessionLens; {
|
||||
load_on_setup = loadOnSetup;
|
||||
theme_conf = themeConf;
|
||||
inherit previewer;
|
||||
session_control = with sessionControl; {
|
||||
control_dir = controlDir;
|
||||
control_filename = controlFilename;
|
||||
};
|
||||
};
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('auto-session').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
92
plugins/by-name/autoclose/default.nix
Normal file
92
plugins/by-name/autoclose/default.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.autoclose;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.autoclose = {
|
||||
enable = mkEnableOption "autoclose.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "autoclose.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"autoclose-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
keys = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
Configures various options, such as shortcuts for pairs, what pair of characters to use in the
|
||||
shortcut, etc.
|
||||
|
||||
See the plugin's [README](https://github.com/m4xshen/autoclose.nvim?tab=readme-ov-file#-configuration) for more info.";
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
"(" = { escape = false; close = true; pair = "()"; };
|
||||
"[" = { escape = false; close = true; pair = "[]"; };
|
||||
"{" = { escape = false; close = true; pair = "{}"; };
|
||||
}
|
||||
|
||||
```
|
||||
'';
|
||||
|
||||
options = {
|
||||
disabledFiletypes = helpers.defaultNullOpts.mkListOf types.str [ "text" ] ''
|
||||
The plugin will be disabled under the filetypes in this table.
|
||||
'';
|
||||
|
||||
disableWhenTouch = helpers.defaultNullOpts.mkBool false ''
|
||||
Set this to true will disable the auto-close function when the cursor touches character that
|
||||
matches touch_regex.
|
||||
'';
|
||||
|
||||
touchRegex = helpers.defaultNullOpts.mkStr "[%w(%[{]" ''
|
||||
See [README](https://github.com/m4xshen/autoclose.nvim?tab=readme-ov-file#options).
|
||||
'';
|
||||
|
||||
pairSpaces = helpers.defaultNullOpts.mkBool false ''
|
||||
Pair the spaces when cursor is inside a pair of keys.
|
||||
See [README](https://github.com/m4xshen/autoclose.nvim?tab=readme-ov-file#options)
|
||||
'';
|
||||
|
||||
autoIndent = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable auto-indent feature.
|
||||
'';
|
||||
|
||||
disableCommandMode = helpers.defaultNullOpts.mkBool false ''
|
||||
Disable autoclose for command mode globally.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
inherit keys;
|
||||
options = with options; {
|
||||
disabled_filetypes = disabledFiletypes;
|
||||
disable_when_touch = disableWhenTouch;
|
||||
touch_regex = touchRegex;
|
||||
pair_spaces = pairSpaces;
|
||||
auto_indent = autoIndent;
|
||||
disable_command_mode = disableCommandMode;
|
||||
};
|
||||
};
|
||||
in
|
||||
''
|
||||
require('autoclose').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
27
plugins/by-name/autosource/default.nix
Normal file
27
plugins/by-name/autosource/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
in
|
||||
lib.nixvim.vim-plugin.mkVimPlugin {
|
||||
name = "autosource";
|
||||
originalName = "vim-autosource";
|
||||
package = "vim-autosource";
|
||||
globalPrefix = "autosource_";
|
||||
|
||||
maintainers = [ lib.nixvim.maintainers.refaelsh ];
|
||||
|
||||
settingsOptions = {
|
||||
prompt_for_new_file = defaultNullOpts.mkFlagInt 1 ''
|
||||
The primary use-case of this option is to support automated testing.
|
||||
When set to false AutoSource will not prompt you when it detects a new file. The file will *NOT* be sourced.
|
||||
'';
|
||||
|
||||
prompt_for_changed_file = defaultNullOpts.mkFlagInt 1 ''
|
||||
The primary use-case of this option is to support automated testing.
|
||||
When set to false AutoSource will not prompt you when it detects when a file is changed. The file will NOT be sourced.
|
||||
'';
|
||||
};
|
||||
}
|
28
plugins/by-name/bacon/default.nix
Normal file
28
plugins/by-name/bacon/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "bacon";
|
||||
package = "nvim-bacon";
|
||||
maintainers = [ helpers.maintainers.alisonjenkins ];
|
||||
|
||||
settingsOptions = {
|
||||
quickfix = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to populate the quickfix list with bacon errors and warnings.
|
||||
'';
|
||||
|
||||
event_trigger = helpers.defaultNullOpts.mkBool true ''
|
||||
Triggers the `QuickFixCmdPost` event after populating the quickfix list.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
quickfix = {
|
||||
enabled = false;
|
||||
event_trigger = true;
|
||||
};
|
||||
};
|
||||
}
|
55
plugins/by-name/baleia/default.nix
Normal file
55
plugins/by-name/baleia/default.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "baleia";
|
||||
originalName = "baleia.nvim";
|
||||
package = "baleia-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.alisonjenkins ];
|
||||
|
||||
settingsOptions = {
|
||||
async = helpers.defaultNullOpts.mkBool true ''
|
||||
Highlight asynchronously.
|
||||
'';
|
||||
|
||||
colors = helpers.defaultNullOpts.mkStr "NR_8" ''
|
||||
Table mapping 256 color codes to vim colors.
|
||||
'';
|
||||
|
||||
line_starts_at = helpers.defaultNullOpts.mkInt 1 ''
|
||||
At which column start colorizing.
|
||||
'';
|
||||
|
||||
log =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"ERROR"
|
||||
"WARN"
|
||||
"INFO"
|
||||
"DEBUG"
|
||||
]
|
||||
"INFO"
|
||||
''
|
||||
Log level, possible values are ERROR, WARN, INFO or DEBUG.
|
||||
'';
|
||||
|
||||
name = helpers.defaultNullOpts.mkStr "BaleiaColors" ''
|
||||
Prefix used to name highlight groups.
|
||||
'';
|
||||
|
||||
strip_ansi_codes = helpers.defaultNullOpts.mkBool true ''
|
||||
Remove ANSI color codes from text.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
async = true;
|
||||
colors = "NR_8";
|
||||
line_starts_at = 1;
|
||||
log = "INFO";
|
||||
name = "BaleiaColors";
|
||||
strip_ansi_codes = true;
|
||||
};
|
||||
}
|
97
plugins/by-name/better-escape/default.nix
Normal file
97
plugins/by-name/better-escape/default.nix
Normal file
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "better-escape";
|
||||
originalName = "better-escape.nvim";
|
||||
luaName = "better_escape";
|
||||
package = "better-escape-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO: introduced 2024-07-23. Remove after 24.11 release.
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [ "timeout" ];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"better-escape"
|
||||
];
|
||||
in
|
||||
[
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "clearEmptyLines" ]) ''
|
||||
This option has been removed upstream.
|
||||
See the [upstream README](https://github.com/max397574/better-escape.nvim?tab=readme-ov-file#rewrite) for additional information.
|
||||
'')
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "keys" ]) ''
|
||||
This option has been removed upstream.
|
||||
See the [upstream README](https://github.com/max397574/better-escape.nvim?tab=readme-ov-file#rewrite) for additional information.
|
||||
'')
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "mapping" ]) ''
|
||||
This option has been removed in favor of `plugins.better-escape.settings.mapping`.
|
||||
See the [upstream README](https://github.com/max397574/better-escape.nvim?tab=readme-ov-file#rewrite) for additional information.
|
||||
'')
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
timeout = helpers.defaultNullOpts.mkStrLuaOr types.ints.unsigned "vim.o.timeoutlen" ''
|
||||
The time in which the keys must be hit in ms.
|
||||
Uses the value of `vim.o.timeoutlen` (`options.timeoutlen` in nixvim) by default.
|
||||
'';
|
||||
|
||||
default_mappings = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable default key mappings.
|
||||
'';
|
||||
|
||||
mappings = helpers.defaultNullOpts.mkAttrsOf' {
|
||||
type = types.anything;
|
||||
pluginDefault = {
|
||||
i.j = {
|
||||
k = "<Esc>";
|
||||
j = "<Esc>";
|
||||
};
|
||||
c.j = {
|
||||
k = "<Esc>";
|
||||
j = "<Esc>";
|
||||
};
|
||||
t.j = {
|
||||
k = "<Esc>";
|
||||
j = "<Esc>";
|
||||
};
|
||||
v.j.k = "<Esc>";
|
||||
s.j.k = "<Esc>";
|
||||
};
|
||||
example.i." "."<tab>".__raw = ''
|
||||
function()
|
||||
-- Defer execution to avoid side-effects
|
||||
vim.defer_fn(function()
|
||||
-- set undo point
|
||||
vim.o.ul = vim.o.ul
|
||||
require("luasnip").expand_or_jump()
|
||||
end, 1)
|
||||
end
|
||||
'';
|
||||
description = "Define mappings for each mode.";
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
timeout = "vim.o.timeoutlen";
|
||||
mapping = {
|
||||
i." "."<tab>".__raw = ''
|
||||
function()
|
||||
-- Defer execution to avoid side-effects
|
||||
vim.defer_fn(function()
|
||||
-- set undo point
|
||||
vim.o.ul = vim.o.ul
|
||||
require("luasnip").expand_or_jump()
|
||||
end, 1)
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
68
plugins/by-name/bufdelete/default.nix
Normal file
68
plugins/by-name/bufdelete/default.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
helpers,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "bufdelete";
|
||||
originalName = "bufdelete.nvim";
|
||||
package = "bufdelete-nvim";
|
||||
globalPrefix = "bufdelete_";
|
||||
|
||||
maintainers = [ maintainers.MattSturgeon ];
|
||||
|
||||
description = ''
|
||||
This plugin provides two commands, `:Bdelete` and `:Bwipeout`.
|
||||
They work exactly the same as `:bdelete` and `:bwipeout`,
|
||||
except they keep your window layout intact.
|
||||
|
||||
There's also two Lua functions provided, `bufdelete` and `bufwipeout`,
|
||||
which do the same thing as their command counterparts.
|
||||
Both take three arguments, `buffers`, `force` and `switchable_buffers`.
|
||||
|
||||
Here's an example of how to use the functions:
|
||||
|
||||
```lua
|
||||
-- Forcibly delete current buffer
|
||||
require('bufdelete').bufdelete(0, true)
|
||||
|
||||
-- Wipeout buffer number 100 without force
|
||||
require('bufdelete').bufwipeout(100)
|
||||
|
||||
-- Delete buffer 7 and 30 without force.
|
||||
require('bufdelete').bufdelete({7, 30})
|
||||
|
||||
-- Delete buffer matching foo.txt with force
|
||||
require('bufdelete').bufdelete("foo.txt", true)
|
||||
|
||||
-- Delete buffer matching foo.txt, buffer matching bar.txt and buffer 3 with force
|
||||
require('bufdelete').bufdelete({"foo.txt", "bar.txt", 3}, true)
|
||||
|
||||
-- Delete current buffer and switch to one of buffer 3, 5 or 10
|
||||
require('bufdelete').bufdelete(0, false, { 3, 5, 10 })
|
||||
```
|
||||
|
||||
See the plugin's [README] for more details.
|
||||
|
||||
[README]: https://github.com/famiu/bufdelete.nvim/?tab=readme-ov-file
|
||||
'';
|
||||
|
||||
settingsOptions = {
|
||||
buf_filter = helpers.defaultNullOpts.mkLuaFn null ''
|
||||
Function that determines buffers that bufdelete.nvim can switch to,
|
||||
instead of the default behavior of switching to any buffer.
|
||||
|
||||
Must be a function that takes no argument and returns a list of buffers.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
buf_filter = ''
|
||||
function()
|
||||
-- TODO: return a list of buffers
|
||||
return { }
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
254
plugins/by-name/ccc/default.nix
Normal file
254
plugins/by-name/ccc/default.nix
Normal file
|
@ -0,0 +1,254 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "ccc";
|
||||
originalName = "ccc.nvim";
|
||||
package = "ccc-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.JanKremer ];
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
listOfRawLua = with helpers.nixvimTypes; listOf strLua;
|
||||
mapToRawLua = map helpers.mkRaw;
|
||||
in
|
||||
{
|
||||
default_color = helpers.defaultNullOpts.mkStr "#000000" ''
|
||||
The default color used when a color cannot be picked. It must be HEX format.
|
||||
'';
|
||||
|
||||
inputs = mkOption {
|
||||
type = listOfRawLua;
|
||||
apply = mapToRawLua;
|
||||
default = [ ];
|
||||
example = [
|
||||
"ccc.input.rgb"
|
||||
"ccc.input.hsl"
|
||||
"ccc.input.hwb"
|
||||
"ccc.input.lab"
|
||||
"ccc.input.lch"
|
||||
"ccc.input.oklab"
|
||||
"ccc.input.oklch"
|
||||
"ccc.input.cmyk"
|
||||
"ccc.input.hsluv"
|
||||
"ccc.input.okhsl"
|
||||
"ccc.input.hsv"
|
||||
"ccc.input.okhsv"
|
||||
"ccc.input.xyz"
|
||||
];
|
||||
description = ''
|
||||
List of color system to be activated.
|
||||
`ccc-action-toggle_input_mode` toggles in this order.
|
||||
The first one is the default used at the first startup.
|
||||
Once activated, it will keep the previous input mode.
|
||||
|
||||
Plugin default:
|
||||
```nix
|
||||
[
|
||||
"ccc.input.rgb"
|
||||
"ccc.input.hsl"
|
||||
"ccc.input.cmyk"
|
||||
]
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
outputs = mkOption {
|
||||
type = listOfRawLua;
|
||||
apply = mapToRawLua;
|
||||
default = [ ];
|
||||
example = [
|
||||
"ccc.output.hex"
|
||||
"ccc.output.hex_short"
|
||||
"ccc.output.css_rgb"
|
||||
"ccc.output.css_hsl"
|
||||
"ccc.output.css_hwb"
|
||||
"ccc.output.css_lab"
|
||||
"ccc.output.css_lch"
|
||||
"ccc.output.css_oklab"
|
||||
"ccc.output.css_oklch"
|
||||
"ccc.output.float"
|
||||
"ccc.output.hex.setup({ uppercase = true })"
|
||||
"ccc.output.hex_short.setup({ uppercase = true })"
|
||||
];
|
||||
description = ''
|
||||
List of output format to be activated.
|
||||
`ccc-action-toggle_ouotput_mode` toggles in this order.
|
||||
The first one is the default used at the first startup.
|
||||
Once activated, it will keep the previous output mode.
|
||||
|
||||
Plugin default:
|
||||
```nix
|
||||
[
|
||||
"ccc.output.hex"
|
||||
"ccc.output.hex_short"
|
||||
"ccc.output.css_rgb"
|
||||
"ccc.output.css_hsl"
|
||||
]
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
pickers = mkOption {
|
||||
type = listOfRawLua;
|
||||
apply = mapToRawLua;
|
||||
default = [ ];
|
||||
example = [
|
||||
"ccc.picker.hex"
|
||||
"ccc.picker.css_rgb"
|
||||
"ccc.picker.css_hsl"
|
||||
"ccc.picker.css_hwb"
|
||||
"ccc.picker.css_lab"
|
||||
"ccc.picker.css_lch"
|
||||
"ccc.picker.css_oklab"
|
||||
"ccc.picker.css_oklch"
|
||||
"ccc.picker.css_name"
|
||||
];
|
||||
description = ''
|
||||
List of formats that can be detected by `:CccPick` to be activated.
|
||||
|
||||
Plugin default:
|
||||
```nix
|
||||
[
|
||||
"ccc.picker.hex"
|
||||
"ccc.picker.css_rgb"
|
||||
"ccc.picker.css_hsl"
|
||||
"ccc.picker.css_hwb"
|
||||
"ccc.picker.css_lab"
|
||||
"ccc.picker.css_lch"
|
||||
"ccc.picker.css_oklab"
|
||||
"ccc.picker.css_oklch"
|
||||
]
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
highlight_mode =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"bg"
|
||||
"fg"
|
||||
"background"
|
||||
"foreground"
|
||||
]
|
||||
''
|
||||
Option to highlight text foreground or background.
|
||||
It is used to `output_line` and `highlighter`.
|
||||
'';
|
||||
|
||||
lsp = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable LSP support.
|
||||
The color information is updated in the background and the result is used by `:CccPick` and
|
||||
highlighter.
|
||||
'';
|
||||
|
||||
highlighter = {
|
||||
auto_enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to enable automatically on `BufEnter`.
|
||||
'';
|
||||
|
||||
filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
File types for which highlighting is enabled.
|
||||
It is only used for automatic highlighting by `ccc-option-highlighter-auto-enable`, and is
|
||||
ignored for manual activation.
|
||||
An empty table means all file types.
|
||||
'';
|
||||
|
||||
excludes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Used only when `ccc-option-highlighter-filetypes` is empty table.
|
||||
You can specify file types to be excludes.
|
||||
'';
|
||||
|
||||
lsp = helpers.defaultNullOpts.mkBool true ''
|
||||
If true, highlight using LSP.
|
||||
If language server with the color provider is not attached to a buffer, it falls back to
|
||||
highlight with pickers.
|
||||
See also `:help ccc-option-lsp`.
|
||||
'';
|
||||
|
||||
update_insert = helpers.defaultNullOpts.mkBool true ''
|
||||
If true, highlights will be updated during insert mode.
|
||||
If false, highlights will not be updated during editing in insert mode, but will be
|
||||
updated on `InsertLeave`.
|
||||
'';
|
||||
};
|
||||
|
||||
convert = mkOption {
|
||||
type =
|
||||
with helpers.nixvimTypes;
|
||||
nullOr (
|
||||
maybeRaw (
|
||||
listOf
|
||||
# Pairs of lua strings
|
||||
(listOf strLua)
|
||||
)
|
||||
);
|
||||
apply = map mapToRawLua;
|
||||
default = [ ];
|
||||
example = [
|
||||
[
|
||||
"ccc.picker.hex"
|
||||
"ccc.output.css_oklch"
|
||||
]
|
||||
[
|
||||
"ccc.picker.css_oklch"
|
||||
"ccc.output.hex"
|
||||
]
|
||||
];
|
||||
description = ''
|
||||
Specify the correspondence between picker and output.
|
||||
The default setting converts the color to `css_rgb` if it is in hex format, to `css_hsl`
|
||||
if it is in `css_rgb` format, and to hex if it is in `css_hsl` format.
|
||||
|
||||
Plugin default:
|
||||
```nix
|
||||
[
|
||||
["ccc.picker.hex" "ccc.output.css_rgb"]
|
||||
["ccc.picker.css_rgb" "ccc.output.css_hsl"]
|
||||
["ccc.picker.css_hsl" "ccc.output.hex"]
|
||||
]
|
||||
```
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
default_color = "#FFFFFF";
|
||||
inputs = [
|
||||
"ccc.input.oklab"
|
||||
"ccc.input.oklch"
|
||||
];
|
||||
outputs = [
|
||||
"ccc.output.css_oklab"
|
||||
"ccc.output.css_oklch"
|
||||
];
|
||||
pickers = [
|
||||
"ccc.picker.css_oklch"
|
||||
"ccc.picker.css_name"
|
||||
"ccc.picker.hex"
|
||||
];
|
||||
highlight_mode = "fg";
|
||||
lsp = false;
|
||||
highlighter = {
|
||||
auto_enable = true;
|
||||
lsp = false;
|
||||
excludes = [ "markdown" ];
|
||||
update_insert = false;
|
||||
};
|
||||
};
|
||||
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
# ccc requires `termguicolors` to be enabled.
|
||||
opts.termguicolors = lib.mkDefault true;
|
||||
|
||||
extraConfigLua = ''
|
||||
ccc = require('ccc')
|
||||
ccc.setup(${helpers.toLuaObject cfg.settings})
|
||||
'';
|
||||
};
|
||||
}
|
156
plugins/by-name/clipboard-image/default.nix
Normal file
156
plugins/by-name/clipboard-image/default.nix
Normal file
|
@ -0,0 +1,156 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.clipboard-image;
|
||||
|
||||
pluginOptions = {
|
||||
imgDir =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with helpers.nixvimTypes;
|
||||
oneOf [
|
||||
str
|
||||
(listOf str)
|
||||
rawLua
|
||||
]
|
||||
)
|
||||
"img"
|
||||
''
|
||||
Dir name where the image will be pasted to.
|
||||
|
||||
Note: If you want to create nested dir, it is better to use table since windows and unix
|
||||
have different path separator.
|
||||
'';
|
||||
|
||||
imgDirTxt = helpers.defaultNullOpts.mkNullable (
|
||||
with helpers.nixvimTypes;
|
||||
oneOf [
|
||||
str
|
||||
(listOf str)
|
||||
rawLua
|
||||
]
|
||||
) "img" "Dir that will be inserted into text/buffer.";
|
||||
|
||||
imgName = helpers.defaultNullOpts.mkStr {
|
||||
__raw = "function() return os.date('%Y-%m-%d-%H-%M-%S') end";
|
||||
} "Image's name.";
|
||||
|
||||
imgHandler = helpers.defaultNullOpts.mkLuaFn "function(img) end" ''
|
||||
Function that will handle image after pasted.
|
||||
|
||||
Note: `img` is a table that contain pasted image's `{name}` and `{path}`.
|
||||
'';
|
||||
|
||||
affix = helpers.mkNullOrStr ''
|
||||
String that sandwiched the image's path.
|
||||
|
||||
Default:
|
||||
- `default`: `"{img_path}"`
|
||||
- `markdown`: `""`
|
||||
|
||||
Note:
|
||||
Affix can be multi lines, like this:
|
||||
|
||||
```nix
|
||||
# You can use line break escape sequence
|
||||
affix = "<\n %s\n>";
|
||||
```
|
||||
|
||||
```nix
|
||||
# Or lua's double square brackets
|
||||
affix.__raw = \'\'
|
||||
[[<
|
||||
%s
|
||||
>]]
|
||||
\'\'
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
processPluginOptions =
|
||||
opts: with opts; {
|
||||
img_dir = imgDir;
|
||||
img_dir_txt = imgDirTxt;
|
||||
img_name = imgName;
|
||||
img_handler = imgHandler;
|
||||
inherit affix;
|
||||
};
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.clipboard-image = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "clipboard-image.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "clipboard-image.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"clipboard-image-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
clipboardPackage = mkOption {
|
||||
type = with types; nullOr package;
|
||||
description = ''
|
||||
Which clipboard provider to use.
|
||||
|
||||
Recommended:
|
||||
- X11: `pkgs.xclip`
|
||||
- Wayland: `pkgs.wl-clipboard`
|
||||
- MacOS: `pkgs.pngpaste`
|
||||
'';
|
||||
example = pkgs.wl-clipboard;
|
||||
};
|
||||
|
||||
default = pluginOptions;
|
||||
|
||||
filetypes = mkOption {
|
||||
type =
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = pluginOptions;
|
||||
});
|
||||
apply = mapAttrs (_: processPluginOptions);
|
||||
default = { };
|
||||
description = "Override certain options for specific filetypes.";
|
||||
example = {
|
||||
markdown = {
|
||||
imgDir = [
|
||||
"src"
|
||||
"assets"
|
||||
"img"
|
||||
];
|
||||
imgDirTxt = "/assets/img";
|
||||
imgHandler = ''
|
||||
function(img)
|
||||
local script = string.format('./image_compressor.sh "%s"', img.path)
|
||||
os.execute(script)
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraPackages = [ cfg.clipboardPackage ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions = {
|
||||
default = processPluginOptions cfg.default;
|
||||
} // cfg.filetypes // cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('clipboard-image').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
93
plugins/by-name/cloak/default.nix
Normal file
93
plugins/by-name/cloak/default.nix
Normal file
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "cloak";
|
||||
originalName = "cloak.nvim";
|
||||
package = "cloak-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable the plugin.
|
||||
'';
|
||||
|
||||
cloak_character = helpers.defaultNullOpts.mkStr "*" ''
|
||||
Define the cloak character.
|
||||
'';
|
||||
|
||||
highlight_group = helpers.defaultNullOpts.mkStr "Comment" ''
|
||||
The applied highlight group (colors) on the cloaking, see `:h highlight`.
|
||||
'';
|
||||
|
||||
cloak_length = helpers.mkNullOrOption types.ints.unsigned ''
|
||||
Provide a number if you want to hide the true length of the value.
|
||||
Applies the length of the replacement characters for all matched patterns, defaults to the
|
||||
length of the matched pattern.
|
||||
'';
|
||||
|
||||
try_all_patterns = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether it should try every pattern to find the best fit or stop after the first.
|
||||
'';
|
||||
|
||||
cloak_telescope = helpers.defaultNullOpts.mkBool true ''
|
||||
Set to true to cloak Telescope preview buffers.
|
||||
(Required feature not in 0.1.x)
|
||||
'';
|
||||
|
||||
patterns =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(types.submodule {
|
||||
options = {
|
||||
file_pattern = helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) ".env*" ''
|
||||
One or several patterns to match against.
|
||||
They should be valid autocommand patterns.
|
||||
'';
|
||||
|
||||
cloak_pattern = helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "=.+" ''
|
||||
One or several patterns to cloak.
|
||||
|
||||
Example: `[":.+" "-.+"]` for yaml files.
|
||||
'';
|
||||
|
||||
replace = helpers.mkNullOrOption types.anything ''
|
||||
A function, table or string to generate the replacement.
|
||||
The actual replacement will contain the `cloak_character` where it doesn't cover
|
||||
the original text.
|
||||
If left empty the legacy behavior of keeping the first character is retained.
|
||||
'';
|
||||
};
|
||||
})
|
||||
[
|
||||
{
|
||||
|
||||
file_pattern = ".env*";
|
||||
cloak_pattern = "=.+";
|
||||
replace = null;
|
||||
}
|
||||
]
|
||||
''
|
||||
List of pattern configurations.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
enabled = true;
|
||||
cloak_character = "*";
|
||||
highlight_group = "Comment";
|
||||
patterns = [
|
||||
{
|
||||
file_pattern = [
|
||||
".env*"
|
||||
"wrangler.toml"
|
||||
".dev.vars"
|
||||
];
|
||||
cloak_pattern = "=.+";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
94
plugins/by-name/codesnap/default.nix
Normal file
94
plugins/by-name/codesnap/default.nix
Normal file
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "codesnap";
|
||||
originalName = "codesnap.nvim";
|
||||
package = "codesnap-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
save_path = helpers.defaultNullOpts.mkStr null ''
|
||||
The save_path must be ends with `.png`, unless when you specified a directory path, CodeSnap
|
||||
will append an auto-generated filename to the specified directory path.
|
||||
|
||||
For example:
|
||||
- `save_path = "~/Pictures";`
|
||||
parsed: `"~/Pictures/CodeSnap_y-m-d_at_h:m:s.png"`
|
||||
- `save_path = "~/Pictures/foo.png";`
|
||||
parsed: `"~/Pictures/foo.png"`
|
||||
'';
|
||||
|
||||
mac_window_bar = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to display the MacOS style title bar.
|
||||
'';
|
||||
|
||||
title = helpers.defaultNullOpts.mkStr "CodeSnap.nvim" ''
|
||||
The editor title.
|
||||
'';
|
||||
|
||||
code_font_family = helpers.defaultNullOpts.mkStr "CaskaydiaCove Nerd Font" ''
|
||||
Which font to use for the code.
|
||||
'';
|
||||
|
||||
watermark_font_family = helpers.defaultNullOpts.mkStr "Pacifico" ''
|
||||
Which font to use for watermarks.
|
||||
'';
|
||||
|
||||
watermark = helpers.defaultNullOpts.mkStr "CodeSnap.nvim" ''
|
||||
Wartermark of the code snapshot.
|
||||
'';
|
||||
|
||||
bg_theme = helpers.defaultNullOpts.mkStr "default" ''
|
||||
Background theme name.
|
||||
|
||||
Check the [upstream README](https://github.com/mistricky/codesnap.nvim?tab=readme-ov-file#custom-background)
|
||||
for available options.
|
||||
'';
|
||||
|
||||
bg_color = helpers.defaultNullOpts.mkStr' {
|
||||
pluginDefault = null;
|
||||
example = "#535c68";
|
||||
description = ''
|
||||
If you prefer solid color background, you can set bg_color to your preferred color.
|
||||
'';
|
||||
};
|
||||
|
||||
breadcrumbs_separator = helpers.defaultNullOpts.mkStr "/" ''
|
||||
Separator for breadcrumbs.
|
||||
The CodeSnap.nvim uses `/` as the separator of the file path by default, of course, you can
|
||||
specify any symbol you prefer as the custom separator.
|
||||
'';
|
||||
|
||||
has_breadcrumbs = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to display the current snapshot file path.
|
||||
'';
|
||||
|
||||
has_line_number = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to display line numbers.
|
||||
'';
|
||||
|
||||
show_workspace = helpers.defaultNullOpts.mkBool false ''
|
||||
Breadcrumbs hide the workspace name by default, if you want to display workspace in
|
||||
breadcrumbs, you can just set this option to `true`.
|
||||
'';
|
||||
|
||||
min_width = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Minimum width for the snapshot.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
save_path = "~/Pictures/Screenshots/";
|
||||
mac_window_bar = true;
|
||||
title = "CodeSnap.nvim";
|
||||
watermark = "";
|
||||
breadcrumbs_separator = "/";
|
||||
has_breadcrumbs = true;
|
||||
has_line_number = false;
|
||||
};
|
||||
}
|
137
plugins/by-name/comment-box/default.nix
Normal file
137
plugins/by-name/comment-box/default.nix
Normal file
|
@ -0,0 +1,137 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "comment-box";
|
||||
originalName = "comment-box.nvim";
|
||||
package = "comment-box-nvim";
|
||||
description = ''
|
||||
Clarify and beautify your comments and plain text files using boxes and lines.
|
||||
'';
|
||||
|
||||
maintainers = [ lib.maintainers.elythh ];
|
||||
|
||||
settingsOptions = {
|
||||
comment_style =
|
||||
defaultNullOpts.mkEnum
|
||||
[
|
||||
"line"
|
||||
"block"
|
||||
"auto"
|
||||
]
|
||||
"line"
|
||||
''
|
||||
Select the type of comments.
|
||||
'';
|
||||
|
||||
doc_width = defaultNullOpts.mkInt 80 ''
|
||||
Width of the document.
|
||||
'';
|
||||
box_width = defaultNullOpts.mkInt 60 ''
|
||||
Width of the boxes.
|
||||
'';
|
||||
|
||||
borders = {
|
||||
top = defaultNullOpts.mkStr "─" ''
|
||||
Symbol used to draw the top border of a box.
|
||||
'';
|
||||
|
||||
bottom = defaultNullOpts.mkStr "─" ''
|
||||
Symbol used to draw the bottom border of a box.
|
||||
'';
|
||||
|
||||
left = defaultNullOpts.mkStr "│" ''
|
||||
Symbol used to draw the left border of a box.
|
||||
'';
|
||||
|
||||
right = defaultNullOpts.mkStr "│" ''
|
||||
Symbol used to draw the right border of a box.
|
||||
'';
|
||||
|
||||
top_left = defaultNullOpts.mkStr "╭" ''
|
||||
Symbol used to draw the top left corner of a box.
|
||||
'';
|
||||
|
||||
top_right = defaultNullOpts.mkStr "╮" ''
|
||||
Symbol used to draw the top right corner of a box.
|
||||
'';
|
||||
|
||||
bottom_left = defaultNullOpts.mkStr "╰" ''
|
||||
Symbol used to draw the bottom left corner of a box.
|
||||
'';
|
||||
|
||||
bottom_right = defaultNullOpts.mkStr "╯" ''
|
||||
Symbol used to draw the bottom right corner of a box.
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
line_width = defaultNullOpts.mkInt 70 ''
|
||||
Width of the lines.
|
||||
'';
|
||||
|
||||
lines = {
|
||||
line = defaultNullOpts.mkStr "─" ''
|
||||
Symbol used to draw a line.
|
||||
'';
|
||||
|
||||
line_start = defaultNullOpts.mkStr "─" ''
|
||||
Symbol used to draw the start of a line.
|
||||
'';
|
||||
|
||||
line_end = defaultNullOpts.mkStr "─" ''
|
||||
Symbol used to draw the end of a line.
|
||||
'';
|
||||
|
||||
title_left = defaultNullOpts.mkStr "─" ''
|
||||
Symbol used to draw the left border of the title.
|
||||
'';
|
||||
|
||||
title_right = defaultNullOpts.mkStr "─" ''
|
||||
Symbol used to draw the right border of the title.
|
||||
'';
|
||||
|
||||
outer_blank_lines_above = defaultNullOpts.mkBool false ''
|
||||
Insert a blank line above the box.
|
||||
'';
|
||||
|
||||
outer_blank_lines_below = defaultNullOpts.mkBool false ''
|
||||
Insert a blank line below the box.
|
||||
'';
|
||||
|
||||
inner_blank_lines = defaultNullOpts.mkBool false ''
|
||||
Insert a blank line above and below the text.
|
||||
'';
|
||||
|
||||
line_blank_line_above = defaultNullOpts.mkBool false ''
|
||||
Insert a blank line above the line.
|
||||
'';
|
||||
|
||||
line_blank_line_below = defaultNullOpts.mkBool false ''
|
||||
Insert a blank line below the line.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
comment_style = "block";
|
||||
doc_width = 100;
|
||||
box_width = 120;
|
||||
borders = {
|
||||
top_left = "X";
|
||||
top_right = "X";
|
||||
bottom_left = "X";
|
||||
bottom_right = "X";
|
||||
};
|
||||
line_width = 40;
|
||||
lines = {
|
||||
line = "*";
|
||||
};
|
||||
outer_blank_lines_below = true;
|
||||
inner_blank_lines = true;
|
||||
};
|
||||
}
|
243
plugins/by-name/comment/default.nix
Normal file
243
plugins/by-name/comment/default.nix
Normal file
|
@ -0,0 +1,243 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "comment";
|
||||
originalName = "Comment.nvim";
|
||||
luaName = "Comment";
|
||||
package = "comment-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-24: remove 2024-05-24
|
||||
imports =
|
||||
let
|
||||
oldPluginPath = [
|
||||
"plugins"
|
||||
"comment-nvim"
|
||||
];
|
||||
newPluginPath = [
|
||||
"plugins"
|
||||
"comment"
|
||||
];
|
||||
settingsPath = newPluginPath ++ [ "settings" ];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (oldPluginPath ++ [ "enable" ]) (newPluginPath ++ [ "enable" ]))
|
||||
(mkRenamedOptionModule (oldPluginPath ++ [ "package" ]) (newPluginPath ++ [ "package" ]))
|
||||
(mkRenamedOptionModule (oldPluginPath ++ [ "padding" ]) (settingsPath ++ [ "padding" ]))
|
||||
(mkRenamedOptionModule (oldPluginPath ++ [ "sticky" ]) (settingsPath ++ [ "sticky" ]))
|
||||
(mkRenamedOptionModule (oldPluginPath ++ [ "ignore" ]) (settingsPath ++ [ "ignore" ]))
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
oldPluginPath
|
||||
++ [
|
||||
"toggler"
|
||||
"line"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"toggler"
|
||||
"line"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
oldPluginPath
|
||||
++ [
|
||||
"toggler"
|
||||
"block"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"toggler"
|
||||
"block"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
oldPluginPath
|
||||
++ [
|
||||
"opleader"
|
||||
"line"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"opleader"
|
||||
"line"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
oldPluginPath
|
||||
++ [
|
||||
"opleader"
|
||||
"block"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"opleader"
|
||||
"block"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
oldPluginPath
|
||||
++ [
|
||||
"mappings"
|
||||
"basic"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"mappings"
|
||||
"basic"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
oldPluginPath
|
||||
++ [
|
||||
"mappings"
|
||||
"extra"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"mappings"
|
||||
"extra"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRemovedOptionModule (
|
||||
oldPluginPath
|
||||
++ [
|
||||
"mappings"
|
||||
"extended"
|
||||
]
|
||||
) "This option has been removed upstream.")
|
||||
(mkRenamedOptionModule (oldPluginPath ++ [ "preHook" ]) (settingsPath ++ [ "pre_hook" ]))
|
||||
(mkRenamedOptionModule (oldPluginPath ++ [ "postHook" ]) (settingsPath ++ [ "post_hook" ]))
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
padding = helpers.defaultNullOpts.mkBool true ''
|
||||
Add a space b/w comment and the line.
|
||||
'';
|
||||
|
||||
sticky = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the cursor should stay at its position.
|
||||
'';
|
||||
|
||||
ignore = helpers.mkNullOrStr ''
|
||||
Lines to be ignored while (un)comment.
|
||||
'';
|
||||
|
||||
toggler = {
|
||||
line = helpers.defaultNullOpts.mkStr "gcc" ''
|
||||
Line-comment toggle keymap in NORMAL mode.
|
||||
'';
|
||||
|
||||
block = helpers.defaultNullOpts.mkStr "gbc" ''
|
||||
Block-comment toggle keymap in NORMAL mode.
|
||||
'';
|
||||
};
|
||||
|
||||
opleader = {
|
||||
line = helpers.defaultNullOpts.mkStr "gc" ''
|
||||
Line-comment operator-pending keymap in NORMAL and VISUAL mode.
|
||||
'';
|
||||
|
||||
block = helpers.defaultNullOpts.mkStr "gb" ''
|
||||
Block-comment operator-pending keymap in NORMAL and VISUAL mode.
|
||||
'';
|
||||
};
|
||||
|
||||
extra = {
|
||||
above = helpers.defaultNullOpts.mkStr "gcO" ''
|
||||
Add comment on the line above.
|
||||
'';
|
||||
|
||||
below = helpers.defaultNullOpts.mkStr "gco" ''
|
||||
Add comment on the line below.
|
||||
'';
|
||||
|
||||
eol = helpers.defaultNullOpts.mkStr "gcA" ''
|
||||
Add comment at the end of line.
|
||||
'';
|
||||
};
|
||||
|
||||
mappings =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either (enum [ false ]) (submodule {
|
||||
options = {
|
||||
basic = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable operator-pending mappings (`gcc`, `gbc`, `gc[count]{motion}`, `gb[count]{motion}`).
|
||||
'';
|
||||
|
||||
extra = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable extra mappings (`gco`, `gcO`, `gcA`).
|
||||
'';
|
||||
};
|
||||
})
|
||||
)
|
||||
{
|
||||
basic = true;
|
||||
extra = true;
|
||||
}
|
||||
''
|
||||
Enables keybindings.
|
||||
NOTE: If given 'false', then the plugin won't create any mappings.
|
||||
'';
|
||||
|
||||
pre_hook = helpers.mkNullOrLuaFn ''
|
||||
Lua function called before (un)comment.
|
||||
'';
|
||||
|
||||
post_hook = helpers.mkNullOrLuaFn ''
|
||||
Lua function called after (un)comment.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
ignore = "^const(.*)=(%s?)%((.*)%)(%s?)=>";
|
||||
toggler = {
|
||||
line = "gcc";
|
||||
block = "gbc";
|
||||
};
|
||||
opleader = {
|
||||
line = "gc";
|
||||
block = "gb";
|
||||
};
|
||||
pre_hook = "require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook()";
|
||||
post_hook = ''
|
||||
function(ctx)
|
||||
if ctx.range.srow == ctx.range.erow then
|
||||
-- do something with the current line
|
||||
else
|
||||
-- do something with lines range
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
29
plugins/by-name/commentary/default.nix
Normal file
29
plugins/by-name/commentary/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.commentary;
|
||||
in
|
||||
{
|
||||
# TODO Add support for additional filetypes. This requires autocommands!
|
||||
|
||||
options = {
|
||||
plugins.commentary = {
|
||||
enable = mkEnableOption "commentary";
|
||||
|
||||
package = lib.mkPackageOption pkgs "commentary" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"vim-commentary"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; };
|
||||
}
|
256
plugins/by-name/competitest/default.nix
Normal file
256
plugins/by-name/competitest/default.nix
Normal file
|
@ -0,0 +1,256 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "competitest";
|
||||
originalName = "competitest.nvim";
|
||||
package = "competitest-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.svl ];
|
||||
|
||||
settingsOptions = {
|
||||
local_config_file_name = helpers.defaultNullOpts.mkStr ".competitest.lua" ''
|
||||
You can use a different configuration for every different folder.
|
||||
See [local configuration](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#local-configuration).
|
||||
'';
|
||||
|
||||
save_current_file = helpers.defaultNullOpts.mkBool true ''
|
||||
If true save current file before running testcases.
|
||||
'';
|
||||
|
||||
save_all_files = helpers.defaultNullOpts.mkBool false ''
|
||||
If true save all the opened files before running testcases.
|
||||
'';
|
||||
|
||||
compile_directory = helpers.defaultNullOpts.mkStr "." ''
|
||||
Execution directory of compiler, relatively to current file's path.
|
||||
'';
|
||||
|
||||
compile_command =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
exec = mkOption {
|
||||
type = str;
|
||||
description = "Command to execute";
|
||||
};
|
||||
args = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Arguments to the command.
|
||||
'';
|
||||
};
|
||||
})
|
||||
)
|
||||
''
|
||||
Configure the command used to compile code for every different language, see
|
||||
[here](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#customize-compile-and-run-commands).
|
||||
'';
|
||||
|
||||
running_directory = helpers.defaultNullOpts.mkStr "." ''
|
||||
Execution directory of your solutions, relatively to current file's path.
|
||||
'';
|
||||
|
||||
run_command =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
exec = mkOption {
|
||||
type = str;
|
||||
description = "Command to execute.";
|
||||
};
|
||||
args = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Arguments to the command.
|
||||
'';
|
||||
};
|
||||
})
|
||||
)
|
||||
''
|
||||
Configure the command used to run your solutions for every different language, see
|
||||
[here](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#customize-compile-and-run-commands).
|
||||
'';
|
||||
|
||||
multiple_testing = helpers.defaultNullOpts.mkInt (-1) ''
|
||||
How many testcases to run at the same time
|
||||
* Set it to -1 to make the most of the amount of available parallelism.
|
||||
Often the number of testcases run at the same time coincides with the number of CPUs.
|
||||
* Set it to 0 if you want to run all the testcases together.
|
||||
* Set it to any positive integer to run that number of testcases contemporarily.
|
||||
'';
|
||||
|
||||
maximum_time = helpers.defaultNullOpts.mkInt 5000 ''
|
||||
Maximum time, in milliseconds, given to processes.
|
||||
If it's exceeded process will be killed.
|
||||
'';
|
||||
|
||||
output_compare_method =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either (enum [
|
||||
"exact"
|
||||
"squish"
|
||||
]) helpers.nixvimTypes.rawLua
|
||||
)
|
||||
"squish"
|
||||
''
|
||||
How given output (stdout) and expected output should be compared.
|
||||
It can be a string, representing the method to use, or a custom function.
|
||||
Available options follows:
|
||||
* "exact": character by character comparison.
|
||||
* "squish": compare stripping extra white spaces and newlines.
|
||||
* custom function: you can use a function accepting two arguments, two strings
|
||||
representing output and expected output. It should return true if the given
|
||||
output is acceptable, false otherwise.
|
||||
'';
|
||||
|
||||
view_output_diff = helpers.defaultNullOpts.mkBool false ''
|
||||
View diff between actual output and expected output in their respective windows.
|
||||
'';
|
||||
|
||||
testcases_directory = helpers.defaultNullOpts.mkStr "." ''
|
||||
Where testcases files are located, relatively to current file's path.
|
||||
'';
|
||||
|
||||
testcases_use_single_file = helpers.defaultNullOpts.mkBool false ''
|
||||
If true testcases will be stored in a single file instead of using multiple text files.
|
||||
If you want to change the way already existing testcases are stored see
|
||||
[conversion](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#convert-testcases).
|
||||
'';
|
||||
|
||||
testcases_auto_detect_storage = helpers.defaultNullOpts.mkBool true ''
|
||||
If true testcases storage method will be detected automatically.
|
||||
When both text files and single file are available, testcases will be loaded according
|
||||
to the preference specified in `testcases_use_single_file`.
|
||||
'';
|
||||
|
||||
testcases_single_file_format = helpers.defaultNullOpts.mkStr "$(FNOEXT).testcases" ''
|
||||
String representing how single testcases files should be named
|
||||
(see [file-format modifiers](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#file-format-modifiers)).
|
||||
'';
|
||||
|
||||
testcases_input_file_format = helpers.defaultNullOpts.mkStr "$(FNOEXT)_input$(TCNUM).txt" ''
|
||||
String representing how testcases input files should be named
|
||||
(see [file-format modifiers](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#file-format-modifiers)).
|
||||
'';
|
||||
|
||||
testcases_output_file_format = helpers.defaultNullOpts.mkStr "$(FNOEXT)_output$(TCNUM).txt" ''
|
||||
String representing how testcases output files should be named
|
||||
(see [file-format modifiers](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#file-format-modifiers)).
|
||||
'';
|
||||
|
||||
companion_port = helpers.defaultNullOpts.mkInt 27121 ''
|
||||
Competitive companion port number.
|
||||
'';
|
||||
|
||||
receive_print_message = helpers.defaultNullOpts.mkBool true ''
|
||||
If true notify user that plugin is ready to receive testcases, problems and
|
||||
contests or that they have just been received.
|
||||
'';
|
||||
|
||||
template_file =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
oneOf [
|
||||
(enum [ false ])
|
||||
str
|
||||
(attrsOf str)
|
||||
]
|
||||
)
|
||||
''
|
||||
Templates to use when creating source files for received problems or contests.
|
||||
Can be one of the following:
|
||||
* false: do not use templates.
|
||||
* string with
|
||||
[file-format modifiers](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#file-format-modifiers):
|
||||
useful when templates for different file types have a regular file naming.
|
||||
* table with paths: table associating file extension to template file.
|
||||
'';
|
||||
|
||||
evaluate_template_modifiers = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to evaluate
|
||||
[receive modifiers](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#receive-modifiers)
|
||||
inside a template file or not.
|
||||
'';
|
||||
|
||||
date_format = helpers.defaultNullOpts.mkStr "%c" ''
|
||||
String used to format `$(DATE)` modifier (see
|
||||
[receive modifiers](https://github.com/xeluxee/competitest.nvim?tab=readme-ov-file#receive-modifiers)).
|
||||
The string should follow the formatting rules as per Lua's
|
||||
`[os.date](https://www.lua.org/pil/22.1.html)` function.
|
||||
'';
|
||||
|
||||
received_files_extension = helpers.defaultNullOpts.mkStr "cpp" ''
|
||||
Default file extension for received problems.
|
||||
'';
|
||||
|
||||
received_problems_path = helpers.defaultNullOpts.mkStr "$(CWD)/$(PROBLEM).$(FEXT)" ''
|
||||
Path where received problems (not contests) are stored.
|
||||
Can be one of the following:
|
||||
* string with receive modifiers.
|
||||
* function: function accepting two arguments, a table with task details and
|
||||
a string with preferred file extension. It should return the absolute path
|
||||
to store received problem.
|
||||
'';
|
||||
|
||||
received_problems_prompt_path = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to ask user confirmation about path where the received problem is stored or not.
|
||||
'';
|
||||
|
||||
received_contests_directory = helpers.defaultNullOpts.mkStr "$(CWD)" ''
|
||||
Directory where received contests are stored. It can be string or function,
|
||||
exactly as `received_problems_path`.
|
||||
'';
|
||||
|
||||
received_contests_problems_path = helpers.defaultNullOpts.mkStr "$(PROBLEM).$(FEXT)" ''
|
||||
Relative path from contest root directory, each problem of a received contest
|
||||
is stored following this option. It can be string or function, exactly as `received_problems_path`.
|
||||
'';
|
||||
|
||||
received_contests_prompt_directory = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to ask user confirmation about the directory where received contests are stored or not.
|
||||
'';
|
||||
|
||||
received_contests_prompt_extension = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to ask user confirmation about what file extension to use when receiving a contest or not.
|
||||
'';
|
||||
|
||||
open_received_problems = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically open source files when receiving a single problem.
|
||||
'';
|
||||
|
||||
open_received_contests = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically open source files when receiving a contest.
|
||||
'';
|
||||
|
||||
replace_received_testcases = helpers.defaultNullOpts.mkBool false ''
|
||||
This option applies when receiving only testcases. If true replace existing
|
||||
testcases with received ones, otherwise ask user what to do.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
received_problems_path = "$(HOME)/cp/$(JUDGE)/$(CONTEST)/$(PROBLEM)/main.$(FEXT)";
|
||||
template_file = "$(HOME)/cp/templates/template.$(FEXT)";
|
||||
evaluate_template_modifiers = true;
|
||||
compile_command = {
|
||||
cpp = {
|
||||
exec = "g++";
|
||||
args = [
|
||||
"-DLOCAL"
|
||||
"$(FNAME)"
|
||||
"-o"
|
||||
"$(FNOEXT)"
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
25
plugins/by-name/conjure/default.nix
Normal file
25
plugins/by-name/conjure/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.conjure;
|
||||
in
|
||||
{
|
||||
options.plugins.conjure = {
|
||||
enable = mkEnableOption "Conjure";
|
||||
|
||||
package = lib.mkPackageOption pkgs "conjure" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"conjure"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; };
|
||||
}
|
288
plugins/by-name/coverage/default.nix
Normal file
288
plugins/by-name/coverage/default.nix
Normal file
|
@ -0,0 +1,288 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.coverage;
|
||||
|
||||
keymapsDef = {
|
||||
coverage = {
|
||||
command = "";
|
||||
description = "Loads a coverage report and immediately displays the coverage signs.";
|
||||
};
|
||||
load = {
|
||||
command = "Load";
|
||||
description = "Loads a coverage report but does not display the coverage signs.";
|
||||
};
|
||||
show = {
|
||||
command = "Show";
|
||||
description = ''
|
||||
Shows the coverage signs.
|
||||
Must call `:Coverage` or `:CoverageLoad` first.
|
||||
'';
|
||||
};
|
||||
hide = {
|
||||
command = "Hide";
|
||||
description = ''
|
||||
Hides the coverage signs.
|
||||
Must call `:Coverage` or `:CoverageLoad` first.
|
||||
'';
|
||||
};
|
||||
toggle = {
|
||||
command = "Toggle";
|
||||
description = ''
|
||||
Toggles the coverage signs.
|
||||
Must call `:Coverage` or `:CoverageLoad` first.
|
||||
'';
|
||||
};
|
||||
clear = {
|
||||
command = "Clear";
|
||||
description = ''
|
||||
Unloads the cached coverage signs.
|
||||
`:Coverage` or `:CoverageLoad` must be called again to relad the data.
|
||||
'';
|
||||
};
|
||||
summary = {
|
||||
command = "Summary";
|
||||
description = "Displays a coverage summary report in a floating window.";
|
||||
};
|
||||
loadLcov = {
|
||||
command = "LoadLcov";
|
||||
description = ''
|
||||
Loads a coverage report from an lcov file but does not display the coverage signs.
|
||||
Uses the lcov file configuration option.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.coverage = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-coverage";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-coverage" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-coverage"
|
||||
];
|
||||
};
|
||||
|
||||
keymapsSilent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether nvim-coverage keymaps should be silent";
|
||||
default = false;
|
||||
};
|
||||
|
||||
keymaps = mapAttrs (
|
||||
optionName: properties: helpers.mkNullOrOption types.str properties.description
|
||||
) keymapsDef;
|
||||
|
||||
autoReload = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, the `coverage_file` for a language will be watched for changes after executing
|
||||
`:CoverageLoad` or `coverage.load()`.
|
||||
The file watcher will be stopped after executing `:CoverageClear` or `coverage.clear()`.
|
||||
'';
|
||||
|
||||
autoReloadTimeoutMs = helpers.defaultNullOpts.mkInt 500 ''
|
||||
The number of milliseconds to wait before auto-reloading coverage after detecting a change.
|
||||
'';
|
||||
|
||||
commands = helpers.defaultNullOpts.mkBool true "If true, create commands.";
|
||||
|
||||
highlights = {
|
||||
covered = helpers.defaultNullOpts.mkAttributeSet {
|
||||
fg = "#B7F071";
|
||||
} "Highlight group for covered signs.";
|
||||
|
||||
uncovered = helpers.defaultNullOpts.mkAttributeSet {
|
||||
fg = "#F07178";
|
||||
} "Highlight group for uncovered signs.";
|
||||
|
||||
partial = helpers.defaultNullOpts.mkAttributeSet {
|
||||
fg = "#AA71F0";
|
||||
} "Highlight group for partial coverage signs.";
|
||||
|
||||
summaryBorder = helpers.defaultNullOpts.mkAttributeSet {
|
||||
link = "FloatBorder";
|
||||
} "Border highlight group of the summary pop-up.";
|
||||
|
||||
summaryNormal = helpers.defaultNullOpts.mkAttributeSet {
|
||||
link = "NormalFloat";
|
||||
} "Normal text highlight group of the summary pop-up.";
|
||||
|
||||
summaryCursorLine = helpers.defaultNullOpts.mkAttributeSet {
|
||||
link = "CursorLine";
|
||||
} "Cursor line highlight group of the summary pop-up.";
|
||||
|
||||
summaryHeader = helpers.defaultNullOpts.mkAttributeSet {
|
||||
style = "bold,underline";
|
||||
sp = "bg";
|
||||
} "Header text highlight group of the summary pop-up.";
|
||||
|
||||
summaryPass = helpers.defaultNullOpts.mkAttributeSet {
|
||||
link = "CoverageCovered";
|
||||
} "Pass text highlight group of the summary pop-up.";
|
||||
|
||||
summaryFail = helpers.defaultNullOpts.mkAttributeSet {
|
||||
link = "CoverageUncovered";
|
||||
} "Fail text highlight group of the summary pop-up.";
|
||||
};
|
||||
|
||||
loadCoverageCb = helpers.defaultNullOpts.mkLuaFn' {
|
||||
description = "A lua function that will be called when a coverage file is loaded.";
|
||||
pluginDefault = "nil";
|
||||
example = ''
|
||||
function(ftype)
|
||||
vim.notify("Loaded " .. ftype .. " coverage")
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
signs =
|
||||
mapAttrs
|
||||
(
|
||||
optionName:
|
||||
{
|
||||
prettyName ? optionName,
|
||||
defaults,
|
||||
}:
|
||||
{
|
||||
hl = helpers.defaultNullOpts.mkStr defaults.hl "The highlight group used for ${prettyName} signs.";
|
||||
|
||||
text = helpers.defaultNullOpts.mkStr defaults.text "The text used for ${prettyName} signs.";
|
||||
}
|
||||
)
|
||||
{
|
||||
covered = {
|
||||
defaults = {
|
||||
hl = "CoverageCovered";
|
||||
text = "▎";
|
||||
};
|
||||
};
|
||||
uncovered = {
|
||||
defaults = {
|
||||
hl = "CoverageUncovered";
|
||||
text = "▎";
|
||||
};
|
||||
};
|
||||
partial = {
|
||||
prettyName = "partial coverage";
|
||||
defaults = {
|
||||
hl = "CoveragePartial";
|
||||
text = "▎";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
signGroup = helpers.defaultNullOpts.mkStr "coverage" ''
|
||||
Name of the sign group used when placing the signs.
|
||||
See `:h sign-group`.
|
||||
'';
|
||||
|
||||
summary = {
|
||||
widthPercentage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0
|
||||
1.0
|
||||
) 0.7 "Width of the pop-up window.";
|
||||
|
||||
heightPercentage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0
|
||||
1.0
|
||||
) 0.5 "Height of the pop-up window.";
|
||||
|
||||
borders = mapAttrs (optionName: default: helpers.defaultNullOpts.mkStr default "") {
|
||||
topleft = "╭";
|
||||
topright = "╮";
|
||||
top = "─";
|
||||
left = "│";
|
||||
right = "│";
|
||||
botleft = "╰";
|
||||
botright = "╯";
|
||||
bot = "─";
|
||||
highlight = "Normal:CoverageSummaryBorder";
|
||||
};
|
||||
|
||||
minCoverage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0 100) 80 ''
|
||||
Minimum coverage percentage.
|
||||
Values below this are highlighted with the fail group, values above are highlighted with
|
||||
the pass group.
|
||||
'';
|
||||
};
|
||||
|
||||
lang = helpers.defaultNullOpts.mkAttributeSet' {
|
||||
description = ''
|
||||
Each key corresponds with the `filetype` of the language and maps to an attrs of
|
||||
configuration values that differ.
|
||||
|
||||
See plugin documentation for language specific options.
|
||||
'';
|
||||
|
||||
example = {
|
||||
python = {
|
||||
coverage_file = ".coverage";
|
||||
coverage_command = "coverage json --fail-under=0 -q -o -";
|
||||
};
|
||||
ruby = {
|
||||
coverage_file = "coverage/coverage.json";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lcovFile = helpers.mkNullOrOption types.str "File that the plugin will try to read lcov coverage from.";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
auto_reload = autoReload;
|
||||
auto_reload_timeout_ms = autoReloadTimeoutMs;
|
||||
inherit commands;
|
||||
highlights = with highlights; {
|
||||
inherit covered uncovered partial;
|
||||
summary_border = summaryBorder;
|
||||
summary_normal = summaryNormal;
|
||||
summary_cursor_line = summaryCursorLine;
|
||||
summary_header = summaryHeader;
|
||||
summary_pass = summaryPass;
|
||||
summary_fail = summaryFail;
|
||||
};
|
||||
load_coverage_cb = loadCoverageCb;
|
||||
inherit signs;
|
||||
sign_group = signGroup;
|
||||
summary = with summary; {
|
||||
width_percentage = widthPercentage;
|
||||
height_percentage = heightPercentage;
|
||||
inherit borders;
|
||||
min_coverage = minCoverage;
|
||||
};
|
||||
inherit lang;
|
||||
lcov_file = lcovFile;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("coverage").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
|
||||
keymaps = flatten (
|
||||
mapAttrsToList (
|
||||
optionName: properties:
|
||||
let
|
||||
key = cfg.keymaps.${optionName};
|
||||
in
|
||||
optional (key != null) {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = ":Coverage${properties.command}<CR>";
|
||||
options.silent = cfg.keymapsSilent;
|
||||
}
|
||||
) keymapsDef
|
||||
);
|
||||
};
|
||||
}
|
61
plugins/by-name/cursorline/default.nix
Normal file
61
plugins/by-name/cursorline/default.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cursorline;
|
||||
in
|
||||
{
|
||||
options.plugins.cursorline = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-cursorline";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-cursorline" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-cursorline"
|
||||
];
|
||||
};
|
||||
|
||||
cursorline = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Show / hide cursorline in connection with cursor moving.";
|
||||
|
||||
timeout = helpers.defaultNullOpts.mkInt 1000 "Time (in ms) after which the cursorline appears.";
|
||||
|
||||
number = helpers.defaultNullOpts.mkBool false "Whether to also highlight the line number.";
|
||||
};
|
||||
cursorword = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Underlines the word under the cursor.";
|
||||
|
||||
minLength = helpers.defaultNullOpts.mkInt 3 "Minimum length for underlined words.";
|
||||
|
||||
hl = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
underline = true;
|
||||
} "Highliht definition map for cursorword highlighting.";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options = {
|
||||
cursorline = with cfg.cursorline; {
|
||||
inherit enable timeout number;
|
||||
};
|
||||
cursorword = with cfg.cursorword; {
|
||||
inherit enable;
|
||||
min_length = minLength;
|
||||
inherit hl;
|
||||
};
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-cursorline').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
437
plugins/by-name/dashboard/default.nix
Normal file
437
plugins/by-name/dashboard/default.nix
Normal file
|
@ -0,0 +1,437 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "dashboard";
|
||||
originalName = "dashboard-nvim";
|
||||
package = "dashboard-nvim";
|
||||
|
||||
maintainers = [ maintainers.MattSturgeon ];
|
||||
|
||||
# TODO introduced 2024-05-30: remove 2024-09-01
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"dashboard"
|
||||
];
|
||||
in
|
||||
[
|
||||
(mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "sessionDirectory" ]
|
||||
) "This plugin no longer has session support.")
|
||||
]
|
||||
++ (mapAttrsToList
|
||||
(
|
||||
old: new:
|
||||
mkRenamedOptionModule (basePluginPath ++ [ old ]) (basePluginPath ++ [ "settings" ] ++ new)
|
||||
)
|
||||
{
|
||||
header = [
|
||||
"config"
|
||||
"header"
|
||||
];
|
||||
footer = [
|
||||
"config"
|
||||
"footer"
|
||||
];
|
||||
center = [
|
||||
"config"
|
||||
"shortcut"
|
||||
];
|
||||
hideStatusline = [
|
||||
"hide"
|
||||
"statusline"
|
||||
];
|
||||
hideTabline = [
|
||||
"hide"
|
||||
"tabline"
|
||||
];
|
||||
}
|
||||
)
|
||||
++ (mapAttrsToList
|
||||
(
|
||||
old: new:
|
||||
mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"preview"
|
||||
old
|
||||
]
|
||||
)
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"preview"
|
||||
new
|
||||
]
|
||||
)
|
||||
)
|
||||
{
|
||||
command = "command";
|
||||
file = "file_path";
|
||||
height = "file_height";
|
||||
width = "file_width";
|
||||
}
|
||||
);
|
||||
|
||||
settingsExample = {
|
||||
theme = "hyper";
|
||||
change_to_vcs_root = true;
|
||||
|
||||
config = {
|
||||
week_header.enable = true;
|
||||
project.enable = false;
|
||||
mru.limit = 20;
|
||||
|
||||
header = [
|
||||
"███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||
"████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||
"██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||
"██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||
"██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||
"╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||
];
|
||||
|
||||
shortcut = [
|
||||
{
|
||||
icon = " ";
|
||||
icon_hl = "@variable";
|
||||
desc = "Files";
|
||||
group = "Label";
|
||||
action.__raw = "function(path) vim.cmd('Telescope find_files') end";
|
||||
key = "f";
|
||||
}
|
||||
{
|
||||
desc = " Apps";
|
||||
group = "DiagnosticHint";
|
||||
action = "Telescope app";
|
||||
key = "a";
|
||||
}
|
||||
{
|
||||
desc = " dotfiles";
|
||||
group = "Number";
|
||||
action = "Telescope dotfiles";
|
||||
key = "d";
|
||||
}
|
||||
];
|
||||
|
||||
footer = [ "Made with ❤️" ];
|
||||
};
|
||||
};
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
requiresTheme = theme: ''
|
||||
**Note**: This option is only compatible with the "${theme}" theme.
|
||||
'';
|
||||
|
||||
# Make an "action" submodule type, as used by `settings.config.shortcut` and `settings.config.center`
|
||||
mkActionType =
|
||||
extraOptions:
|
||||
types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
|
||||
options = {
|
||||
icon = helpers.defaultNullOpts.mkStr "" ''
|
||||
The icon to display with this action.
|
||||
'';
|
||||
|
||||
icon_hl = helpers.defaultNullOpts.mkStr "DashboardIcon" ''
|
||||
The highlight group for the icon.
|
||||
'';
|
||||
|
||||
desc = helpers.defaultNullOpts.mkStr "" ''
|
||||
The action's description, shown next to the icon.
|
||||
'';
|
||||
|
||||
desc_hl = helpers.defaultNullOpts.mkStr "DashboardDesc" ''
|
||||
The highlight group to use for the description.
|
||||
'';
|
||||
|
||||
key = helpers.defaultNullOpts.mkStr "" ''
|
||||
Shortcut key available in the dashboard buffer.
|
||||
|
||||
**Note**: this will not create an actual keymap.
|
||||
'';
|
||||
|
||||
key_hl = helpers.defaultNullOpts.mkStr "DashboardKey" ''
|
||||
The highlight group to use for the key.
|
||||
'';
|
||||
|
||||
action = helpers.defaultNullOpts.mkStr "" ''
|
||||
Action done when you press key. Can be a command or a function.
|
||||
|
||||
To use a lua function, pass a raw type instead of a string, e.g:
|
||||
|
||||
```nix
|
||||
action.__raw = "function(path) vim.cmd('Telescope find_files cwd=' .. path) end";
|
||||
```
|
||||
|
||||
Is equivialent to:
|
||||
|
||||
```nix
|
||||
action = "Telescope find_files cwd=";
|
||||
```
|
||||
'';
|
||||
} // extraOptions;
|
||||
};
|
||||
in
|
||||
{
|
||||
theme =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"hyper"
|
||||
"doom"
|
||||
]
|
||||
''
|
||||
Dashboard comes with two themes, that each have their own distinct config options.
|
||||
|
||||
- "hyper" includes a header, custom shortcuts, recent projects, recent files, and a footer.
|
||||
- "doom" is simpler, consisting of a header, center, and footer.
|
||||
|
||||
Some options have a _note_ stating which theme they relate to.
|
||||
'';
|
||||
|
||||
shortcut_type =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"letter"
|
||||
"number"
|
||||
]
|
||||
''
|
||||
The shortcut type.
|
||||
'';
|
||||
|
||||
change_to_vcs_root = helpers.defaultNullOpts.mkBool false ''
|
||||
When opening a file in the "hyper" theme's "recent files" list (`mru`), vim will change to the root of vcs.
|
||||
'';
|
||||
|
||||
config = {
|
||||
# TODO double check if this affects "doom" or not
|
||||
disable_move = helpers.defaultNullOpts.mkBool false ''
|
||||
Disable movement keymaps in the dashboard buffer.
|
||||
|
||||
Specifically, the following keymaps are disabled:
|
||||
|
||||
`w`, `f`, `b`, `h`, `j`, `k`, `l`, `<Up>`, `<Down>`, `<Left>`, `<Right>`
|
||||
'';
|
||||
|
||||
packages.enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Show how many vim plugins are loaded.
|
||||
|
||||
${requiresTheme "hyper"}
|
||||
'';
|
||||
|
||||
week_header = {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to use a header based on the current day of the week,
|
||||
instead of the default "DASHBOARD" header.
|
||||
|
||||
A subheading showing the current time is also displayed.
|
||||
'';
|
||||
|
||||
concat = helpers.defaultNullOpts.mkStr "" ''
|
||||
Additional text to append at the end of the time line.
|
||||
'';
|
||||
|
||||
append = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Additional header lines to append after the the time line.
|
||||
'';
|
||||
};
|
||||
|
||||
header =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
""
|
||||
" ██████╗ █████╗ ███████╗██╗ ██╗██████╗ ██████╗ █████╗ ██████╗ ██████╗ "
|
||||
" ██╔══██╗██╔══██╗██╔════╝██║ ██║██╔══██╗██╔═══██╗██╔══██╗██╔══██╗██╔══██╗ "
|
||||
" ██║ ██║███████║███████╗███████║██████╔╝██║ ██║███████║██████╔╝██║ ██║ "
|
||||
" ██║ ██║██╔══██║╚════██║██╔══██║██╔══██╗██║ ██║██╔══██║██╔══██╗██║ ██║ "
|
||||
" ██████╔╝██║ ██║███████║██║ ██║██████╔╝╚██████╔╝██║ ██║██║ ██║██████╔╝ "
|
||||
" ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ "
|
||||
""
|
||||
]
|
||||
''
|
||||
The header text, displayed at the top of the buffer.
|
||||
'';
|
||||
|
||||
footer = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
The footer text, displayed at the bottom of the buffer.
|
||||
'';
|
||||
|
||||
# TODO: Once #1618 is fixed, we can switch to `defaultNullOpts.mkAttrs'`,
|
||||
shortcut = helpers.mkNullOrOption' {
|
||||
description = ''
|
||||
Shortcut actions to be added to the "hyper" theme.
|
||||
|
||||
${requiresTheme "hyper"}
|
||||
'';
|
||||
|
||||
example = [
|
||||
{
|
||||
icon = " ";
|
||||
icon_hl = "@variable";
|
||||
desc = "Files";
|
||||
group = "Label";
|
||||
action.__raw = "function(path) vim.cmd('Telescope find_files') end";
|
||||
key = "f";
|
||||
}
|
||||
{
|
||||
desc = " Apps";
|
||||
group = "DiagnosticHint";
|
||||
action = "Telescope app";
|
||||
key = "a";
|
||||
}
|
||||
{
|
||||
desc = " dotfiles";
|
||||
group = "Number";
|
||||
action = "Telescope dotfiles";
|
||||
key = "d";
|
||||
}
|
||||
];
|
||||
|
||||
type = types.listOf (mkActionType {
|
||||
group = helpers.defaultNullOpts.mkStr "" ''
|
||||
Highlight group used with the "hyper" theme,
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
# TODO: Once #1618 is fixed, we can switch to `defaultNullOpts.mkAttrs'`,
|
||||
center = helpers.mkNullOrOption' {
|
||||
description = ''
|
||||
Actions to be added to the center section of the "doom" theme.
|
||||
|
||||
${requiresTheme "doom"}
|
||||
'';
|
||||
|
||||
example = [
|
||||
{
|
||||
icon = " ";
|
||||
icon_hl = "Title";
|
||||
desc = "Find File ";
|
||||
desc_hl = "String";
|
||||
key = "b";
|
||||
keymap = "SPC f f";
|
||||
key_hl = "Number";
|
||||
key_format = " %s";
|
||||
action = "lua print(2)";
|
||||
}
|
||||
{
|
||||
icon = " ";
|
||||
desc = "Find Dotfiles";
|
||||
key = "f";
|
||||
keymap = "SPC f d";
|
||||
key_format = " %s";
|
||||
action.__raw = "function() print(3) end";
|
||||
}
|
||||
];
|
||||
|
||||
type = types.listOf (mkActionType {
|
||||
# TODO if `key_format` is _also_ applicable to hyper theme,
|
||||
# move the option to `mkActionList`.
|
||||
key_format = helpers.defaultNullOpts.mkStr "[%s]" ''
|
||||
Format string used when rendering the key.
|
||||
`%s` will be substituted with value of `key`.
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
project =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
Options relating to the "hyper" theme's recent projects list.
|
||||
|
||||
${requiresTheme "hyper"}
|
||||
''
|
||||
{
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to display the recent projects list.
|
||||
'';
|
||||
|
||||
limit = helpers.defaultNullOpts.mkInt 8 ''
|
||||
The maximum number of projects to list.
|
||||
'';
|
||||
|
||||
icon = helpers.defaultNullOpts.mkStr " " ''
|
||||
Icon used in the section header.
|
||||
'';
|
||||
|
||||
icon_hl = helpers.defaultNullOpts.mkStr "DashboardRecentProjectIcon" ''
|
||||
Highlight group used for the icon.
|
||||
'';
|
||||
|
||||
label = helpers.defaultNullOpts.mkStr " Recent Projects:" ''
|
||||
Text used in the section header.
|
||||
'';
|
||||
|
||||
action = helpers.defaultNullOpts.mkStr "Telescope find_files cwd=" ''
|
||||
When you press key or enter it will run this action
|
||||
'';
|
||||
};
|
||||
|
||||
mru =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
Options relating to the "hyper" theme's recent files list.
|
||||
|
||||
${requiresTheme "hyper"}
|
||||
''
|
||||
{
|
||||
limit = helpers.defaultNullOpts.mkInt 10 ''
|
||||
The maximum number of files to list.
|
||||
'';
|
||||
|
||||
icon = helpers.defaultNullOpts.mkStr " " ''
|
||||
Icon used in the section header.
|
||||
'';
|
||||
|
||||
icon_hl = helpers.defaultNullOpts.mkStr "DashboardMruIcon" ''
|
||||
Highlight group used for the icon.
|
||||
'';
|
||||
|
||||
label = helpers.defaultNullOpts.mkStr " Most Recent Files:" ''
|
||||
Text used in the section header.
|
||||
'';
|
||||
|
||||
cwd_only = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to only include files from the current working directory.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
hide = {
|
||||
statusline = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to hide the status line.
|
||||
'';
|
||||
|
||||
tabline = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to hide the status line.
|
||||
'';
|
||||
};
|
||||
|
||||
preview = {
|
||||
command = helpers.defaultNullOpts.mkStr "" ''
|
||||
Command to print file contents.
|
||||
'';
|
||||
|
||||
file_path = helpers.defaultNullOpts.mkStr null ''
|
||||
Path to preview file.
|
||||
'';
|
||||
|
||||
file_height = helpers.defaultNullOpts.mkInt 0 ''
|
||||
The height of the preview file.
|
||||
'';
|
||||
|
||||
file_width = helpers.defaultNullOpts.mkInt 0 ''
|
||||
The width of the preview file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
39
plugins/by-name/direnv/default.nix
Normal file
39
plugins/by-name/direnv/default.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
helpers,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "direnv";
|
||||
originalName = "direnv.vim";
|
||||
package = "direnv-vim";
|
||||
globalPrefix = "direnv_";
|
||||
extraPackages = [ pkgs.direnv ];
|
||||
|
||||
maintainers = [ helpers.maintainers.alisonjenkins ];
|
||||
|
||||
settingsOptions = {
|
||||
direnv_auto = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
It will not execute `:DirenvExport` automatically if the value is `0`.
|
||||
'';
|
||||
|
||||
direnv_edit_mode =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"edit"
|
||||
"split"
|
||||
"tabedit"
|
||||
"vsplit"
|
||||
]
|
||||
"edit"
|
||||
''
|
||||
Select the command to open buffers to edit. Default: 'edit'.
|
||||
'';
|
||||
|
||||
direnv_silent_load = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Stop echoing output from Direnv command.
|
||||
'';
|
||||
};
|
||||
}
|
369
plugins/by-name/dressing/default.nix
Normal file
369
plugins/by-name/dressing/default.nix
Normal file
|
@ -0,0 +1,369 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "dressing";
|
||||
originalName = "dressing.nvim";
|
||||
package = "dressing-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.AndresBermeoMarinelli ];
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
intOrRatio = with types; either ints.unsigned (numbers.between 0.0 1.0);
|
||||
in
|
||||
{
|
||||
input = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable the `vim.ui.input` implementation.
|
||||
'';
|
||||
|
||||
default_prompt = helpers.defaultNullOpts.mkStr "Input" ''
|
||||
Default prompt string for `vim.ui.input`.
|
||||
'';
|
||||
|
||||
trim_prompt = helpers.defaultNullOpts.mkBool true ''
|
||||
Trim trailing `:` from prompt.
|
||||
'';
|
||||
|
||||
title_pos =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"left"
|
||||
"right"
|
||||
"center"
|
||||
]
|
||||
''
|
||||
Position of title.
|
||||
'';
|
||||
|
||||
insert_only = helpers.defaultNullOpts.mkBool true ''
|
||||
When true, `<Esc>` will close the modal.
|
||||
'';
|
||||
|
||||
start_in_insert = helpers.defaultNullOpts.mkBool true ''
|
||||
When true, input will start in insert mode.
|
||||
'';
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "the input window" "";
|
||||
|
||||
relative =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"cursor"
|
||||
"win"
|
||||
"editor"
|
||||
]
|
||||
''
|
||||
Affects the dimensions of the window with respect to this setting.
|
||||
If 'editor' or 'win', will default to being centered.
|
||||
'';
|
||||
|
||||
prefer_width = helpers.defaultNullOpts.mkNullable intOrRatio 40 ''
|
||||
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
'';
|
||||
|
||||
width = helpers.defaultNullOpts.mkNullable intOrRatio null ''
|
||||
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
'';
|
||||
|
||||
max_width =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
|
||||
[
|
||||
140
|
||||
0.9
|
||||
]
|
||||
''
|
||||
Max width of window.
|
||||
|
||||
Can be a list of mixed types, e.g. `[140 0.9]` means "less than 140 columns or 90% of
|
||||
total."
|
||||
'';
|
||||
|
||||
min_width =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
|
||||
[
|
||||
20
|
||||
0.2
|
||||
]
|
||||
''
|
||||
Min width of window.
|
||||
|
||||
Can be a list of mixed types, e.g. `[140 0.9]` means "less than 140 columns or 90% of
|
||||
total."
|
||||
'';
|
||||
|
||||
buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
|
||||
An attribute set of neovim buffer options.
|
||||
'';
|
||||
|
||||
win_options = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
wrap = false;
|
||||
list = true;
|
||||
listchars = "precedes:...,extends:...";
|
||||
sidescrolloff = 0;
|
||||
} "An attribute set of window options.";
|
||||
|
||||
mappings =
|
||||
helpers.defaultNullOpts.mkAttrsOf (with types; attrsOf (either str (enum [ false ])))
|
||||
{
|
||||
n = {
|
||||
"<Esc>" = "Close";
|
||||
"<CR>" = "Confirm";
|
||||
};
|
||||
i = {
|
||||
"<C-c>" = "Close";
|
||||
"<CR>" = "Confirm";
|
||||
"<Up>" = "HistoryPrev";
|
||||
"<Down>" = "HistoryNext";
|
||||
};
|
||||
}
|
||||
''
|
||||
Mappings for defined modes.
|
||||
|
||||
To disable a default mapping in a specific mode, set it to `false`.
|
||||
'';
|
||||
|
||||
override = helpers.defaultNullOpts.mkLuaFn "function(conf) return conf end" ''
|
||||
Lua function that takes config that is passed to nvim_open_win.
|
||||
Used to customize the layout.
|
||||
'';
|
||||
|
||||
get_config = helpers.defaultNullOpts.mkLuaFn null ''
|
||||
This can be a function that accepts the opts parameter that is passed in to 'vim.select'
|
||||
or 'vim.input'. It must return either nil or config values to use in place of the global
|
||||
config values for that module.
|
||||
|
||||
See `:h dressing_get_config` for more info.
|
||||
'';
|
||||
};
|
||||
|
||||
select = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable the vim.ui.select implementation.
|
||||
'';
|
||||
|
||||
backend = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"telescope"
|
||||
"fzf_lua"
|
||||
"fzf"
|
||||
"builtin"
|
||||
"nui"
|
||||
] "Priority list of preferred vim.select implementations. ";
|
||||
|
||||
trim_prompt = helpers.defaultNullOpts.mkBool true ''
|
||||
Trim trailing `:` from prompt.
|
||||
'';
|
||||
|
||||
telescope =
|
||||
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; either strLua (attrsOf anything)) null
|
||||
''
|
||||
Options for telescope selector.
|
||||
|
||||
Can be a raw lua string like:
|
||||
|
||||
`telescope = \'\'require("telescope.themes").get_ivy({})\'\'`
|
||||
|
||||
or an attribute set of telescope settings.
|
||||
'';
|
||||
|
||||
fzf = {
|
||||
window = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
width = 0.5;
|
||||
height = 0.4;
|
||||
} "Window options for fzf selector. ";
|
||||
};
|
||||
|
||||
fzf_lua = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
|
||||
Options for fzf-lua selector.
|
||||
'';
|
||||
|
||||
nui = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
position = "50%";
|
||||
size = null;
|
||||
relative = "editor";
|
||||
border = {
|
||||
style = "rounded";
|
||||
};
|
||||
buf_options = {
|
||||
swapfile = false;
|
||||
filetype = "DressingSelect";
|
||||
};
|
||||
win_options = {
|
||||
winblend = 0;
|
||||
};
|
||||
max_width = 80;
|
||||
max_height = 40;
|
||||
min_width = 40;
|
||||
min_height = 10;
|
||||
} "Options for nui selector. ";
|
||||
|
||||
builtin = {
|
||||
show_numbers = helpers.defaultNullOpts.mkBool true ''
|
||||
Display numbers for options and set up keymaps.
|
||||
'';
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "the select window" "";
|
||||
|
||||
relative =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"editor"
|
||||
"win"
|
||||
"cursor"
|
||||
]
|
||||
''
|
||||
Affects the dimensions of the window with respect to this setting.
|
||||
If 'editor' or 'win', will default to being centered.
|
||||
'';
|
||||
|
||||
buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
|
||||
An attribute set of buffer options.
|
||||
'';
|
||||
|
||||
win_options = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
cursorline = true;
|
||||
cursorlineopt = "both";
|
||||
} "An attribute set of window options.";
|
||||
|
||||
width = helpers.defaultNullOpts.mkNullable intOrRatio null ''
|
||||
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
'';
|
||||
|
||||
max_width =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
|
||||
[
|
||||
140
|
||||
0.8
|
||||
]
|
||||
''
|
||||
Max width of window.
|
||||
|
||||
Can be a list of mixed types, e.g. `[140 0.8]` means "less than 140 columns or 80%
|
||||
of total."
|
||||
'';
|
||||
|
||||
min_width =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
|
||||
[
|
||||
40
|
||||
0.2
|
||||
]
|
||||
''
|
||||
Min width of window.
|
||||
|
||||
Can be a list of mixed types, e.g. `[40 0.2]` means "less than 40 columns or 20%
|
||||
of total."
|
||||
'';
|
||||
|
||||
height = helpers.defaultNullOpts.mkNullable intOrRatio null ''
|
||||
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
'';
|
||||
|
||||
max_height =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) 0.9
|
||||
''
|
||||
Max height of window.
|
||||
|
||||
Can be a list of mixed types, e.g. `[140 0.8]` means "less than 140 rows or 80%
|
||||
of total."
|
||||
'';
|
||||
|
||||
min_height =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
|
||||
[
|
||||
10
|
||||
0.2
|
||||
]
|
||||
''
|
||||
Min height of window.
|
||||
|
||||
Can be a list of mixed types, e.g. `[10 0.2]` means "less than 10 rows or 20%
|
||||
of total."
|
||||
'';
|
||||
|
||||
mappings =
|
||||
helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ]))
|
||||
{
|
||||
"<Esc>" = "Close";
|
||||
"<C-c>" = "Close";
|
||||
"<CR>" = "Confirm";
|
||||
}
|
||||
''
|
||||
Mappings in normal mode for the builtin selector.
|
||||
|
||||
To disable a default mapping in a specific mode, set it to `false`.
|
||||
'';
|
||||
|
||||
override = helpers.defaultNullOpts.mkLuaFn "function(conf) return conf end" ''
|
||||
Lua function that takes config that is passed to nvim_open_win.
|
||||
Used to customize the layout.
|
||||
'';
|
||||
};
|
||||
|
||||
format_item_override = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.strLuaFn { } ''
|
||||
Override the formatting/display for a specific "kind" when using vim.ui.select.
|
||||
For example, code actions from vim.lsp.buf.code_action use a kind="codeaction".
|
||||
You can override the format function when selecting for that kind, e.g.
|
||||
|
||||
```nix
|
||||
{
|
||||
codeaction = \'\'
|
||||
function(action_tuple)
|
||||
local title = action_tuple[2].title:gsub("\r\n", "\\r\\n")
|
||||
local client = vim.lsp.get_client_by_id(action_tuple[1])
|
||||
return string.format("%s\t[%s]", title:gsub("\n", "\\n"), client.name)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
get_config = helpers.defaultNullOpts.mkLuaFn null ''
|
||||
This can be a function that accepts the opts parameter that is passed in to 'vim.select'
|
||||
or 'vim.input'. It must return either nil or config values to use in place of the global
|
||||
config values for that module.
|
||||
|
||||
See `:h dressing_get_config` for more info.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
input = {
|
||||
enabled = true;
|
||||
mappings = {
|
||||
n = {
|
||||
"<Esc>" = "Close";
|
||||
"<CR>" = "Confirm";
|
||||
};
|
||||
i = {
|
||||
"<C-c>" = "Close";
|
||||
"<CR>" = "Confirm";
|
||||
"<Up>" = "HistoryPrev";
|
||||
"<Down>" = "HistoryNext";
|
||||
};
|
||||
};
|
||||
};
|
||||
select = {
|
||||
enabled = true;
|
||||
backend = [
|
||||
"telescope"
|
||||
"fzf_lua"
|
||||
"fzf"
|
||||
"builtin"
|
||||
"nui"
|
||||
];
|
||||
builtin = {
|
||||
mappings = {
|
||||
"<Esc>" = "Close";
|
||||
"<C-c>" = "Close";
|
||||
"<CR>" = "Confirm";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
26
plugins/by-name/easyescape/default.nix
Normal file
26
plugins/by-name/easyescape/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.easyescape;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.easyescape = {
|
||||
enable = mkEnableOption "easyescape";
|
||||
|
||||
package = lib.mkPackageOption pkgs "easyescape" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"vim-easyescape"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable { extraPlugins = [ cfg.package ]; };
|
||||
}
|
95
plugins/by-name/emmet/default.nix
Normal file
95
plugins/by-name/emmet/default.nix
Normal file
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "emmet";
|
||||
originalName = "emmet-vim";
|
||||
package = "emmet-vim";
|
||||
globalPrefix = "user_emmet_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-01: remove 2024-05-01
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [ "mode" ];
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"emmet"
|
||||
"leader"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"emmet"
|
||||
"settings"
|
||||
"leader_key"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
mode = helpers.defaultNullOpts.mkStr "a" ''
|
||||
Choose modes, in which Emmet mappings will be created.
|
||||
Default value: 'a' - all modes.
|
||||
- 'n' - normal mode.
|
||||
- 'i' - insert mode.
|
||||
- 'v' - visual mode.
|
||||
|
||||
Examples:
|
||||
- create Emmet mappings only for normal mode: `n`
|
||||
- create Emmet mappings for insert, normal and visual modes: `inv`
|
||||
- create Emmet mappings for all modes: `a`
|
||||
'';
|
||||
|
||||
leader_key = helpers.defaultNullOpts.mkStr "<C-y>" ''
|
||||
Leading keys to run Emmet functions.
|
||||
'';
|
||||
|
||||
settings = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
Emmet settings.
|
||||
|
||||
Defaults: see https://github.com/mattn/emmet-vim/blob/master/autoload/emmet.vim
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
mode = "inv";
|
||||
leader = "<C-Z>";
|
||||
settings = {
|
||||
variables = {
|
||||
lang = "ja";
|
||||
};
|
||||
html = {
|
||||
default_attributes = {
|
||||
option = {
|
||||
value = null;
|
||||
};
|
||||
textarea = {
|
||||
id = null;
|
||||
name = null;
|
||||
cols = 10;
|
||||
rows = 10;
|
||||
};
|
||||
};
|
||||
snippets = {
|
||||
"html:5" = ''
|
||||
<!DOCTYPE html>
|
||||
<html lang=\"$\{lang}\">
|
||||
<head>
|
||||
\t<meta charset=\"$\{charset}\">
|
||||
\t<title></title>
|
||||
\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
|
||||
</head>
|
||||
<body>\n\t$\{child}|\n</body>
|
||||
</html>
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
14
plugins/by-name/endwise/default.nix
Normal file
14
plugins/by-name/endwise/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "endwise";
|
||||
originalName = "vim-endwise";
|
||||
package = "vim-endwise";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
# This plugin has no config options
|
||||
}
|
92
plugins/by-name/firenvim/default.nix
Normal file
92
plugins/by-name/firenvim/default.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
types = lib.nixvim.nixvimTypes;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "firenvim";
|
||||
|
||||
maintainers = with lib.maintainers; [ GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
globalSettings = defaultNullOpts.mkAttrsOf' {
|
||||
type = types.anything;
|
||||
pluginDefault = { };
|
||||
example = {
|
||||
alt = "all";
|
||||
};
|
||||
description = "Default settings that apply to all URLs.";
|
||||
};
|
||||
|
||||
localSettings = defaultNullOpts.mkAttrsOf' {
|
||||
type = with types; attrsOf anything;
|
||||
pluginDefault = { };
|
||||
example = {
|
||||
".*" = {
|
||||
cmdline = "neovim";
|
||||
content = "text";
|
||||
priority = 0;
|
||||
selector = "textarea";
|
||||
takeover = "always";
|
||||
};
|
||||
"https?://[^/]+\\.co\\.uk/" = {
|
||||
takeover = "never";
|
||||
priority = 1;
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Map regular expressions that are tested against the full URL to settings that are used for
|
||||
all URLs matched by that pattern.
|
||||
|
||||
When multiple patterns match a URL, the pattern with the highest "priority" value is used.
|
||||
|
||||
Note: regular expressions use the [JavaScript flavor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
globalSettings.alt = "all";
|
||||
localSettings = {
|
||||
".*" = {
|
||||
cmdline = "neovim";
|
||||
content = "text";
|
||||
priority = 0;
|
||||
selector = "textarea";
|
||||
takeover = "always";
|
||||
};
|
||||
"https?://[^/]+\\.co\\.uk/" = {
|
||||
takeover = "never";
|
||||
priority = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
settingsDescription = ''
|
||||
Options fed to the `vim.g.firenvim_config` table.
|
||||
'';
|
||||
|
||||
callSetup = false;
|
||||
extraConfig =
|
||||
let
|
||||
opt = options.plugins.firenvim;
|
||||
in
|
||||
cfg: {
|
||||
warnings =
|
||||
lib.optional
|
||||
(
|
||||
config.performance.combinePlugins.enable
|
||||
&& !(lib.elem "firenvim" config.performance.combinePlugins.standalonePlugins)
|
||||
)
|
||||
''
|
||||
Nixvim (plugins.firenvim): Using `performance.combinePlugins` breaks `firenvim`.
|
||||
Add this plugin to `performance.combinePlugins.standalonePlugins` to prevent any issue.
|
||||
'';
|
||||
globals.firenvim_config = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opt.settings;
|
||||
};
|
||||
}
|
667
plugins/by-name/flash/default.nix
Normal file
667
plugins/by-name/flash/default.nix
Normal file
|
@ -0,0 +1,667 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "flash";
|
||||
originalName = "flash.nvim";
|
||||
package = "flash-nvim";
|
||||
|
||||
maintainers = with maintainers; [
|
||||
traxys
|
||||
MattSturgeon
|
||||
];
|
||||
|
||||
# TODO: Added 2024-06-17; remove 2024-09-17
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings =
|
||||
let
|
||||
# Combine base option paths with nested mode option paths
|
||||
merged = flatten [
|
||||
opts
|
||||
(mapAttrsToList (mode: extras: map (opt: "${mode}.${opt}") (opts ++ extras)) modes)
|
||||
];
|
||||
|
||||
# Option paths that should be renamed
|
||||
opts = [
|
||||
"labels"
|
||||
"search.multiWindow"
|
||||
"search.forward"
|
||||
"search.wrap"
|
||||
"search.mode"
|
||||
"search.incremental"
|
||||
"search.exclude"
|
||||
"search.trigger"
|
||||
"search.maxLength"
|
||||
"jump.jumplist"
|
||||
"jump.pos"
|
||||
"jump.history"
|
||||
"jump.register"
|
||||
"jump.nohlsearch"
|
||||
"jump.autojump"
|
||||
"jump.inclusive"
|
||||
"jump.offset"
|
||||
"label.uppercase"
|
||||
"label.exclude"
|
||||
"label.current"
|
||||
"label.after"
|
||||
"label.before"
|
||||
"label.style"
|
||||
"label.reuse"
|
||||
"label.distance"
|
||||
"label.minPatternLength"
|
||||
"label.rainbow.enabled"
|
||||
"label.rainbow.shade"
|
||||
"label.format"
|
||||
"highlight.backdrop"
|
||||
"highlight.matches"
|
||||
"highlight.priority"
|
||||
"highlight.group.match"
|
||||
"highlight.group.current"
|
||||
"highlight.group.backdrop"
|
||||
"highlight.group.label"
|
||||
"action"
|
||||
"pattern"
|
||||
"continue"
|
||||
"config"
|
||||
"prompt.enabled"
|
||||
"prompt.prefix"
|
||||
"prompt.winConfig.relative"
|
||||
"prompt.winConfig.width"
|
||||
"prompt.winConfig.height"
|
||||
"prompt.winConfig.row"
|
||||
"prompt.winConfig.col"
|
||||
"prompt.winConfig.zindex"
|
||||
"remoteOp.restore"
|
||||
"remoteOp.motion"
|
||||
];
|
||||
|
||||
# "Modes" that should also be renamed
|
||||
# `opts` will get added to the attr value
|
||||
modes = {
|
||||
search = [ "enabled" ];
|
||||
char = [
|
||||
"enabled"
|
||||
"autohide"
|
||||
"jumpLabels"
|
||||
"multiLine"
|
||||
"keys"
|
||||
"charActions"
|
||||
];
|
||||
treesitter = [ ];
|
||||
treesitterSearch = [ ];
|
||||
remote = [ ];
|
||||
};
|
||||
in
|
||||
map (splitString ".") merged;
|
||||
|
||||
imports = [
|
||||
# TODO: check automatic search config still works
|
||||
(mkRemovedOptionModule [
|
||||
"plugins"
|
||||
"flash"
|
||||
"search"
|
||||
"automatic"
|
||||
] "You can configure `plugins.flash.settings.modes.search.search.*` directly.")
|
||||
];
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
# Default values used for the top-level settings options,
|
||||
# also used as secondary defaults for mode options.
|
||||
configDefaults = {
|
||||
labels = "asdfghjklqwertyuiopzxcvbnm";
|
||||
search = {
|
||||
multi_window = true;
|
||||
forward = true;
|
||||
wrap = true;
|
||||
mode = "exact";
|
||||
incremental = false;
|
||||
exclude = [
|
||||
"notify"
|
||||
"cmp_menu"
|
||||
"noice"
|
||||
"flash_prompt"
|
||||
(helpers.mkRaw ''
|
||||
function(win)
|
||||
-- exclude non-focusable windows
|
||||
return not vim.api.nvim_win_get_config(win).focusable
|
||||
end
|
||||
'')
|
||||
];
|
||||
trigger = "";
|
||||
max_length = false;
|
||||
};
|
||||
jump = {
|
||||
jumplist = true;
|
||||
pos = "start";
|
||||
history = false;
|
||||
register = false;
|
||||
nohlsearch = false;
|
||||
autojump = false;
|
||||
inclusive = null;
|
||||
offset = null;
|
||||
};
|
||||
label = {
|
||||
uppercase = true;
|
||||
exclude = "";
|
||||
current = true;
|
||||
after = true;
|
||||
before = false;
|
||||
style = "overlay";
|
||||
reuse = "lowercase";
|
||||
distance = true;
|
||||
min_pattern_length = 0;
|
||||
rainbow = {
|
||||
enabled = false;
|
||||
shade = 5;
|
||||
};
|
||||
format = ''
|
||||
function(opts)
|
||||
return { { opts.match.label, opts.hl_group } }
|
||||
end
|
||||
'';
|
||||
};
|
||||
highlight = {
|
||||
backdrop = true;
|
||||
matches = true;
|
||||
priority = 5000;
|
||||
groups = {
|
||||
match = "FlashMatch";
|
||||
current = "FlashCurrent";
|
||||
backdrop = "FlashBackdrop";
|
||||
label = "FlashLabel";
|
||||
};
|
||||
};
|
||||
action = null;
|
||||
pattern = "";
|
||||
continue = false;
|
||||
config = null;
|
||||
prompt = {
|
||||
enabled = true;
|
||||
prefix = [
|
||||
[
|
||||
"⚡"
|
||||
"FlashPromptIcon"
|
||||
]
|
||||
];
|
||||
win_config = {
|
||||
relative = "editor";
|
||||
width = 1;
|
||||
height = 1;
|
||||
row = -1;
|
||||
col = 0;
|
||||
zindex = 1000;
|
||||
};
|
||||
};
|
||||
remote_op = {
|
||||
restore = false;
|
||||
motion = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Shared config options, used by the top-level settings, as well as modes.
|
||||
# Each usage has different default values.
|
||||
configOpts =
|
||||
defaultOverrides:
|
||||
let
|
||||
defaults = recursiveUpdate configDefaults defaultOverrides;
|
||||
in
|
||||
{
|
||||
labels = helpers.defaultNullOpts.mkStr defaults.labels ''
|
||||
Labels appear next to the matches, allowing you to quickly jump to any location. Labels are
|
||||
guaranteed not to exist as a continuation of the search pattern.
|
||||
'';
|
||||
|
||||
search = {
|
||||
multi_window = helpers.defaultNullOpts.mkBool defaults.search.multi_window ''
|
||||
Search/jump in all windows
|
||||
'';
|
||||
|
||||
forward = helpers.defaultNullOpts.mkBool defaults.search.forward ''
|
||||
Search direction
|
||||
'';
|
||||
|
||||
wrap = helpers.defaultNullOpts.mkBool defaults.search.wrap ''
|
||||
Continue searching after reaching the start/end of the file.
|
||||
When `false`, find only matches in the given direction
|
||||
'';
|
||||
|
||||
mode =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"exact"
|
||||
"search"
|
||||
"fuzzy"
|
||||
]
|
||||
defaults.search.mode
|
||||
''
|
||||
Each mode will take `ignorecase` and `smartcase` into account.
|
||||
- `exact`: exact match
|
||||
- `search`: regular search
|
||||
- `fuzzy`: fuzzy search
|
||||
- `__raw` fun(str): custom search function that returns a pattern
|
||||
|
||||
For example, to only match at the beginning of a word:
|
||||
```lua
|
||||
function(str)
|
||||
return "\\<" .. str
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
incremental = helpers.defaultNullOpts.mkBool defaults.search.incremental ''
|
||||
Behave like `incsearch`.
|
||||
'';
|
||||
|
||||
exclude = helpers.defaultNullOpts.mkListOf types.str defaults.search.exclude ''
|
||||
Excluded filetypes and custom window filters.
|
||||
'';
|
||||
|
||||
trigger = helpers.defaultNullOpts.mkStr defaults.search.trigger ''
|
||||
Optional trigger character that needs to be typed before a jump label can be used.
|
||||
It's NOT recommended to set this, unless you know what you're doing.
|
||||
'';
|
||||
|
||||
max_length =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) int)
|
||||
defaults.search.max_length
|
||||
''
|
||||
Max pattern length. If the pattern length is equal to this labels will no longer be skipped.
|
||||
When it exceeds this length it will either end in a jump or terminate the search.
|
||||
'';
|
||||
};
|
||||
|
||||
jump = {
|
||||
jumplist = helpers.defaultNullOpts.mkBool defaults.jump.jumplist ''
|
||||
Save location in the jumplist.
|
||||
'';
|
||||
|
||||
pos =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"start"
|
||||
"end"
|
||||
"range"
|
||||
]
|
||||
defaults.jump.pos
|
||||
''
|
||||
Jump position
|
||||
'';
|
||||
|
||||
history = helpers.defaultNullOpts.mkBool defaults.jump.history ''
|
||||
Add pattern to search history.
|
||||
'';
|
||||
|
||||
register = helpers.defaultNullOpts.mkBool defaults.jump.register ''
|
||||
Add pattern to search register.
|
||||
'';
|
||||
|
||||
nohlsearch = helpers.defaultNullOpts.mkBool defaults.jump.nohlsearch ''
|
||||
Clear highlight after jump
|
||||
'';
|
||||
|
||||
autojump = helpers.defaultNullOpts.mkBool defaults.jump.autojump ''
|
||||
Automatically jump when there is only one match
|
||||
'';
|
||||
|
||||
inclusive = helpers.defaultNullOpts.mkBool defaults.jump.inclusive ''
|
||||
You can force inclusive/exclusive jumps by setting the `inclusive` option. By default it
|
||||
will be automatically set based on the mode.
|
||||
'';
|
||||
|
||||
offset = helpers.defaultNullOpts.mkInt defaults.jump.offset ''
|
||||
jump position offset. Not used for range jumps.
|
||||
0: default
|
||||
1: when pos == "end" and pos < current position
|
||||
'';
|
||||
};
|
||||
|
||||
label = {
|
||||
uppercase = helpers.defaultNullOpts.mkBool defaults.label.uppercase ''
|
||||
Allow uppercase labels.
|
||||
'';
|
||||
|
||||
exclude = helpers.defaultNullOpts.mkStr defaults.label.exclude ''
|
||||
add any labels with the correct case here, that you want to exclude
|
||||
'';
|
||||
|
||||
current = helpers.defaultNullOpts.mkBool true ''
|
||||
Add a label for the first match in the current window.
|
||||
You can always jump to the first match with `<CR>`
|
||||
'';
|
||||
|
||||
after =
|
||||
helpers.defaultNullOpts.mkNullableWithRaw (with types; either bool (listOf int))
|
||||
defaults.label.after
|
||||
''
|
||||
Show the label after the match
|
||||
'';
|
||||
|
||||
before =
|
||||
helpers.defaultNullOpts.mkNullableWithRaw (with types; either bool (listOf int))
|
||||
defaults.label.before
|
||||
''
|
||||
Show the label before the match
|
||||
'';
|
||||
|
||||
style =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"eol"
|
||||
"overlay"
|
||||
"right_align"
|
||||
"inline"
|
||||
]
|
||||
defaults.label.style
|
||||
''
|
||||
position of the label extmark
|
||||
'';
|
||||
|
||||
reuse =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"lowercase"
|
||||
"all"
|
||||
"none"
|
||||
]
|
||||
defaults.label.reuse
|
||||
''
|
||||
flash tries to re-use labels that were already assigned to a position,
|
||||
when typing more characters. By default only lower-case labels are re-used.
|
||||
'';
|
||||
|
||||
distance = helpers.defaultNullOpts.mkBool defaults.label.distance ''
|
||||
for the current window, label targets closer to the cursor first
|
||||
'';
|
||||
|
||||
min_pattern_length = helpers.defaultNullOpts.mkInt defaults.label.min_pattern_length ''
|
||||
minimum pattrn length to show labels
|
||||
Ignored for custom labelers.
|
||||
'';
|
||||
|
||||
rainbow = {
|
||||
enabled = helpers.defaultNullOpts.mkBool defaults.label.rainbow.enabled ''
|
||||
Enable this to use rainbow colors to highlight labels
|
||||
Can be useful for visualizing Treesitter ranges.
|
||||
'';
|
||||
|
||||
shade = helpers.defaultNullOpts.mkNullable (types.ints.between 1 9) defaults.label.rainbow.shade "";
|
||||
};
|
||||
|
||||
format = helpers.defaultNullOpts.mkLuaFn defaults.label.format ''
|
||||
With `format`, you can change how the label is rendered.
|
||||
Should return a list of `[text, highlight]` tuples.
|
||||
|
||||
@class Flash.Format
|
||||
@field state Flash.State
|
||||
@field match Flash.Match
|
||||
@field hl_group string
|
||||
@field after boolean
|
||||
@type fun(opts:Flash.Format): string[][]
|
||||
'';
|
||||
};
|
||||
|
||||
highlight = {
|
||||
backdrop = helpers.defaultNullOpts.mkBool defaults.highlight.backdrop ''
|
||||
Show a backdrop with hl FlashBackdrop.
|
||||
'';
|
||||
|
||||
matches = helpers.defaultNullOpts.mkBool defaults.highlight.matches ''
|
||||
Highlight the search matches.
|
||||
'';
|
||||
|
||||
priority = helpers.defaultNullOpts.mkPositiveInt defaults.highlight.priority ''
|
||||
Extmark priority.
|
||||
'';
|
||||
|
||||
groups = mapAttrs (name: helpers.defaultNullOpts.mkStr defaults.highlight.groups.${name}) {
|
||||
# opt = description
|
||||
match = "FlashMatch";
|
||||
current = "FlashCurrent";
|
||||
backdrop = "FlashBackdrop";
|
||||
label = "FlashLabel";
|
||||
};
|
||||
};
|
||||
|
||||
action = helpers.defaultNullOpts.mkLuaFn defaults.action ''
|
||||
action to perform when picking a label.
|
||||
defaults to the jumping logic depending on the mode.
|
||||
|
||||
@type fun(match:Flash.Match, state:Flash.State)
|
||||
'';
|
||||
|
||||
pattern = helpers.defaultNullOpts.mkStr defaults.pattern ''
|
||||
Initial pattern to use when opening flash.
|
||||
'';
|
||||
|
||||
continue = helpers.defaultNullOpts.mkBool defaults.continue ''
|
||||
When `true`, flash will try to continue the last search.
|
||||
'';
|
||||
|
||||
config = helpers.defaultNullOpts.mkLuaFn defaults.config ''
|
||||
Set config to a function to dynamically change the config.
|
||||
|
||||
@type fun(opts:Flash.Config)
|
||||
'';
|
||||
|
||||
prompt = {
|
||||
enabled = helpers.defaultNullOpts.mkBool defaults.prompt.enabled ''
|
||||
Options for the floating window that shows the prompt, for regular jumps.
|
||||
'';
|
||||
|
||||
# Not sure what the type is...
|
||||
# Think it's listOf (maybeRaw (listOf (maybeRaw str)))?
|
||||
prefix = helpers.defaultNullOpts.mkListOf types.anything defaults.prompt.prefix "";
|
||||
|
||||
win_config = helpers.defaultNullOpts.mkAttrsOf types.anything defaults.prompt.win_config ''
|
||||
See `:h nvim_open_win` for more details.
|
||||
'';
|
||||
};
|
||||
|
||||
remote_op = {
|
||||
restore = helpers.defaultNullOpts.mkBool defaults.remote_op.restore ''
|
||||
Restore window views and cursor position after doing a remote operation.
|
||||
'';
|
||||
|
||||
motion = helpers.defaultNullOpts.mkBool defaults.remote_op.motion ''
|
||||
For `jump.pos = "range"`, this setting is ignored.
|
||||
- `true`: always enter a new motion when doing a remote operation
|
||||
- `false`: use the window's cursor position and jump target
|
||||
- `nil`: act as `true` for remote windows, `false` for the current window
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# The `mode`s have all the same options as top-level settings,
|
||||
# but with different defaults and some additional options.
|
||||
mkModeConfig =
|
||||
{
|
||||
defaults ? { },
|
||||
options ? { },
|
||||
...
|
||||
}@args:
|
||||
# FIXME: use mkNullableWithRaw when #1618 is fixed
|
||||
helpers.defaultNullOpts.mkNullable' (
|
||||
(removeAttrs args [
|
||||
"options"
|
||||
"defaults"
|
||||
])
|
||||
// {
|
||||
type =
|
||||
with types;
|
||||
submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = recursiveUpdate (configOpts defaults) options;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
(configOpts { })
|
||||
// {
|
||||
modes = {
|
||||
search = mkModeConfig rec {
|
||||
description = ''
|
||||
Options used when flash is activated through a regular search,
|
||||
e.g. with `/` or `?`.
|
||||
'';
|
||||
defaults = {
|
||||
enabled = false;
|
||||
highlight = {
|
||||
backdrop = false;
|
||||
};
|
||||
jump = {
|
||||
history = true;
|
||||
register = true;
|
||||
nohlsearch = true;
|
||||
};
|
||||
search = {
|
||||
forward.__raw = "vim.fn.getcmdtype() == '/'";
|
||||
mode = "search";
|
||||
incremental.__raw = "vim.go.incsearch";
|
||||
};
|
||||
};
|
||||
options = {
|
||||
enabled = helpers.defaultNullOpts.mkBool defaults.enabled ''
|
||||
When `true`, flash will be activated during regular search by default.
|
||||
You can always toggle when searching with `require("flash").toggle()`
|
||||
'';
|
||||
};
|
||||
};
|
||||
char = mkModeConfig rec {
|
||||
description = ''
|
||||
Options used when flash is activated through
|
||||
`f`, `F`, `t`, `T`, `;` and `,` motions.
|
||||
'';
|
||||
defaults = {
|
||||
enabled = true;
|
||||
config = ''
|
||||
-- dynamic configuration for ftFT motions
|
||||
function(opts)
|
||||
-- autohide flash when in operator-pending mode
|
||||
opts.autohide = opts.autohide or (vim.fn.mode(true):find("no") and vim.v.operator == "y")
|
||||
|
||||
-- disable jump labels when not enabled, when using a count,
|
||||
-- or when recording/executing registers
|
||||
opts.jump_labels = opts.jump_labels
|
||||
and vim.v.count == 0
|
||||
and vim.fn.reg_executing() == ""
|
||||
and vim.fn.reg_recording() == ""
|
||||
|
||||
-- Show jump labels only in operator-pending mode
|
||||
-- opts.jump_labels = vim.v.count == 0 and vim.fn.mode(true):find("o")
|
||||
end
|
||||
'';
|
||||
autohide = false;
|
||||
jump_labels = false;
|
||||
multi_line = true;
|
||||
label = {
|
||||
exclude = "hjkliardc";
|
||||
};
|
||||
keys = helpers.listToUnkeyedAttrs (lib.stringToCharacters "fFtT;,");
|
||||
char_actions = ''
|
||||
function(motion)
|
||||
return {
|
||||
[";"] = "next", -- set to `right` to always go right
|
||||
[","] = "prev", -- set to `left` to always go left
|
||||
-- clever-f style
|
||||
[motion:lower()] = "next",
|
||||
[motion:upper()] = "prev",
|
||||
-- jump2d style: same case goes next, opposite case goes prev
|
||||
-- [motion] = "next",
|
||||
-- [motion:match("%l") and motion:upper() or motion:lower()] = "prev",
|
||||
}
|
||||
end
|
||||
'';
|
||||
search.wrap = false;
|
||||
highlight.backdrop = true;
|
||||
jump.register = false;
|
||||
};
|
||||
options = {
|
||||
enabled = helpers.defaultNullOpts.mkBool defaults.enabled "";
|
||||
|
||||
autohide = helpers.defaultNullOpts.mkBool defaults.autohide ''
|
||||
Hide after jump when not using jump labels.
|
||||
'';
|
||||
|
||||
jump_labels = helpers.defaultNullOpts.mkBool defaults.jump_labels ''
|
||||
Show jump labels.
|
||||
'';
|
||||
|
||||
multi_line = helpers.defaultNullOpts.mkBool defaults.multi_line ''
|
||||
Set to `false` to use the current line only.
|
||||
'';
|
||||
|
||||
keys = helpers.defaultNullOpts.mkAttrsOf' {
|
||||
type = types.str;
|
||||
pluginDefault = defaults.keys;
|
||||
description = ''
|
||||
By default all keymaps are enabled, but you can disable some of them,
|
||||
by removing them from the list.
|
||||
|
||||
If you rather use another key, you can map them to something else.
|
||||
'';
|
||||
example = {
|
||||
";" = "L";
|
||||
"," = "H";
|
||||
};
|
||||
};
|
||||
|
||||
char_actions = helpers.defaultNullOpts.mkLuaFn defaults.char_actions ''
|
||||
The direction for `prev` and `next` is determined by the motion.
|
||||
`left` and `right` are always left and right.
|
||||
'';
|
||||
};
|
||||
};
|
||||
treesitter = mkModeConfig {
|
||||
description = ''
|
||||
Options used for treesitter selections in `require("flash").treesitter()`.
|
||||
'';
|
||||
defaults = {
|
||||
labels = "abcdefghijklmnopqrstuvwxyz";
|
||||
jump.pos = "range";
|
||||
search.incremental = false;
|
||||
label = {
|
||||
before = true;
|
||||
after = true;
|
||||
style = "inline";
|
||||
};
|
||||
highlight = {
|
||||
backdrop = false;
|
||||
matches = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
treesitter_search = mkModeConfig {
|
||||
description = ''
|
||||
Options used when flash is activated through `require("flash").treesitter_search()`.
|
||||
'';
|
||||
defaults = {
|
||||
jump.pos = "range";
|
||||
search = {
|
||||
multi_window = true;
|
||||
wrap = true;
|
||||
incremental = false;
|
||||
};
|
||||
remote_op.restore = true;
|
||||
label = {
|
||||
before = true;
|
||||
after = true;
|
||||
style = "inline";
|
||||
};
|
||||
};
|
||||
};
|
||||
remote = mkModeConfig {
|
||||
description = "Options used for remote flash.";
|
||||
defaults = {
|
||||
remote_op = {
|
||||
restore = true;
|
||||
motion = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
235
plugins/by-name/floaterm/default.nix
Normal file
235
plugins/by-name/floaterm/default.nix
Normal file
|
@ -0,0 +1,235 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.floaterm;
|
||||
|
||||
settings = {
|
||||
shell = {
|
||||
type = types.str;
|
||||
description = "";
|
||||
};
|
||||
|
||||
title = {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Show floaterm info (e.g., 'floaterm: 1/3' implies there are 3 floaterms in total and the
|
||||
current is the first one) at the top left corner of floaterm window.
|
||||
|
||||
Default: 'floaterm: $1/$2'($1 and $2 will be substituted by 'the index of the current
|
||||
floaterm' and 'the count of all floaterms' respectively)
|
||||
|
||||
Example: 'floaterm($1|$2)'
|
||||
'';
|
||||
};
|
||||
|
||||
wintype = {
|
||||
type = types.enum [
|
||||
"float"
|
||||
"split"
|
||||
"vsplit"
|
||||
];
|
||||
description = ''
|
||||
'float'(nvim's floating or vim's popup) by default.
|
||||
Set it to 'split' or 'vsplit' if you don't want to use floating or popup window.
|
||||
'';
|
||||
};
|
||||
|
||||
width = {
|
||||
type = types.either types.int types.float;
|
||||
description = ''
|
||||
Int (number of columns) or float (between 0 and 1).
|
||||
if float, the width is relative to &columns.
|
||||
|
||||
Default: 0.6
|
||||
'';
|
||||
};
|
||||
|
||||
height = {
|
||||
type = types.either types.int types.float;
|
||||
description = ''
|
||||
Int (number of columns) or float (between 0 and 1).
|
||||
if float, the height is relative to &lines.
|
||||
|
||||
Default: 0.6
|
||||
'';
|
||||
};
|
||||
|
||||
position = {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The position of the floating window.
|
||||
|
||||
Available values:
|
||||
- If wintype is `split`/`vsplit`: 'leftabove', 'aboveleft', 'rightbelow', 'belowright', 'topleft', 'botright'.
|
||||
Default: 'botright'.
|
||||
|
||||
- If wintype is float: 'top', 'bottom', 'left', 'right', 'topleft', 'topright', 'bottomleft', 'bottomright', 'center', 'auto' (at the cursor place).
|
||||
Default: 'center'
|
||||
|
||||
In addition, there is another option 'random' which allows to pick a random position from
|
||||
above when (re)opening a floaterm window.
|
||||
'';
|
||||
};
|
||||
|
||||
borderchars = {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The position of the floating window.
|
||||
|
||||
8 characters of the floating window border (top, right, bottom, left, topleft, topright, botright, botleft).
|
||||
|
||||
Default: "─│─│┌┐┘└"
|
||||
'';
|
||||
};
|
||||
|
||||
rootmarkers = {
|
||||
type = types.listOf types.str;
|
||||
description = ''
|
||||
|
||||
Markers used to detect the project root directory for --cwd=<root>
|
||||
|
||||
Default: [".project" ".git" ".hg" ".svn" ".root"]
|
||||
'';
|
||||
};
|
||||
|
||||
giteditor = {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to override $GIT_EDITOR in floaterm terminals so git commands can open open an
|
||||
editor in the same neovim instance.
|
||||
|
||||
Default: true
|
||||
'';
|
||||
};
|
||||
|
||||
opener = {
|
||||
type = types.enum [
|
||||
"edit"
|
||||
"split"
|
||||
"vsplit"
|
||||
"tabe"
|
||||
"drop"
|
||||
];
|
||||
description = ''
|
||||
Command used for opening a file in the outside nvim from within `:terminal`.
|
||||
|
||||
Default: 'split'
|
||||
'';
|
||||
};
|
||||
|
||||
autoclose = {
|
||||
type = types.enum [
|
||||
0
|
||||
1
|
||||
2
|
||||
];
|
||||
description = ''
|
||||
Whether to close floaterm window once the job gets finished.
|
||||
|
||||
- 0: Always do NOT close floaterm window
|
||||
- 1: Close window if the job exits normally, otherwise stay it with messages like [Process exited 101]
|
||||
- 2: Always close floaterm window
|
||||
|
||||
Default: 1
|
||||
'';
|
||||
};
|
||||
|
||||
autohide = {
|
||||
type = types.enum [
|
||||
0
|
||||
1
|
||||
2
|
||||
];
|
||||
description = ''
|
||||
Whether to hide previous floaterms before switching to or opening a another one.
|
||||
|
||||
- 0: Always do NOT hide previous floaterm windows
|
||||
- 1: Only hide those whose position (b:floaterm_position) is identical to that of the floaterm which will be opened
|
||||
- 2: Always hide them
|
||||
|
||||
Default: 1
|
||||
'';
|
||||
};
|
||||
|
||||
autoinsert = {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enter Terminal-mode after opening a floaterm.
|
||||
|
||||
Default: true
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.floaterm =
|
||||
let
|
||||
# Misc options
|
||||
# `OPTION = VALUE`
|
||||
# which will translate to `globals.floaterm_OPTION = VALUE;`
|
||||
miscOptions = mapAttrs (name: value: helpers.mkNullOrOption value.type value.description) settings;
|
||||
|
||||
# Keymaps options
|
||||
# `keymaps.ACTION = KEY`
|
||||
# which will translate to `globals.floaterm_keymap_ACTION = KEY;`
|
||||
keymapOptions = listToAttrs (
|
||||
map
|
||||
(name: {
|
||||
inherit name;
|
||||
value = helpers.mkNullOrOption types.str "Key to map to ${name}";
|
||||
})
|
||||
[
|
||||
"new"
|
||||
"prev"
|
||||
"next"
|
||||
"first"
|
||||
"last"
|
||||
"hide"
|
||||
"show"
|
||||
"kill"
|
||||
"toggle"
|
||||
]
|
||||
);
|
||||
in
|
||||
{
|
||||
enable = mkEnableOption "floaterm";
|
||||
|
||||
package = lib.mkPackageOption pkgs "floaterm" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"vim-floaterm"
|
||||
];
|
||||
};
|
||||
|
||||
keymaps = keymapOptions;
|
||||
}
|
||||
// miscOptions;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
globals =
|
||||
let
|
||||
# misc options
|
||||
optionGlobals = listToAttrs (
|
||||
map (optionName: {
|
||||
name = "floaterm_${optionName}";
|
||||
value = cfg.${optionName};
|
||||
}) (attrNames settings)
|
||||
);
|
||||
|
||||
# keymaps options
|
||||
keymapGlobals = mapAttrs' (name: key: {
|
||||
name = "floaterm_keymap_${name}";
|
||||
value = key;
|
||||
}) cfg.keymaps;
|
||||
in
|
||||
optionGlobals // keymapGlobals;
|
||||
};
|
||||
}
|
150
plugins/by-name/fzf-lua/default.nix
Normal file
150
plugins/by-name/fzf-lua/default.nix
Normal file
|
@ -0,0 +1,150 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
settingsOptions = {
|
||||
fzf_bin = helpers.mkNullOrStr ''
|
||||
The path to the `fzf` binary to use.
|
||||
|
||||
Example: `"skim"`
|
||||
'';
|
||||
};
|
||||
settingsExample = {
|
||||
winopts = {
|
||||
height = 0.4;
|
||||
width = 0.93;
|
||||
row = 0.99;
|
||||
col = 0.3;
|
||||
};
|
||||
files = {
|
||||
find_opts.__raw = "[[-type f -not -path '*.git/objects*' -not -path '*.env*']]";
|
||||
prompt = "Files❯ ";
|
||||
multiprocess = true;
|
||||
file_icons = true;
|
||||
color_icons = true;
|
||||
};
|
||||
};
|
||||
in
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "fzf-lua";
|
||||
|
||||
extraPackages = [ pkgs.fzf ];
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
inherit settingsOptions settingsExample;
|
||||
|
||||
extraOptions = {
|
||||
fzfPackage = lib.mkPackageOption pkgs "fzf" {
|
||||
nullable = true;
|
||||
example = "pkgs.skim";
|
||||
};
|
||||
|
||||
# TODO: deprecated 2024-08-29 remove after 24.11
|
||||
iconsEnabled = mkOption {
|
||||
type = types.bool;
|
||||
description = "Toggle icon support. Installs nvim-web-devicons.";
|
||||
visible = false;
|
||||
};
|
||||
|
||||
iconsPackage = lib.mkPackageOption pkgs [
|
||||
"vimPlugins"
|
||||
"nvim-web-devicons"
|
||||
] { nullable = true; };
|
||||
|
||||
profile = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"default"
|
||||
"fzf-native"
|
||||
"fzf-tmux"
|
||||
"fzf-vim"
|
||||
"max-perf"
|
||||
"telescope"
|
||||
"skim"
|
||||
] "Preconfigured profile to use";
|
||||
|
||||
keymaps = mkOption {
|
||||
type =
|
||||
with types;
|
||||
attrsOf (
|
||||
either str (submodule {
|
||||
options = {
|
||||
action = mkOption {
|
||||
type = types.str;
|
||||
description = "The `fzf-lua` action to run";
|
||||
example = "git_files";
|
||||
};
|
||||
settings = helpers.mkSettingsOption {
|
||||
options = settingsOptions;
|
||||
description = "`fzf-lua` settings for this command.";
|
||||
example = settingsExample;
|
||||
};
|
||||
mode = helpers.keymaps.mkModeOption "n";
|
||||
options = helpers.keymaps.mapConfigOptions;
|
||||
};
|
||||
})
|
||||
);
|
||||
description = "Keymaps for Fzf-Lua.";
|
||||
default = { };
|
||||
example = {
|
||||
"<leader>fg" = "live_grep";
|
||||
"<C-p>" = {
|
||||
action = "git_files";
|
||||
settings = {
|
||||
previewers.cat.cmd = "${pkgs.coreutils}/bin/cat";
|
||||
winopts.height = 0.5;
|
||||
};
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Fzf-Lua Git Files";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig =
|
||||
cfg:
|
||||
let
|
||||
opt = options.plugins.fzf-lua;
|
||||
in
|
||||
{
|
||||
# TODO: deprecated 2024-08-29 remove after 24.11
|
||||
warnings = lib.mkIf opt.iconsEnabled.isDefined [
|
||||
''
|
||||
nixvim (plugins.fzf-lua):
|
||||
The option definition `plugins.fzf-lua.iconsEnabled' in ${showFiles opt.iconsEnabled.files} has been deprecated; please remove it.
|
||||
You should use `plugins.fzf-lua.iconsPackage' instead.
|
||||
''
|
||||
];
|
||||
|
||||
extraPlugins = lib.mkIf (
|
||||
cfg.iconsPackage != null && (opt.iconsEnabled.isDefined -> cfg.iconsEnabled)
|
||||
) [ cfg.iconsPackage ];
|
||||
|
||||
extraPackages = [ cfg.fzfPackage ];
|
||||
|
||||
plugins.fzf-lua.settings.__unkeyed_profile = cfg.profile;
|
||||
|
||||
keymaps = mapAttrsToList (
|
||||
key: mapping:
|
||||
let
|
||||
actionStr =
|
||||
if isString mapping then
|
||||
"${mapping}()"
|
||||
else
|
||||
"${mapping.action}(${helpers.toLuaObject mapping.settings})";
|
||||
in
|
||||
{
|
||||
inherit key;
|
||||
mode = mapping.mode or "n";
|
||||
action.__raw = "function() require('fzf-lua').${actionStr} end";
|
||||
options = mapping.options or { };
|
||||
}
|
||||
) cfg.keymaps;
|
||||
};
|
||||
}
|
47
plugins/by-name/goyo/default.nix
Normal file
47
plugins/by-name/goyo/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with helpers.vim-plugin;
|
||||
with lib;
|
||||
mkVimPlugin {
|
||||
name = "goyo";
|
||||
originalName = "goyo.vim";
|
||||
package = "goyo-vim";
|
||||
globalPrefix = "goyo_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-01: remove 2024-05-01
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"width"
|
||||
"height"
|
||||
];
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"goyo"
|
||||
"showLineNumbers"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"goyo"
|
||||
"settings"
|
||||
"linenr"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
width = helpers.mkNullOrOption types.ints.unsigned "width";
|
||||
|
||||
height = helpers.mkNullOrOption types.ints.unsigned "height";
|
||||
|
||||
linenr = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Show line numbers when in Goyo mode.
|
||||
'';
|
||||
};
|
||||
}
|
67
plugins/by-name/guess-indent/default.nix
Normal file
67
plugins/by-name/guess-indent/default.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "guess-indent";
|
||||
originalName = "guess-indent.nvim";
|
||||
package = "guess-indent-nvim";
|
||||
|
||||
maintainers = [ helpers.maintainers.GGORG ];
|
||||
|
||||
settingsOptions = {
|
||||
auto_cmd = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to create autocommand to automatically detect indentation
|
||||
'';
|
||||
|
||||
override_editorconfig = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether or not to override indentation set by Editorconfig
|
||||
'';
|
||||
|
||||
filetype_exclude =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"netrw"
|
||||
"tutor"
|
||||
]
|
||||
''
|
||||
Filetypes to ignore indentation detection in
|
||||
'';
|
||||
|
||||
buftype_exclude =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"help"
|
||||
"nofile"
|
||||
"terminal"
|
||||
"prompt"
|
||||
]
|
||||
''
|
||||
Buffer types to ignore indentation detection in
|
||||
'';
|
||||
|
||||
on_tab_options = helpers.defaultNullOpts.mkAttrsOf types.anything { expandtab = false; } ''
|
||||
A table of vim options when tabs are detected
|
||||
'';
|
||||
|
||||
on_space_options =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.anything
|
||||
{
|
||||
expandtab = true;
|
||||
tabstop = "detected";
|
||||
softtabstop = "detected";
|
||||
shiftwidth = "detected";
|
||||
}
|
||||
''
|
||||
A table of vim options when spaces are detected
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
auto_cmd = false;
|
||||
override_editorconfig = true;
|
||||
filetype_exclude = [ "markdown" ];
|
||||
};
|
||||
}
|
228
plugins/by-name/hardtime/default.nix
Normal file
228
plugins/by-name/hardtime/default.nix
Normal file
|
@ -0,0 +1,228 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
inherit (lib) types;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "hardtime";
|
||||
originalName = "hardtime.nvim";
|
||||
package = "hardtime-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.refaelsh ];
|
||||
|
||||
# TODO: Added 2024-09-07; remove after 24.11
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"hint"
|
||||
"notification"
|
||||
"hints"
|
||||
"maxTime"
|
||||
"maxCount"
|
||||
"disableMouse"
|
||||
"allowDifferentKey"
|
||||
"resettingKeys"
|
||||
"restrictedKeys"
|
||||
"restrictionMode"
|
||||
"disabledKeys"
|
||||
"disabledFiletypes"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
max_time = defaultNullOpts.mkUnsignedInt 1000 ''
|
||||
Maximum time (in milliseconds) to consider key presses as repeated.
|
||||
'';
|
||||
|
||||
max_count = defaultNullOpts.mkUnsignedInt 2 ''
|
||||
Maximum count of repeated key presses allowed within the `max_time` period.
|
||||
'';
|
||||
|
||||
disable_mouse = defaultNullOpts.mkBool true ''
|
||||
Disable mouse support.
|
||||
'';
|
||||
|
||||
hint = defaultNullOpts.mkBool true ''
|
||||
Enable hint messages for better commands.
|
||||
'';
|
||||
|
||||
notification = defaultNullOpts.mkBool true ''
|
||||
Enable notification messages for restricted and disabled keys.
|
||||
'';
|
||||
|
||||
allow_different_key = defaultNullOpts.mkBool false ''
|
||||
Allow different keys to reset the count.
|
||||
'';
|
||||
|
||||
enabled = defaultNullOpts.mkBool true ''
|
||||
Whether the plugin in enabled by default or not.
|
||||
'';
|
||||
|
||||
resetting_keys = defaultNullOpts.mkAttrsOf (with types; listOf str) {
|
||||
"1" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"2" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"3" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"4" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"5" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"6" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"7" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"8" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"9" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"c" = [ "n" ];
|
||||
"C" = [ "n" ];
|
||||
"d" = [ "n" ];
|
||||
"x" = [ "n" ];
|
||||
"X" = [ "n" ];
|
||||
"y" = [ "n" ];
|
||||
"Y" = [ "n" ];
|
||||
"p" = [ "n" ];
|
||||
"P" = [ "n" ];
|
||||
} "Keys in what modes that reset the count.";
|
||||
|
||||
restricted_keys = defaultNullOpts.mkAttrsOf (with types; listOf str) {
|
||||
"h" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"j" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"k" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"l" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"-" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"+" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"gj" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"gk" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"<CR>" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"<C-M>" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"<C-N>" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
"<C-P>" = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
} "Keys in what modes triggering the count mechanism.";
|
||||
|
||||
restriction_mode =
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"block"
|
||||
"hint"
|
||||
]
|
||||
''
|
||||
The behavior when `restricted_keys` trigger count mechanism.
|
||||
'';
|
||||
|
||||
disabled_keys = defaultNullOpts.mkAttrsOf (with types; listOf str) {
|
||||
"<Up>" = [
|
||||
""
|
||||
"i"
|
||||
];
|
||||
"<Down>" = [
|
||||
""
|
||||
"i"
|
||||
];
|
||||
"<Left>" = [
|
||||
""
|
||||
"i"
|
||||
];
|
||||
"<Right>" = [
|
||||
""
|
||||
"i"
|
||||
];
|
||||
} "Keys in what modes are disabled.";
|
||||
|
||||
disabled_filetypes = defaultNullOpts.mkListOf types.str [
|
||||
"qf"
|
||||
"netrw"
|
||||
"NvimTree"
|
||||
"lazy"
|
||||
"mason"
|
||||
] "`hardtime.nvim` is disabled under these filetypes.";
|
||||
|
||||
hints =
|
||||
lib.nixvim.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
message = lib.mkOption {
|
||||
description = "Hint message to be displayed.";
|
||||
type = types.rawLua;
|
||||
};
|
||||
|
||||
length = lib.mkOption {
|
||||
description = "The length of actual key strokes that matches this pattern.";
|
||||
type = types.ints.unsigned;
|
||||
};
|
||||
};
|
||||
})
|
||||
)
|
||||
''
|
||||
`key` is a string pattern you want to match, `value` is a table
|
||||
of hint massage and pattern length.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
max_time = 1500;
|
||||
settings = {
|
||||
showmode = false;
|
||||
};
|
||||
};
|
||||
}
|
264
plugins/by-name/harpoon/default.nix
Normal file
264
plugins/by-name/harpoon/default.nix
Normal file
|
@ -0,0 +1,264 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.harpoon;
|
||||
|
||||
projectConfigModule = types.submodule {
|
||||
options = {
|
||||
termCommands = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
List of predefined terminal commands for this project.
|
||||
'';
|
||||
|
||||
marks = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
List of predefined marks (filenames) for this project.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.harpoon = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "harpoon";
|
||||
|
||||
package = lib.mkPackageOption pkgs "harpoon" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"harpoon"
|
||||
];
|
||||
};
|
||||
|
||||
enableTelescope = mkEnableOption "telescope integration";
|
||||
|
||||
keymapsSilent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether harpoon keymaps should be silent.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
addFile = helpers.mkNullOrOption types.str ''
|
||||
Keymap for marking the current file.";
|
||||
'';
|
||||
|
||||
toggleQuickMenu = helpers.mkNullOrOption types.str ''
|
||||
Keymap for toggling the quick menu.";
|
||||
'';
|
||||
|
||||
navFile = helpers.mkNullOrOption (with types; attrsOf str) ''
|
||||
Keymaps for navigating to marks.
|
||||
|
||||
Examples:
|
||||
navFile = {
|
||||
"1" = "<C-j>";
|
||||
"2" = "<C-k>";
|
||||
"3" = "<C-l>";
|
||||
"4" = "<C-m>";
|
||||
};
|
||||
'';
|
||||
|
||||
navNext = helpers.mkNullOrOption types.str ''
|
||||
Keymap for navigating to next mark.";
|
||||
'';
|
||||
|
||||
navPrev = helpers.mkNullOrOption types.str ''
|
||||
Keymap for navigating to previous mark.";
|
||||
'';
|
||||
|
||||
gotoTerminal = helpers.mkNullOrOption (with types; attrsOf str) ''
|
||||
Keymaps for navigating to terminals.
|
||||
|
||||
Examples:
|
||||
gotoTerminal = {
|
||||
"1" = "<C-j>";
|
||||
"2" = "<C-k>";
|
||||
"3" = "<C-l>";
|
||||
"4" = "<C-m>";
|
||||
};
|
||||
'';
|
||||
|
||||
cmdToggleQuickMenu = helpers.mkNullOrOption types.str ''
|
||||
Keymap for toggling the cmd quick menu.
|
||||
'';
|
||||
|
||||
tmuxGotoTerminal = helpers.mkNullOrOption (with types; attrsOf str) ''
|
||||
Keymaps for navigating to tmux windows/panes.
|
||||
Attributes can either be tmux window ids or pane identifiers.
|
||||
|
||||
Examples:
|
||||
tmuxGotoTerminal = {
|
||||
"1" = "<C-1>";
|
||||
"2" = "<C-2>";
|
||||
"{down-of}" = "<leader>g";
|
||||
};
|
||||
'';
|
||||
};
|
||||
|
||||
saveOnToggle = helpers.defaultNullOpts.mkBool false ''
|
||||
Sets the marks upon calling `toggle` on the ui, instead of require `:w`.
|
||||
'';
|
||||
|
||||
saveOnChange = helpers.defaultNullOpts.mkBool true ''
|
||||
Saves the harpoon file upon every change. disabling is unrecommended.
|
||||
'';
|
||||
|
||||
enterOnSendcmd = helpers.defaultNullOpts.mkBool false ''
|
||||
Sets harpoon to run the command immediately as it's passed to the terminal when calling `sendCommand`.
|
||||
'';
|
||||
|
||||
tmuxAutocloseWindows = helpers.defaultNullOpts.mkBool false ''
|
||||
Closes any tmux windows harpoon that harpoon creates when you close Neovim.
|
||||
'';
|
||||
|
||||
excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str [ "harpoon" ] ''
|
||||
Filetypes that you want to prevent from adding to the harpoon list menu.
|
||||
'';
|
||||
|
||||
markBranch = helpers.defaultNullOpts.mkBool false ''
|
||||
Set marks specific to each git branch inside git repository.
|
||||
'';
|
||||
|
||||
projects = mkOption {
|
||||
default = { };
|
||||
description = ''
|
||||
Predefined projetcs. The keys of this attrs should be the path to the project.
|
||||
$HOME is working.
|
||||
'';
|
||||
example = ''
|
||||
projects = {
|
||||
"$HOME/personal/vim-with-me/server" = {
|
||||
termCommands = [
|
||||
"./env && npx ts-node src/index.ts"
|
||||
];
|
||||
};
|
||||
};
|
||||
'';
|
||||
type = types.attrsOf projectConfigModule;
|
||||
};
|
||||
|
||||
menu = {
|
||||
width = helpers.defaultNullOpts.mkInt 60 ''
|
||||
Menu window width
|
||||
'';
|
||||
|
||||
height = helpers.defaultNullOpts.mkInt 10 ''
|
||||
Menu window height
|
||||
'';
|
||||
|
||||
borderChars = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"─"
|
||||
"│"
|
||||
"─"
|
||||
"│"
|
||||
"╭"
|
||||
"╮"
|
||||
"╯"
|
||||
"╰"
|
||||
] "Border characters";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
projects = builtins.mapAttrs (name: value: {
|
||||
term.cmds = value.termCommands;
|
||||
mark.marks = helpers.ifNonNull' value.marks (map (mark: { filename = mark; }) value.marks);
|
||||
}) cfg.projects;
|
||||
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
global_settings = {
|
||||
save_on_toggle = saveOnToggle;
|
||||
save_on_change = saveOnChange;
|
||||
enter_on_sendcmd = enterOnSendcmd;
|
||||
tmux_autoclose_windows = tmuxAutocloseWindows;
|
||||
excluded_filetypes = excludedFiletypes;
|
||||
mark_branch = markBranch;
|
||||
};
|
||||
|
||||
inherit projects;
|
||||
|
||||
menu = {
|
||||
inherit (menu) width height;
|
||||
borderchars = menu.borderChars;
|
||||
};
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
message = ''Nixvim: The harpoon telescope integration needs telescope to function as intended'';
|
||||
}
|
||||
];
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
telescopeCfg = ''require("telescope").load_extension("harpoon")'';
|
||||
in
|
||||
''
|
||||
require('harpoon').setup(${helpers.toLuaObject setupOptions})
|
||||
${if cfg.enableTelescope then telescopeCfg else ""}
|
||||
'';
|
||||
|
||||
keymaps =
|
||||
let
|
||||
km = cfg.keymaps;
|
||||
|
||||
simpleMappings = flatten (
|
||||
mapAttrsToList
|
||||
(
|
||||
optionName: luaFunc:
|
||||
let
|
||||
key = km.${optionName};
|
||||
in
|
||||
optional (key != null) {
|
||||
inherit key;
|
||||
action.__raw = luaFunc;
|
||||
}
|
||||
)
|
||||
{
|
||||
addFile = "require('harpoon.mark').add_file";
|
||||
toggleQuickMenu = "require('harpoon.ui').toggle_quick_menu";
|
||||
navNext = "require('harpoon.ui').nav_next";
|
||||
navPrev = "require('harpoon.ui').nav_prev";
|
||||
cmdToggleQuickMenu = "require('harpoon.cmd-ui').toggle_quick_menu";
|
||||
}
|
||||
);
|
||||
|
||||
mkNavMappings =
|
||||
name: genLuaFunc:
|
||||
let
|
||||
mappingsAttrs = km.${name};
|
||||
in
|
||||
flatten (
|
||||
optionals (mappingsAttrs != null) (
|
||||
mapAttrsToList (id: key: {
|
||||
inherit key;
|
||||
action.__raw = genLuaFunc id;
|
||||
}) mappingsAttrs
|
||||
)
|
||||
);
|
||||
|
||||
allMappings =
|
||||
simpleMappings
|
||||
++ (mkNavMappings "navFile" (id: "function() require('harpoon.ui').nav_file(${id}) end"))
|
||||
++ (mkNavMappings "gotoTerminal" (id: "function() require('harpoon.term').gotoTerminal(${id}) end"))
|
||||
++ (mkNavMappings "tmuxGotoTerminal" (
|
||||
id: "function() require('harpoon.tmux').gotoTerminal(${id}) end"
|
||||
));
|
||||
in
|
||||
helpers.keymaps.mkKeymaps {
|
||||
mode = "n";
|
||||
options.silent = cfg.keymapsSilent;
|
||||
} allMappings;
|
||||
};
|
||||
}
|
286
plugins/by-name/hop/default.nix
Normal file
286
plugins/by-name/hop/default.nix
Normal file
|
@ -0,0 +1,286 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "hop";
|
||||
originalName = "hop.nvim";
|
||||
package = "hop-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
description = ''
|
||||
Hop doesn’t set any keybindings; you will have to define them by yourself.
|
||||
If you want to create a key binding from within nixvim:
|
||||
```nix
|
||||
keymaps = [
|
||||
{
|
||||
key = "f";
|
||||
action.__raw = \'\'
|
||||
function()
|
||||
require'hop'.hint_char1({
|
||||
direction = require'hop.hint'.HintDirection.AFTER_CURSOR,
|
||||
current_line_only = true
|
||||
})
|
||||
end
|
||||
\'\';
|
||||
options.remap = true;
|
||||
}
|
||||
{
|
||||
key = "F";
|
||||
action.__raw = \'\'
|
||||
function()
|
||||
require'hop'.hint_char1({
|
||||
direction = require'hop.hint'.HintDirection.BEFORE_CURSOR,
|
||||
current_line_only = true
|
||||
})
|
||||
end
|
||||
\'\';
|
||||
options.remap = true;
|
||||
}
|
||||
{
|
||||
key = "t";
|
||||
action.__raw = \'\'
|
||||
function()
|
||||
require'hop'.hint_char1({
|
||||
direction = require'hop.hint'.HintDirection.AFTER_CURSOR,
|
||||
current_line_only = true,
|
||||
hint_offset = -1
|
||||
})
|
||||
end
|
||||
\'\';
|
||||
options.remap = true;
|
||||
}
|
||||
{
|
||||
key = "T";
|
||||
action.__raw = \'\'
|
||||
function()
|
||||
require'hop'.hint_char1({
|
||||
direction = require'hop.hint'.HintDirection.BEFORE_CURSOR,
|
||||
current_line_only = true,
|
||||
hint_offset = 1
|
||||
})
|
||||
end
|
||||
\'\';
|
||||
options.remap = true;
|
||||
}
|
||||
];
|
||||
```
|
||||
'';
|
||||
|
||||
settingsOptions = {
|
||||
keys = helpers.defaultNullOpts.mkStr "asdghklqwertyuiopzxcvbnmfj" ''
|
||||
A string representing all the keys that can be part of a permutation.
|
||||
Every character (key) used in the string will be used as part of a permutation.
|
||||
The shortest permutation is a permutation of a single character, and, depending on the
|
||||
content of your buffer, you might end up with 3-character (or more) permutations in worst
|
||||
situations.
|
||||
|
||||
However, it is important to notice that if you decide to provide `keys`, you have to ensure
|
||||
to use enough characters in the string, otherwise you might get very long sequences and a
|
||||
not so pleasant experience.
|
||||
'';
|
||||
|
||||
quit_key = helpers.defaultNullOpts.mkStr "<Esc>" ''
|
||||
A string representing a key that will quit Hop mode without also feeding that key into
|
||||
Neovim to be treated as a normal key press.
|
||||
|
||||
It is possible to quit hopping by pressing any key that is not present in |hop-config-keys|;
|
||||
however, when you do this, the key normal function is also performed.
|
||||
For example if, hopping in |visual-mode|, pressing <Esc> will quit hopping and also exit
|
||||
|visual-mode|.
|
||||
|
||||
If the user presses `quit_key`, Hop will be quit without the key normal function being
|
||||
performed.
|
||||
For example if hopping in |visual-mode| with `quit_key` set to '<Esc>', pressing <Esc> will
|
||||
quit hopping without quitting |visual-mode|.
|
||||
|
||||
If you don't want to use a `quit_key`, set `quit_key` to an empty string.
|
||||
|
||||
Note: `quit_key` should only contain a single key or be an empty string.
|
||||
|
||||
Note: `quit_key` should not contain a key that is also present in |hop-config-keys|.
|
||||
'';
|
||||
|
||||
perm_method = helpers.defaultNullOpts.mkLuaFn "require'hop.perm'.TrieBacktrackFilling" ''
|
||||
Permutation method to use.
|
||||
|
||||
Permutation methods allow to change the way permutations (i.e. hints sequence labels) are
|
||||
generated internally.
|
||||
There is currently only one possible option:
|
||||
- `TrieBacktrackFilling`:
|
||||
Permutation algorithm based on tries and backtrack filling.
|
||||
|
||||
This algorithm uses the full potential of |hop-config-keys| by using them all to saturate
|
||||
a trie, representing all the permutations.
|
||||
Once a layer is saturated, this algorithm will backtrack (from the end of the trie,
|
||||
deepest first) and create a new layer in the trie, ensuring that the first permutations
|
||||
will be shorter than the last ones.
|
||||
|
||||
Because of the last, deepest trie insertion mechanism and trie saturation, this algorithm
|
||||
yields a much better distribution across your buffer, and you should get 1-sequences and
|
||||
2-sequences most of the time.
|
||||
Each dimension grows exponentially, so you get `keys_length²` 2-sequence keys,
|
||||
`keys_length³` 3-sequence keys, etc in the worst cases.
|
||||
'';
|
||||
|
||||
reverse_distribution = helpers.defaultNullOpts.mkBool false ''
|
||||
The default behavior for key sequence distribution in your buffer is to concentrate shorter
|
||||
sequences near the cursor, grouping 1-character sequences around.
|
||||
As hints get further from the cursor, the dimension of the sequences will grow, making the
|
||||
furthest sequences the longest ones to type.
|
||||
|
||||
Set this option to `true` to reverse the density and concentrate the shortest sequences
|
||||
(1-character) around the furthest words and the longest sequences around the cursor.
|
||||
'';
|
||||
|
||||
x_bias = helpers.defaultNullOpts.mkUnsignedInt 10 ''
|
||||
This Determines which hints get shorter key sequences.
|
||||
The default value has a more balanced distribution around the cursor but increasing it means
|
||||
that hints which are closer vertically will have a shorter key sequences.
|
||||
|
||||
For instance, when `x_bias` is set to 100, hints located at the end of the line will have
|
||||
shorter key sequence compared to hints in the lines above or below.
|
||||
'';
|
||||
|
||||
teasing = helpers.defaultNullOpts.mkBool true ''
|
||||
Boolean value stating whether Hop should tease you when you do something you are not
|
||||
supposed to.
|
||||
|
||||
If you find this setting annoying, feel free to turn it to `false`.
|
||||
'';
|
||||
|
||||
virtual_cursor = helpers.defaultNullOpts.mkBool true ''
|
||||
Creates a virtual cursor in place of actual cursor when hop waits for
|
||||
user input to indicate the active window.
|
||||
'';
|
||||
|
||||
jump_on_sole_occurrence = helpers.defaultNullOpts.mkBool true ''
|
||||
Immediately jump without displaying hints if only one occurrence exists.
|
||||
'';
|
||||
|
||||
ignore_injections = helpers.defaultNullOpts.mkBool false ''
|
||||
Ignore injected languages when jumping to treesitter node.
|
||||
'';
|
||||
|
||||
case_insensitive = helpers.defaultNullOpts.mkBool true ''
|
||||
Use case-insensitive matching by default for commands requiring user input.
|
||||
'';
|
||||
|
||||
create_hl_autocmd = helpers.defaultNullOpts.mkBool true ''
|
||||
Create and set highlight autocommands to automatically apply highlights.
|
||||
You will want this if you use a theme that clears all highlights before
|
||||
applying its colorscheme.
|
||||
'';
|
||||
|
||||
dim_unmatched = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether or not dim the unmatched text to emphasize the hint chars.
|
||||
'';
|
||||
|
||||
direction = helpers.mkNullOrLua ''
|
||||
Direction in which to hint.
|
||||
See `|hop.hint.HintDirection|` for further details.
|
||||
|
||||
Setting this in the user configuration will make all commands default to that direction,
|
||||
unless overridden.
|
||||
'';
|
||||
|
||||
hint_position = helpers.defaultNullOpts.mkLua "require'hop.hint'.HintPosition.BEGIN" ''
|
||||
Position of hint in match. See |hop.hint.HintPosition| for further
|
||||
details.
|
||||
'';
|
||||
|
||||
hint_type = helpers.defaultNullOpts.mkLua "require'hop.hint'.HintType.OVERLAY" ''
|
||||
How to show the hint char.
|
||||
|
||||
Possible values:
|
||||
- "overlay": display over the specified column, without shifting the underlying text.
|
||||
- "inline": display at the specified column, and shift the buffer text to the right as needed.
|
||||
'';
|
||||
|
||||
hint_offset = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Offset to apply to a jump location.
|
||||
|
||||
If it is non-zero, the jump target will be offset horizontally from the selected jump position
|
||||
by `hint_offset` character(s).
|
||||
|
||||
This option can be used for emulating the motion commands |t| and |T| where the cursor is
|
||||
positioned on/before the target position.
|
||||
'';
|
||||
|
||||
current_line_only = helpers.defaultNullOpts.mkBool false ''
|
||||
Apply Hop commands only to the current line.
|
||||
|
||||
Note: Trying to use this option along with `multi_windows` is unsound.
|
||||
'';
|
||||
|
||||
uppercase_labels = helpers.defaultNullOpts.mkBool false ''
|
||||
Display labels as uppercase.
|
||||
This option only affects the displayed labels; you still select them by typing the keys on your
|
||||
keyboard.
|
||||
'';
|
||||
|
||||
yank_register = helpers.defaultNullOpts.mkStr "" ''
|
||||
Determines which one of the `registers` stores the yanked text.
|
||||
'';
|
||||
|
||||
extensions = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
List-table of extensions to enable (names).
|
||||
As described in `|hop-extension|`, extensions for which the name in that list must have a
|
||||
`register(opts)` function in their public API for Hop to correctly initialized them.
|
||||
'';
|
||||
|
||||
multi_windows = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable cross-windows support and hint all the currently visible windows.
|
||||
This behavior allows you to jump around any position in any buffer currently visible in a
|
||||
window.
|
||||
Although a powerful a feature, remember that enabling this will also generate many more
|
||||
sequence combinations, so you could get deeper sequences to type (most of the time it
|
||||
should be good if you have enough keys in `|hop-config-keys|`).
|
||||
'';
|
||||
|
||||
excluded_filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Skip hinting windows with the excluded filetypes.
|
||||
Those windows to check filetypes are collected only when you enable `multi_windows` or
|
||||
execute `MW`-commands.
|
||||
This option is useful to skip the windows which are only for displaying something but not
|
||||
for editing.
|
||||
'';
|
||||
|
||||
match_mappings = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
This option allows you to specify the match mappings to use when applying the hint.
|
||||
If you set a non-empty `match_mappings`, the hint will be used as a key to look up the
|
||||
pattern to search for.
|
||||
|
||||
Currently supported mappings:~
|
||||
- 'fa' : farsi characters
|
||||
- 'zh' : Basic characters for Chinese
|
||||
- 'zh_sc' : Simplified Chinese
|
||||
- 'zh_tc' : Traditional Chinese
|
||||
|
||||
For example, if `match_mappings` is set to `["zh" "zh_sc"], the characters in "zh" and
|
||||
"zh_sc" can be mixed to match together.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
keys = "asdghklqwertyuiopzxcvbnmfj";
|
||||
quit_key = "<Esc>";
|
||||
reverse_distribution = false;
|
||||
x_bias = 10;
|
||||
teasing = true;
|
||||
virtual_cursor = true;
|
||||
jump_on_sole_occurrence = true;
|
||||
case_insensitive = false;
|
||||
dim_unmatched = true;
|
||||
direction = "require'hop.hint'.HintDirection.BEFORE_CURSOR";
|
||||
hint_position = "require'hop.hint'.HintPosition.BEGIN";
|
||||
hint_type = "require'hop.hint'.HintType.OVERLAY";
|
||||
match_mappings = [
|
||||
"zh"
|
||||
"zh_sc"
|
||||
];
|
||||
};
|
||||
}
|
50
plugins/by-name/hydra/default.nix
Normal file
50
plugins/by-name/hydra/default.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "hydra";
|
||||
originalName = "hydra.nvim";
|
||||
package = "hydra-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraOptions = {
|
||||
# A list of `Hydra` definitions
|
||||
hydras = import ./hydras-option.nix { inherit lib helpers; };
|
||||
};
|
||||
|
||||
settingsOptions = import ./settings-options.nix { inherit lib helpers; };
|
||||
|
||||
settingsExample = {
|
||||
exit = false;
|
||||
foreign_keys = "run";
|
||||
color = "red";
|
||||
buffer = true;
|
||||
invoke_on_body = false;
|
||||
desc = null;
|
||||
on_enter = ''
|
||||
function()
|
||||
print('hello')
|
||||
end
|
||||
'';
|
||||
timeout = 5000;
|
||||
hint = false;
|
||||
};
|
||||
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
extraConfigLua = ''
|
||||
hydra = require('hydra')
|
||||
|
||||
hydra.setup(${helpers.toLuaObject cfg.settings})
|
||||
|
||||
__hydra_defs = ${helpers.toLuaObject cfg.hydras}
|
||||
for _, hydra_config in ipairs(__hydra_defs) do
|
||||
hydra(hydra_config)
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
250
plugins/by-name/hydra/hydras-option.nix
Normal file
250
plugins/by-name/hydra/hydras-option.nix
Normal file
|
@ -0,0 +1,250 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
let
|
||||
hydraType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
name = helpers.mkNullOrStr ''
|
||||
Hydra's name.
|
||||
Only used in auto-generated hint.
|
||||
'';
|
||||
|
||||
mode = helpers.defaultNullOpts.mkNullable (
|
||||
with helpers.nixvimTypes; either helpers.keymaps.modeEnum (listOf helpers.keymaps.modeEnum)
|
||||
) "n" "Modes where the hydra exists, same as `vim.keymap.set()` accepts.";
|
||||
|
||||
body = helpers.mkNullOrStr ''
|
||||
Key required to activate the hydra, when excluded, you can use `Hydra:activate()`.
|
||||
'';
|
||||
|
||||
hint = helpers.mkNullOrStr ''
|
||||
The hint for a hydra can let you know that it's active, and remind you of the
|
||||
hydra's heads.
|
||||
The string for the hint is passed directly to the hydra.
|
||||
|
||||
See [the README](https://github.com/nvimtools/hydra.nvim?tab=readme-ov-file#hint)
|
||||
for more information.
|
||||
'';
|
||||
|
||||
config = import ./settings-options.nix { inherit lib helpers; };
|
||||
|
||||
heads =
|
||||
let
|
||||
headsOptType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
private = helpers.defaultNullOpts.mkBool false ''
|
||||
"When the hydra hides, this head does not stick out".
|
||||
Private heads are unreachable outside of the hydra state.
|
||||
'';
|
||||
|
||||
exit = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, stops the hydra after executing this head.
|
||||
NOTE:
|
||||
- All exit heads are private
|
||||
- If no exit head is specified, `esc` is set by default
|
||||
'';
|
||||
|
||||
exit_before = helpers.defaultNullOpts.mkBool false ''
|
||||
Like `exit`, but stops the hydra BEFORE executing the command.
|
||||
'';
|
||||
|
||||
ok_key = helpers.defaultNullOpts.mkBool true ''
|
||||
When set to `false`, `config.on_key` isn't run after this head.
|
||||
'';
|
||||
|
||||
desc = helpers.mkNullOrStr ''
|
||||
Value shown in auto-generated hint.
|
||||
When false, this key doesn't show up in the auto-generated hint.
|
||||
'';
|
||||
|
||||
expr = helpers.defaultNullOpts.mkBool false ''
|
||||
Same as the builtin `expr` map option.
|
||||
See `:h :map-expression`.
|
||||
'';
|
||||
|
||||
silent = helpers.defaultNullOpts.mkBool false ''
|
||||
Same as the builtin `silent` map option.
|
||||
See `:h :map-silent`.
|
||||
'';
|
||||
|
||||
nowait = helpers.defaultNullOpts.mkBool false ''
|
||||
For Pink Hydras only.
|
||||
Allows binding a key which will immediately perform its action and not wait
|
||||
`timeoutlen` for a possible continuation.
|
||||
'';
|
||||
|
||||
mode = helpers.mkNullOrOption (
|
||||
with helpers.nixvimTypes; either helpers.keymaps.modeEnum (listOf helpers.keymaps.modeEnum)
|
||||
) "Override `mode` for this head.";
|
||||
};
|
||||
};
|
||||
headType =
|
||||
with helpers.nixvimTypes;
|
||||
# More precisely, a tuple: [head action opts]
|
||||
listOf (
|
||||
nullOr (
|
||||
# action can be `null`
|
||||
oneOf [
|
||||
str # for `head` and `action`
|
||||
rawLua # for `action`
|
||||
headsOptType # for opts
|
||||
]
|
||||
)
|
||||
);
|
||||
in
|
||||
helpers.mkNullOrOption (types.listOf headType) ''
|
||||
Each Hydra's head has the form:
|
||||
`[head rhs opts]
|
||||
|
||||
Similar to the `vim.keymap.set()` function.
|
||||
|
||||
- The `head` is the "lhs" of the mapping (given as a string).
|
||||
These are the keys you press to perform the action.
|
||||
- The `rhs` is the action that gets performed.
|
||||
It can be a string, function (use `__raw`) or `null`.
|
||||
When `null`, the action is a no-op.
|
||||
- The `opts` attrs is empty by default.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
mkOption {
|
||||
type = types.listOf hydraType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
A list of hydra configurations.
|
||||
See [here](https://github.com/nvimtools/hydra.nvim?tab=readme-ov-file#creating-a-new-hydra).
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
name = "git";
|
||||
hint.__raw = ''
|
||||
[[
|
||||
_J_: next hunk _s_: stage hunk _d_: show deleted _b_: blame line
|
||||
_K_: prev hunk _u_: undo stage hunk _p_: preview hunk _B_: blame show full
|
||||
^ ^ _S_: stage buffer ^ ^ _/_: show base file
|
||||
^
|
||||
^ ^ _<Enter>_: Neogit _q_: exit
|
||||
]]
|
||||
'';
|
||||
config = {
|
||||
color = "pink";
|
||||
invoke_on_body = true;
|
||||
hint = {
|
||||
position = "bottom";
|
||||
};
|
||||
on_enter = ''
|
||||
function()
|
||||
vim.bo.modifiable = false
|
||||
gitsigns.toggle_signs(true)
|
||||
gitsigns.toggle_linehl(true)
|
||||
end
|
||||
'';
|
||||
on_exit = ''
|
||||
function()
|
||||
gitsigns.toggle_signs(false)
|
||||
gitsigns.toggle_linehl(false)
|
||||
gitsigns.toggle_deleted(false)
|
||||
vim.cmd("echo") -- clear the echo area
|
||||
end
|
||||
'';
|
||||
};
|
||||
mode = [
|
||||
"n"
|
||||
"x"
|
||||
];
|
||||
body = "<leader>g";
|
||||
heads = [
|
||||
[
|
||||
"J"
|
||||
{
|
||||
__raw = ''
|
||||
function()
|
||||
if vim.wo.diff then
|
||||
return "]c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end
|
||||
'';
|
||||
}
|
||||
{ expr = true; }
|
||||
]
|
||||
[
|
||||
"K"
|
||||
{
|
||||
__raw = ''
|
||||
function()
|
||||
if vim.wo.diff then
|
||||
return "[c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end
|
||||
'';
|
||||
}
|
||||
{ expr = true; }
|
||||
]
|
||||
[
|
||||
"s"
|
||||
":Gitsigns stage_hunk<CR>"
|
||||
{ silent = true; }
|
||||
]
|
||||
[
|
||||
"u"
|
||||
{ __raw = "require('gitsigns').undo_stage_hunk"; }
|
||||
]
|
||||
[
|
||||
"S"
|
||||
{ __raw = "require('gitsigns').stage_buffer"; }
|
||||
]
|
||||
[
|
||||
"p"
|
||||
{ __raw = "require('gitsigns').preview_hunk"; }
|
||||
]
|
||||
[
|
||||
"d"
|
||||
{ __raw = "require('gitsigns').toggle_deleted"; }
|
||||
{ nowait = true; }
|
||||
]
|
||||
[
|
||||
"b"
|
||||
{ __raw = "require('gitsigns').blame_line"; }
|
||||
]
|
||||
[
|
||||
"B"
|
||||
{
|
||||
__raw = ''
|
||||
function()
|
||||
gitsigns.blame_line({ full = true })
|
||||
end,
|
||||
'';
|
||||
}
|
||||
]
|
||||
[
|
||||
"/"
|
||||
{ __raw = "require('gitsigns').show"; }
|
||||
{ exit = true; }
|
||||
]
|
||||
[
|
||||
"<Enter>"
|
||||
"<cmd>Neogit<CR>"
|
||||
{ exit = true; }
|
||||
]
|
||||
[
|
||||
"q"
|
||||
null
|
||||
{
|
||||
exit = true;
|
||||
nowait = true;
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
174
plugins/by-name/hydra/settings-options.nix
Normal file
174
plugins/by-name/hydra/settings-options.nix
Normal file
|
@ -0,0 +1,174 @@
|
|||
# Those are the configuration options for both the plugin's `setup` function (defaults for all
|
||||
# hydras) and each Hydra.
|
||||
# So this attrs of options is used:
|
||||
# - as the `plugins.hydra.settings` option definition
|
||||
# - for `plugins.hydra.hydras.[].config`
|
||||
#
|
||||
# -> https://github.com/nvimtools/hydra.nvim?tab=readme-ov-file#config
|
||||
{ helpers, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
debug = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to enable debug mode.
|
||||
'';
|
||||
|
||||
exit = helpers.defaultNullOpts.mkBool false ''
|
||||
Set the default exit value for each head in the hydra.
|
||||
'';
|
||||
|
||||
foreign_keys =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"warn"
|
||||
"run"
|
||||
]
|
||||
null
|
||||
''
|
||||
Decides what to do when a key which doesn't belong to any head is pressed
|
||||
- `null`: hydra exits and foreign key behaves normally, as if the hydra wasn't active
|
||||
- `"warn"`: hydra stays active, issues a warning and doesn't run the foreign key
|
||||
- `"run"`: hydra stays active, runs the foreign key
|
||||
'';
|
||||
|
||||
color = helpers.defaultNullOpts.mkStr "red" ''
|
||||
See `:h hydra-colors`.
|
||||
`"red" | "amaranth" | "teal" | "pink"`
|
||||
'';
|
||||
|
||||
buffer = helpers.defaultNullOpts.mkNullable (
|
||||
with types; either (enum [ true ]) ints.unsigned
|
||||
) null "Define a hydra for the given buffer, pass `true` for current buf.";
|
||||
|
||||
invoke_on_body = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, summon the hydra after pressing only the `body` keys.
|
||||
Normally a head is required.
|
||||
'';
|
||||
|
||||
desc = helpers.defaultNullOpts.mkStr null ''
|
||||
Description used for the body keymap when `invoke_on_body` is true.
|
||||
When nil, "[Hydra] .. name" is used.
|
||||
'';
|
||||
|
||||
on_enter = helpers.mkNullOrLuaFn ''
|
||||
Called when the hydra is activated.
|
||||
'';
|
||||
|
||||
on_exit = helpers.mkNullOrLuaFn ''
|
||||
Called before the hydra is deactivated.
|
||||
'';
|
||||
|
||||
on_key = helpers.mkNullOrLuaFn ''
|
||||
Called after every hydra head.
|
||||
'';
|
||||
|
||||
timeout = helpers.defaultNullOpts.mkNullable (with types; either bool ints.unsigned) false ''
|
||||
Timeout after which the hydra is automatically disabled.
|
||||
Calling any head will refresh the timeout
|
||||
- `true`: timeout set to value of `timeoutlen` (`:h timeoutlen`)
|
||||
- `5000`: set to desired number of milliseconds
|
||||
|
||||
By default hydras wait forever (`false`).
|
||||
'';
|
||||
|
||||
hint =
|
||||
let
|
||||
hintConfigType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
type =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"window"
|
||||
"cmdline"
|
||||
"statusline"
|
||||
"statuslinemanual"
|
||||
])
|
||||
''
|
||||
- "window": show hint in a floating window
|
||||
- "cmdline": show hint in the echo area
|
||||
- "statusline": show auto-generated hint in the status line
|
||||
- "statuslinemanual": Do not show a hint, but return a custom status line hint from
|
||||
`require("hydra.statusline").get_hint()`
|
||||
|
||||
Defaults to "window" if `hint` is passed to the hydra otherwise defaults to "cmdline".
|
||||
'';
|
||||
|
||||
position = helpers.defaultNullOpts.mkEnum [
|
||||
"top-left"
|
||||
"top"
|
||||
"top-right"
|
||||
"middle-left"
|
||||
"middle"
|
||||
"middle-right"
|
||||
"bottom-left"
|
||||
"bottom"
|
||||
"bottom-right"
|
||||
] "bottom" "Set the position of the hint window.";
|
||||
|
||||
offset = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Offset of the floating window from the nearest editor border.
|
||||
'';
|
||||
|
||||
float_opts = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
Options passed to `nvim_open_win()`. See `:h nvim_open_win()`.
|
||||
Lets you set `border`, `header`, `footer`, etc.
|
||||
|
||||
Note: `row`, `col`, `height`, `width`, `relative`, and `anchor` should not be overridden.
|
||||
'';
|
||||
|
||||
show_name = helpers.defaultNullOpts.mkBool true ''
|
||||
Show the hydras name (or "HYDRA:" if not given a name), at the beginning of an
|
||||
auto-generated hint.
|
||||
'';
|
||||
|
||||
hide_on_load = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, this will prevent the hydra's hint window from displaying immediately.
|
||||
|
||||
Note: you can still show the window manually by calling `Hydra.hint:show()` and manually
|
||||
close it with `Hydra.hint:close()`.
|
||||
'';
|
||||
|
||||
funcs = mkOption {
|
||||
type = with helpers.nixvimTypes; attrsOf strLuaFn;
|
||||
description = ''
|
||||
Table from function names to function.
|
||||
Functions should return a string.
|
||||
These functions can be used in hints with `%{func_name}` more in `:h hydra-hint`.
|
||||
'';
|
||||
default = { };
|
||||
example = {
|
||||
number = ''
|
||||
function()
|
||||
if vim.o.number then
|
||||
return '[x]'
|
||||
else
|
||||
return '[ ]'
|
||||
end
|
||||
end
|
||||
'';
|
||||
relativenumber = ''
|
||||
function()
|
||||
if vim.o.relativenumber then
|
||||
return '[x]'
|
||||
else
|
||||
return '[ ]'
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
apply = mapAttrs (_: helpers.mkRaw);
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) hintConfigType)
|
||||
{
|
||||
show_name = true;
|
||||
position = "bottom";
|
||||
offset = 0;
|
||||
}
|
||||
''
|
||||
Configure the hint.
|
||||
Set to `false` to disable.
|
||||
'';
|
||||
}
|
156
plugins/by-name/illuminate/default.nix
Normal file
156
plugins/by-name/illuminate/default.nix
Normal file
|
@ -0,0 +1,156 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.illuminate;
|
||||
|
||||
mkListStr = helpers.defaultNullOpts.mkListOf types.str;
|
||||
|
||||
commonOptions = with helpers.defaultNullOpts; {
|
||||
providers =
|
||||
mkListStr
|
||||
[
|
||||
"lsp"
|
||||
"treesitter"
|
||||
"regex"
|
||||
]
|
||||
''
|
||||
Provider used to get references in the buffer, ordered by priority.
|
||||
'';
|
||||
|
||||
delay = mkInt 100 ''
|
||||
Delay in milliseconds.
|
||||
'';
|
||||
|
||||
modesDenylist = mkListStr [ ] ''
|
||||
Modes to not illuminate, this overrides `modes_allowlist`.
|
||||
See `:help mode()` for possible values.
|
||||
'';
|
||||
|
||||
modesAllowlist = mkListStr [ ] ''
|
||||
Modes to illuminate, this is overridden by `modes_denylist`.
|
||||
See `:help mode()` for possible values.
|
||||
'';
|
||||
|
||||
providersRegexSyntaxDenylist = mkListStr [ ] ''
|
||||
Syntax to not illuminate, this overrides `providers_regex_syntax_allowlist`.
|
||||
Only applies to the 'regex' provider.
|
||||
Use `:echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')`.
|
||||
'';
|
||||
|
||||
providersRegexSyntaxAllowlist = mkListStr [ ] ''
|
||||
Syntax to illuminate, this is overridden by `providers_regex_syntax_denylist`.
|
||||
Only applies to the 'regex' provider.
|
||||
Use `:echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')`.
|
||||
'';
|
||||
|
||||
underCursor = mkBool true ''
|
||||
Whether or not to illuminate under the cursor.
|
||||
'';
|
||||
|
||||
largeFileCutoff = helpers.mkNullOrOption types.int ''
|
||||
Number of lines at which to use `large_file_config`.
|
||||
The `under_cursor` option is disabled when this cutoff is hit.
|
||||
'';
|
||||
|
||||
minCountToHighlight = mkInt 1 ''
|
||||
Minimum number of matches required to perform highlighting.
|
||||
'';
|
||||
};
|
||||
|
||||
filetypeOptions = {
|
||||
filetypesDenylist =
|
||||
mkListStr
|
||||
[
|
||||
"dirvish"
|
||||
"fugitive"
|
||||
]
|
||||
''
|
||||
Filetypes to not illuminate, this overrides `filetypes_allowlist`.
|
||||
'';
|
||||
|
||||
filetypesAllowlist = mkListStr [ ] ''
|
||||
Filetypes to illuminate, this is overridden by `filetypes_denylist`.
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.illuminate =
|
||||
with helpers;
|
||||
with defaultNullOpts;
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "vim-illuminate";
|
||||
|
||||
package = lib.mkPackageOption pkgs "vim-illuminate" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"vim-illuminate"
|
||||
];
|
||||
};
|
||||
|
||||
filetypeOverrides =
|
||||
helpers.defaultNullOpts.mkAttrsOf (types.submodule { options = commonOptions; }) { }
|
||||
''
|
||||
Filetype specific overrides.
|
||||
The keys are strings to represent the filetype.
|
||||
'';
|
||||
|
||||
largeFileOverrides = mkOption {
|
||||
type = types.submodule { options = commonOptions // filetypeOptions; };
|
||||
description = ''
|
||||
Config to use for large files (based on large_file_cutoff).
|
||||
Supports the same keys passed to .configure
|
||||
If null, illuminate will be disabled for large files.
|
||||
'';
|
||||
default = { };
|
||||
};
|
||||
}
|
||||
// commonOptions
|
||||
// filetypeOptions;
|
||||
|
||||
config =
|
||||
let
|
||||
filetypeSetupOptions =
|
||||
filetypeOptions: with filetypeOptions; {
|
||||
filetypes_denylist = filetypesDenylist;
|
||||
filetypes_allowlist = filetypesAllowlist;
|
||||
};
|
||||
commonSetupOptions =
|
||||
opts: with opts; {
|
||||
inherit providers;
|
||||
inherit delay;
|
||||
modes_denylist = modesDenylist;
|
||||
modes_allowlist = modesAllowlist;
|
||||
providers_regex_syntax_denylist = providersRegexSyntaxDenylist;
|
||||
providers_regex_syntax_allowlist = providersRegexSyntaxAllowlist;
|
||||
under_cursor = underCursor;
|
||||
large_file_cutoff = largeFileCutoff;
|
||||
min_count_to_highlight = minCountToHighlight;
|
||||
};
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
large_file_overrides =
|
||||
(commonSetupOptions largeFileOverrides) // (filetypeSetupOptions largeFileOverrides);
|
||||
|
||||
filetype_overrides = helpers.ifNonNull' filetypeOverrides (
|
||||
mapAttrs (_: commonSetupOptions) filetypeOverrides
|
||||
);
|
||||
}
|
||||
// (filetypeSetupOptions cfg)
|
||||
// (commonSetupOptions cfg);
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("illuminate").configure(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
128
plugins/by-name/improved-search/default.nix
Normal file
128
plugins/by-name/improved-search/default.nix
Normal file
|
@ -0,0 +1,128 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
# This plugin is only configured through keymaps, so we use `mkVimPlugin` without the
|
||||
# `globalPrefix` argument to avoid the creation of the `settings` option.
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "improved-search";
|
||||
originalName = "improved-search.nvim";
|
||||
package = "improved-search-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
extraOptions = {
|
||||
keymaps = mkOption {
|
||||
description = ''
|
||||
Keymap definitions for search functions
|
||||
|
||||
See [here](https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators) for the list of available callbacks.
|
||||
'';
|
||||
type =
|
||||
with helpers.nixvimTypes;
|
||||
listOf (submodule {
|
||||
options = {
|
||||
key = mkOption {
|
||||
type = str;
|
||||
description = "The key to map.";
|
||||
example = "!";
|
||||
};
|
||||
|
||||
mode = helpers.keymaps.mkModeOption "";
|
||||
|
||||
action = mkOption {
|
||||
type =
|
||||
with helpers.nixvimTypes;
|
||||
maybeRaw (
|
||||
# https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators
|
||||
enum [
|
||||
"stable_next"
|
||||
"stable_previous"
|
||||
"current_word"
|
||||
"current_word_strict"
|
||||
"in_place"
|
||||
"in_place_strict"
|
||||
"forward"
|
||||
"forward_strict"
|
||||
"backward"
|
||||
"backward_strict"
|
||||
]
|
||||
);
|
||||
description = ''
|
||||
The action to execute.
|
||||
|
||||
See [here](https://github.com/backdround/improved-search.nvim?tab=readme-ov-file#functions-and-operators) for the list of available callbacks.
|
||||
'';
|
||||
example = "in_place";
|
||||
};
|
||||
|
||||
options = helpers.keymaps.mapConfigOptions;
|
||||
};
|
||||
});
|
||||
default = [ ];
|
||||
example = [
|
||||
{
|
||||
mode = [
|
||||
"n"
|
||||
"x"
|
||||
"o"
|
||||
];
|
||||
key = "n";
|
||||
action = "stable_next";
|
||||
}
|
||||
{
|
||||
mode = [
|
||||
"n"
|
||||
"x"
|
||||
"o"
|
||||
];
|
||||
key = "N";
|
||||
action = "stable_previous";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "!";
|
||||
action = "current_word";
|
||||
options.desc = "Search current word without moving";
|
||||
}
|
||||
{
|
||||
mode = "x";
|
||||
key = "!";
|
||||
action = "in_place";
|
||||
}
|
||||
{
|
||||
mode = "x";
|
||||
key = "*";
|
||||
action = "forward";
|
||||
}
|
||||
{
|
||||
mode = "x";
|
||||
key = "#";
|
||||
action = "backward";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "|";
|
||||
action = "in_place";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
keymaps = map (keymap: {
|
||||
inherit (keymap) key options mode;
|
||||
action =
|
||||
if
|
||||
isString keymap.action
|
||||
# One of the plugin builtin functions
|
||||
then
|
||||
helpers.mkRaw "require('improved-search').${keymap.action}"
|
||||
# If the user specifies a raw action directly
|
||||
else
|
||||
keymap.action;
|
||||
}) cfg.keymaps;
|
||||
};
|
||||
}
|
292
plugins/by-name/indent-blankline/default.nix
Normal file
292
plugins/by-name/indent-blankline/default.nix
Normal file
|
@ -0,0 +1,292 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "indent-blankline";
|
||||
originalName = "indent-blankline.nvim";
|
||||
luaName = "ibl";
|
||||
package = "indent-blankline-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-10: remove 2024-05-10
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"debounce"
|
||||
[
|
||||
"viewportBuffer"
|
||||
"min"
|
||||
]
|
||||
[
|
||||
"viewportBuffer"
|
||||
"max"
|
||||
]
|
||||
[
|
||||
"indent"
|
||||
"char"
|
||||
]
|
||||
[
|
||||
"indent"
|
||||
"tabChar"
|
||||
]
|
||||
[
|
||||
"indent"
|
||||
"highlight"
|
||||
]
|
||||
[
|
||||
"indent"
|
||||
"smartIndentCap"
|
||||
]
|
||||
[
|
||||
"indent"
|
||||
"priority"
|
||||
]
|
||||
[
|
||||
"whitespace"
|
||||
"highlight"
|
||||
]
|
||||
[
|
||||
"whitespace"
|
||||
"removeBlanklineTrail"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"enabled"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"char"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"showStart"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"showEnd"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"showExactScope"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"injectedLanguages"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"highlight"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"priority"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"include"
|
||||
"nodeType"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"exclude"
|
||||
"language"
|
||||
]
|
||||
[
|
||||
"scope"
|
||||
"exclude"
|
||||
"nodeType"
|
||||
]
|
||||
[
|
||||
"exclude"
|
||||
"filetypes"
|
||||
]
|
||||
[
|
||||
"exclude"
|
||||
"buftypes"
|
||||
]
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
debounce = helpers.defaultNullOpts.mkUnsignedInt 200 ''
|
||||
Sets the amount indent-blankline debounces refreshes in milliseconds.
|
||||
'';
|
||||
|
||||
viewport_buffer = {
|
||||
min = helpers.defaultNullOpts.mkUnsignedInt 30 ''
|
||||
Minimum number of lines above and below of what is currently visible in the window for
|
||||
which indentation guides will be generated.
|
||||
'';
|
||||
|
||||
max = helpers.defaultNullOpts.mkUnsignedInt 500 ''
|
||||
Maximum number of lines above and below of what is currently visible in the window for
|
||||
which indentation guides will be generated.
|
||||
'';
|
||||
};
|
||||
|
||||
indent = {
|
||||
char = helpers.defaultNullOpts.mkNullable (with types; either str (listOf str)) "▎" ''
|
||||
Character, or list of characters, that get used to display the indentation guide.
|
||||
Each character has to have a display width of 0 or 1.
|
||||
'';
|
||||
|
||||
tab_char = helpers.mkNullOrOption (with types; either str (listOf str)) ''
|
||||
Character, or list of characters, that get used to display the indentation guide for tabs.
|
||||
Each character has to have a display width of 0 or 1.
|
||||
|
||||
Default: uses `|lcs-tab|` if `|'list'|` is set, otherwise, uses
|
||||
`|ibl.config.indent.char|`.
|
||||
'';
|
||||
|
||||
highlight = helpers.mkNullOrOption (with types; either str (listOf str)) ''
|
||||
Highlight group, or list of highlight groups, that get applied to the indentation guide.
|
||||
|
||||
Default: `|hl-IblIndent|`
|
||||
'';
|
||||
|
||||
smart_indent_cap = helpers.defaultNullOpts.mkBool true ''
|
||||
Caps the number of indentation levels by looking at the surrounding code.
|
||||
'';
|
||||
|
||||
priority = helpers.defaultNullOpts.mkUnsignedInt 1 ''
|
||||
Virtual text priority for the indentation guide.
|
||||
'';
|
||||
};
|
||||
|
||||
whitespace = {
|
||||
highlight = helpers.mkNullOrOption (with types; either str (listOf str)) ''
|
||||
Highlight group, or list of highlight groups, that get applied to the whitespace.
|
||||
|
||||
Default: `|hl-IblWhitespace|`
|
||||
'';
|
||||
|
||||
remove_blankline_trail = helpers.defaultNullOpts.mkBool true ''
|
||||
Removes trailing whitespace on blanklines.
|
||||
|
||||
Turn this off if you want to add background color to the whitespace highlight group.
|
||||
'';
|
||||
};
|
||||
|
||||
scope = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enables or disables scope.";
|
||||
|
||||
char = helpers.mkNullOrOption (with types; either str (listOf str)) ''
|
||||
Character, or list of characters, that get used to display the scope indentation guide.
|
||||
|
||||
Each character has to have a display width of 0 or 1.
|
||||
|
||||
Default: `indent.char`
|
||||
'';
|
||||
|
||||
show_start = helpers.defaultNullOpts.mkBool true ''
|
||||
Shows an underline on the first line of the scope.
|
||||
'';
|
||||
|
||||
show_end = helpers.defaultNullOpts.mkBool true ''
|
||||
Shows an underline on the last line of the scope.
|
||||
'';
|
||||
|
||||
show_exact_scope = helpers.defaultNullOpts.mkBool false ''
|
||||
Shows an underline on the first line of the scope starting at the exact start of the scope
|
||||
(even if this is to the right of the indent guide) and an underline on the last line of
|
||||
the scope ending at the exact end of the scope.
|
||||
'';
|
||||
|
||||
injected_languages = helpers.defaultNullOpts.mkBool true ''
|
||||
Checks for the current scope in injected treesitter languages.
|
||||
This also influences if the scope gets excluded or not.
|
||||
'';
|
||||
|
||||
highlight = helpers.mkNullOrOption (with types; either str (listOf str)) ''
|
||||
Highlight group, or list of highlight groups, that get applied to the scope.
|
||||
|
||||
Default: `|hl-IblScope|`
|
||||
'';
|
||||
|
||||
priority = helpers.defaultNullOpts.mkUnsignedInt 1024 ''
|
||||
Virtual text priority for the scope.
|
||||
'';
|
||||
|
||||
include = {
|
||||
node_type = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) { } ''
|
||||
Map of language to a list of node types which can be used as scope.
|
||||
|
||||
- Use `*` as the language to act as a wildcard for all languages.
|
||||
- Use `*` as a node type to act as a wildcard for all node types.
|
||||
'';
|
||||
};
|
||||
|
||||
exclude = {
|
||||
language = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
List of treesitter languages for which scope is disabled.
|
||||
'';
|
||||
|
||||
node_type =
|
||||
helpers.defaultNullOpts.mkAttrsOf (with types; (listOf str))
|
||||
{
|
||||
"*" = [
|
||||
"source_file"
|
||||
"program"
|
||||
];
|
||||
lua = [ "chunk" ];
|
||||
python = [ "module" ];
|
||||
}
|
||||
''
|
||||
Map of language to a list of node types which should not be used as scope.
|
||||
|
||||
Use `*` as a wildcard for all languages.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
exclude = {
|
||||
filetypes = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"lspinfo"
|
||||
"packer"
|
||||
"checkhealth"
|
||||
"help"
|
||||
"man"
|
||||
"gitcommit"
|
||||
"TelescopePrompt"
|
||||
"TelescopeResults"
|
||||
"''"
|
||||
] "List of filetypes for which indent-blankline is disabled.";
|
||||
|
||||
buftypes = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"terminal"
|
||||
"nofile"
|
||||
"quickfix"
|
||||
"prompt"
|
||||
] "List of buftypes for which indent-blankline is disabled.";
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
indent = {
|
||||
char = "│";
|
||||
};
|
||||
scope = {
|
||||
show_start = false;
|
||||
show_end = false;
|
||||
show_exact_scope = true;
|
||||
};
|
||||
exclude = {
|
||||
filetypes = [
|
||||
""
|
||||
"checkhealth"
|
||||
"help"
|
||||
"lspinfo"
|
||||
"packer"
|
||||
"TelescopePrompt"
|
||||
"TelescopeResults"
|
||||
"yaml"
|
||||
];
|
||||
buftypes = [
|
||||
"terminal"
|
||||
"quickfix"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
31
plugins/by-name/indent-o-matic/default.nix
Normal file
31
plugins/by-name/indent-o-matic/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "indent-o-matic";
|
||||
maintainers = [ helpers.maintainers.alisonjenkins ];
|
||||
settingsOptions = {
|
||||
max_lines =
|
||||
helpers.defaultNullOpts.mkInt 2048
|
||||
"Number of lines without indentation before giving up (use -1 for infinite)";
|
||||
skip_multiline = helpers.defaultNullOpts.mkBool false "Skip multi-line comments and strings (more accurate detection but less performant)";
|
||||
standard_widths = helpers.defaultNullOpts.mkListOf types.ints.unsigned [
|
||||
2
|
||||
4
|
||||
8
|
||||
] "Space indentations that should be detected";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
max_lines = 2048;
|
||||
skip_multiline = false;
|
||||
standard_widths = [
|
||||
2
|
||||
4
|
||||
8
|
||||
];
|
||||
};
|
||||
}
|
98
plugins/by-name/instant/default.nix
Normal file
98
plugins/by-name/instant/default.nix
Normal file
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "instant";
|
||||
originalName = "instant.nvim";
|
||||
package = "instant-nvim";
|
||||
globalPrefix = "instant_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"username"
|
||||
"onlyCwd"
|
||||
"cursorHlGroupUser1"
|
||||
"cursorHlGroupUser2"
|
||||
"cursorHlGroupUser3"
|
||||
"cursorHlGroupUser4"
|
||||
"cursorHlGroupDefault"
|
||||
"nameHlGroupUser1"
|
||||
"nameHlGroupUser2"
|
||||
"nameHlGroupUser3"
|
||||
"nameHlGroupUser4"
|
||||
"nameHlGroupDefault"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
username = helpers.mkNullOrStr ''
|
||||
Username.
|
||||
Explicitly set to `null` if you do not want this option to be set.
|
||||
'';
|
||||
|
||||
only_cwd = helpers.defaultNullOpts.mkBool true ''
|
||||
Choose whether to share files only in the current working directory in session mode.
|
||||
'';
|
||||
|
||||
cursor_hl_group_user1 = helpers.defaultNullOpts.mkStr "Cursor" ''
|
||||
Cursor highlight group for user 1.
|
||||
'';
|
||||
|
||||
cursor_hl_group_user2 = helpers.defaultNullOpts.mkStr "Cursor" ''
|
||||
Cursor highlight group for user 2.
|
||||
'';
|
||||
|
||||
cursor_hl_group_user3 = helpers.defaultNullOpts.mkStr "Cursor" ''
|
||||
Cursor highlight group for user 3.
|
||||
'';
|
||||
|
||||
cursor_hl_group_user4 = helpers.defaultNullOpts.mkStr "Cursor" ''
|
||||
Cursor highlight group for user 4.
|
||||
'';
|
||||
|
||||
cursor_hl_group_default = helpers.defaultNullOpts.mkStr "Cursor" ''
|
||||
Cursor highlight group for any other userr.
|
||||
'';
|
||||
|
||||
name_hl_group_user1 = helpers.defaultNullOpts.mkStr "CursorLineNr" ''
|
||||
Virtual text highlight group for user 1.
|
||||
'';
|
||||
|
||||
name_hl_group_user2 = helpers.defaultNullOpts.mkStr "CursorLineNr" ''
|
||||
Virtual text highlight group for user 2.
|
||||
'';
|
||||
|
||||
name_hl_group_user3 = helpers.defaultNullOpts.mkStr "CursorLineNr" ''
|
||||
Virtual text highlight group for user 3.
|
||||
'';
|
||||
|
||||
name_hl_group_user4 = helpers.defaultNullOpts.mkStr "CursorLineNr" ''
|
||||
Virtual text highlight group for user 4.
|
||||
'';
|
||||
|
||||
name_hl_group_default = helpers.defaultNullOpts.mkStr "CursorLineNr" ''
|
||||
Virtual text highlight group for any other user.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
username = "Joe";
|
||||
onlyCwd = true;
|
||||
cursor_hl_group_user1 = "Cursor";
|
||||
cursor_hl_group_user2 = "Cursor";
|
||||
cursor_hl_group_user3 = "Cursor";
|
||||
cursor_hl_group_user4 = "Cursor";
|
||||
cursor_hl_group_default = "Cursor";
|
||||
name_hl_group_user1 = "CursorLineNr";
|
||||
name_hl_group_user2 = "CursorLineNr";
|
||||
name_hl_group_user3 = "CursorLineNr";
|
||||
name_hl_group_user4 = "CursorLineNr";
|
||||
name_hl_group_default = "CursorLineNr";
|
||||
};
|
||||
}
|
40
plugins/by-name/intellitab/default.nix
Normal file
40
plugins/by-name/intellitab/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.intellitab;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.intellitab = {
|
||||
enable = mkEnableOption "intellitab.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "intellitab.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"intellitab-nvim"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "i";
|
||||
key = "<Tab>";
|
||||
action.__raw = "require('intellitab').indent";
|
||||
}
|
||||
];
|
||||
plugins.treesitter = {
|
||||
settings.indent.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
54
plugins/by-name/lastplace/default.nix
Normal file
54
plugins/by-name/lastplace/default.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.plugins.lastplace;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.plugins.lastplace = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "lastplace";
|
||||
|
||||
package = lib.mkPackageOption pkgs "lastplace" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-lastplace"
|
||||
];
|
||||
};
|
||||
|
||||
ignoreBuftype = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"quickfix"
|
||||
"nofix"
|
||||
"help"
|
||||
] "The list of buffer types to ignore by lastplace.";
|
||||
|
||||
ignoreFiletype = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"gitcommit"
|
||||
"gitrebase"
|
||||
"svn"
|
||||
"hgcommit"
|
||||
] "The list of file types to ignore by lastplace.";
|
||||
|
||||
openFolds = helpers.defaultNullOpts.mkBool true "Whether closed folds are automatically opened when jumping to the last edit position.";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options = {
|
||||
lastplace_ignore_buftype = cfg.ignoreBuftype;
|
||||
lastplace_ignore_filetype = cfg.ignoreFiletype;
|
||||
lastplace_open_folds = cfg.openFolds;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-lastplace').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
191
plugins/by-name/leap/default.nix
Normal file
191
plugins/by-name/leap/default.nix
Normal file
|
@ -0,0 +1,191 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.leap;
|
||||
in
|
||||
{
|
||||
options.plugins.leap = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "leap.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "leap.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"leap-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
addDefaultMappings = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable the default mappings.";
|
||||
};
|
||||
|
||||
maxPhaseOneTargets = helpers.mkNullOrOption types.int ''
|
||||
By default, the plugin shows labels and/or highlights matches right after the first input
|
||||
character.
|
||||
This option disables ahead-of-time displaying of target beacons beyond a certain number of
|
||||
phase one targets (to mitigate visual noise in extreme cases).
|
||||
Setting it to 0 disables two-phase processing altogether.
|
||||
'';
|
||||
|
||||
highlightUnlabeledPhaseOneTargets = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to highlight unlabeled (i.e., directly reachable) matches after the first input
|
||||
character.
|
||||
'';
|
||||
|
||||
maxHighlightedTraversalTargets = helpers.defaultNullOpts.mkInt 10 ''
|
||||
Number of targets to be highlighted after the cursor in `|leap-traversal|` mode (when there
|
||||
are no labels at all).
|
||||
'';
|
||||
|
||||
caseSensitive = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to consider case in search patterns.
|
||||
'';
|
||||
|
||||
equivalenceClasses = helpers.defaultNullOpts.mkListOf' {
|
||||
type = with types; either str (listOf str);
|
||||
description = ''
|
||||
A character will match any other in its equivalence class. The sets can
|
||||
either be defined as strings or tables.
|
||||
|
||||
Note: Make sure to have a set containing `\n` if you want to be able to
|
||||
target characters at the end of the line.
|
||||
|
||||
Note: Non-mutual aliases are not possible in Leap, for the same reason
|
||||
that supporting |smartcase| is not possible: we would need to show two
|
||||
different labels, corresponding to two different futures, at the same
|
||||
time.
|
||||
'';
|
||||
pluginDefault = [ " \t\r\n" ];
|
||||
example = [
|
||||
"\r\n"
|
||||
")]}>"
|
||||
"([{<"
|
||||
[
|
||||
"\""
|
||||
"'"
|
||||
"`"
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
substituteChars = helpers.defaultNullOpts.mkAttrsOf' {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The keys in this attrs will be substituted in labels and highlighted matches by the given
|
||||
characters.
|
||||
This way special (e.g. whitespace) characters can be made visible in matches, or even be
|
||||
used as labels.
|
||||
'';
|
||||
pluginDefault = { };
|
||||
example = {
|
||||
"\r" = "¬";
|
||||
};
|
||||
};
|
||||
|
||||
safeLabels =
|
||||
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; maybeRaw (listOf str))
|
||||
(stringToCharacters "sfnut/SFNLHMUGT?Z")
|
||||
''
|
||||
When the number of matches does not exceed the number of these "safe" labels plus one, the
|
||||
plugin jumps to the first match automatically after entering the pattern.
|
||||
Obviously, for this purpose you should choose keys that are unlikely to be used right
|
||||
after a jump!
|
||||
|
||||
Setting the list to `[]` effectively disables the autojump feature.
|
||||
|
||||
Note: Operator-pending mode ignores this, since we need to be able to select the actual
|
||||
target before executing the operation.
|
||||
'';
|
||||
|
||||
labels =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
(stringToCharacters "sfnjklhodwembuyvrgtcx/zSFNJKLHODWEMBUYVRGTCX?Z")
|
||||
''
|
||||
Target labels to be used when there are more matches than labels in
|
||||
`|leap.opts.safe_labels|` plus one.
|
||||
|
||||
Setting the list to `[]` forces autojump to always be on (except for Operator-pending
|
||||
mode, where it makes no sense).
|
||||
In this case, do not forget to set `special_keys.next_group` to something "safe" too.
|
||||
'';
|
||||
|
||||
specialKeys = {
|
||||
nextTarget = helpers.defaultNullOpts.mkStr "<enter>" ''
|
||||
Key captured by the plugin at runtime to jump to the next match in traversal mode
|
||||
(`|leap-traversal|`)
|
||||
'';
|
||||
|
||||
prevTarget = helpers.defaultNullOpts.mkStr "<tab>" ''
|
||||
Key captured by the plugin at runtime to jump to the previous match in traversal mode
|
||||
(`|leap-traversal|`)
|
||||
'';
|
||||
|
||||
nextGroup = helpers.defaultNullOpts.mkStr "<space>" ''
|
||||
Key captured by the plugin at runtime to switch to the next group of matches, when there
|
||||
are more matches than available labels.
|
||||
'';
|
||||
|
||||
prevGroup = helpers.defaultNullOpts.mkStr "<tab>" ''
|
||||
Key captured by the plugin at runtime to switch to the previous group of matches, when
|
||||
there are more matches than available labels.
|
||||
'';
|
||||
|
||||
multiAccept = helpers.defaultNullOpts.mkStr "<enter>" ''
|
||||
Key captured by the plugin at runtime to accept the selection in `|leap-multiselect|`
|
||||
mode.
|
||||
'';
|
||||
|
||||
multiRevert = helpers.defaultNullOpts.mkStr "<backspace>" ''
|
||||
Key captured by the plugin at runtime to deselect the last selected target in
|
||||
`|leap-multiselect|` mode.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
max_phase_one_targets = maxPhaseOneTargets;
|
||||
highlight_unlabeled_phase_one_targets = highlightUnlabeledPhaseOneTargets;
|
||||
max_highlighted_traversal_targets = maxHighlightedTraversalTargets;
|
||||
case_sensitive = caseSensitive;
|
||||
equivalence_classes = equivalenceClasses;
|
||||
substitute_chars = substituteChars;
|
||||
safe_labels = safeLabels;
|
||||
inherit labels;
|
||||
special_keys = with specialKeys; {
|
||||
next_target = nextTarget;
|
||||
prev_target = prevTarget;
|
||||
next_group = nextGroup;
|
||||
prev_group = prevGroup;
|
||||
multi_accept = multiAccept;
|
||||
multi_revert = multiRevert;
|
||||
};
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
(optionalString cfg.addDefaultMappings ''
|
||||
require('leap').add_default_mappings()
|
||||
'')
|
||||
+ (optionalString (options != { }) ''
|
||||
require('leap').opts = vim.tbl_deep_extend(
|
||||
"keep",
|
||||
${helpers.toLuaObject options},
|
||||
require('leap').opts
|
||||
)
|
||||
'');
|
||||
};
|
||||
}
|
91
plugins/by-name/magma-nvim/default.nix
Normal file
91
plugins/by-name/magma-nvim/default.nix
Normal file
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "magma-nvim";
|
||||
originalName = "magma-nvim";
|
||||
package = "magma-nvim-goose";
|
||||
globalPrefix = "magma_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"imageProvider"
|
||||
"automaticallyOpenOutput"
|
||||
"wrapOutput"
|
||||
"outputWindowBorders"
|
||||
"cellHighlightGroup"
|
||||
"savePath"
|
||||
"showMimetypeDebug"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
image_provider =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"none"
|
||||
"ueberzug"
|
||||
"kitty"
|
||||
]
|
||||
''
|
||||
This configures how to display images. The following options are available:
|
||||
- "none" -- don't show images.
|
||||
- "ueberzug" -- use Ueberzug to display images.
|
||||
- "kitty" -- use the Kitty protocol to display images.
|
||||
'';
|
||||
|
||||
automatically_open_output = helpers.defaultNullOpts.mkBool true ''
|
||||
If this is true, then whenever you have an active cell its output window will be
|
||||
automatically shown.
|
||||
|
||||
If this is false, then the output window will only be automatically shown when you've just
|
||||
evaluated the code.
|
||||
So, if you take your cursor out of the cell, and then come back, the output window won't be
|
||||
opened (but the cell will be highlighted).
|
||||
This means that there will be nothing covering your code.
|
||||
You can then open the output window at will using `:MagmaShowOutput`.
|
||||
'';
|
||||
|
||||
wrap_output = helpers.defaultNullOpts.mkBool true ''
|
||||
If this is true, then text output in the output window will be wrapped (akin to `set wrap`).
|
||||
'';
|
||||
|
||||
output_window_borders = helpers.defaultNullOpts.mkBool true ''
|
||||
If this is true, then the output window will have rounded borders.
|
||||
If it is false, it will have no borders.
|
||||
'';
|
||||
|
||||
cell_highlight_group = helpers.defaultNullOpts.mkStr "CursorLine" ''
|
||||
The highlight group to be used for highlighting cells.
|
||||
'';
|
||||
|
||||
save_path = helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath('data') .. '/magma'"; } ''
|
||||
Where to save/load with `:MagmaSave` and `:MagmaLoad` (with no parameters).
|
||||
The generated file is placed in this directory, with the filename itself being the
|
||||
buffer's name, with `%` replaced by `%%` and `/` replaced by `%`, and postfixed with the
|
||||
extension `.json`.
|
||||
'';
|
||||
|
||||
show_mimetype_debug = helpers.defaultNullOpts.mkBool false ''
|
||||
If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it
|
||||
received for it.
|
||||
This is meant for debugging and adding new mimetypes.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
image_provider = "none";
|
||||
automatically_open_output = true;
|
||||
wrap_output = true;
|
||||
output_window_borders = true;
|
||||
cell_highlight_group = "CursorLine";
|
||||
save_path.__raw = "vim.fn.stdpath('data') .. '/magma'";
|
||||
show_mimetype_debug = false;
|
||||
};
|
||||
}
|
48
plugins/by-name/mark-radar/default.nix
Normal file
48
plugins/by-name/mark-radar/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.mark-radar;
|
||||
in
|
||||
{
|
||||
options.plugins.mark-radar = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "mark-radar";
|
||||
|
||||
package = lib.mkPackageOption pkgs "mark-radar" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"mark-radar-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
setDefaultMappings = helpers.defaultNullOpts.mkBool true "Whether to set default mappings.";
|
||||
|
||||
highlightGroup = helpers.defaultNullOpts.mkStr "RadarMark" "The name of the highlight group to use.";
|
||||
|
||||
backgroundHighlight = helpers.defaultNullOpts.mkBool true "Whether to highlight the background.";
|
||||
|
||||
backgroundHighlightGroup = helpers.defaultNullOpts.mkStr "RadarBackground" "The name of the highlight group to use for the background.";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
set_default_mappings = cfg.setDefaultMappings;
|
||||
highlight_group = cfg.highlightGroup;
|
||||
background_highlight = cfg.backgroundHighlight;
|
||||
background_highlight_group = cfg.backgroundHighlightGroup;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("mark-radar").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
190
plugins/by-name/marks/default.nix
Normal file
190
plugins/by-name/marks/default.nix
Normal file
|
@ -0,0 +1,190 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.marks;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.marks = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "marks.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "marks.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"marks-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
builtinMarks =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(types.enum [
|
||||
"'"
|
||||
"^"
|
||||
"."
|
||||
"<"
|
||||
">"
|
||||
])
|
||||
[ ]
|
||||
''
|
||||
Which builtin marks to track and show. If set, these marks will also show up in the
|
||||
signcolumn and will update on `|CursorMoved|`.
|
||||
'';
|
||||
|
||||
defaultMappings = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to use the default plugin mappings or not.
|
||||
See `|marks-mappings|` for more.
|
||||
'';
|
||||
|
||||
signs = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to show marks in the signcolumn or not.
|
||||
If set to true, its recommended to also set `|signcolumn|` to "auto", for cases where
|
||||
multiple marks are placed on the same line.
|
||||
'';
|
||||
|
||||
cyclic = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether forward/backwards movement should cycle back to the beginning/end of buffer.
|
||||
'';
|
||||
|
||||
forceWriteShada = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, then deleting global (uppercase) marks will also update the `|shada|` file
|
||||
accordingly and force deletion of the mark permanently.
|
||||
This option can be destructive and should be set only after reading more about the shada
|
||||
file.
|
||||
'';
|
||||
|
||||
refreshInterval = helpers.defaultNullOpts.mkUnsignedInt 150 ''
|
||||
How often (in ms) `marks.nvim` should update the marks list and recompute mark
|
||||
positions/redraw signs.
|
||||
Lower values means that mark positions and signs will refresh much quicker, but may incur a
|
||||
higher performance penalty, whereas higher values may result in better performance, but may
|
||||
also cause noticeable lag in signs updating.
|
||||
'';
|
||||
|
||||
signPriority =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either ints.unsigned (submodule {
|
||||
freeformType = attrs;
|
||||
options = mapAttrs (name: desc: helpers.mkNullOrOption ints.unsigned "Sign priority for ${desc}.") {
|
||||
lower = "lowercase marks";
|
||||
upper = "uppercase marks";
|
||||
builtin = "builtin marks";
|
||||
bookmark = "bookmarks";
|
||||
};
|
||||
})
|
||||
)
|
||||
10
|
||||
''
|
||||
The sign priority to be used for marks.
|
||||
Can either be a number, in which case the priority applies to all types of marks, or a
|
||||
table with some or all of the following keys:
|
||||
|
||||
- lower: sign priority for lowercase marks
|
||||
- upper: sign priority for uppercase marks
|
||||
- builtin: sign priority for builtin marks
|
||||
- bookmark: sign priority for bookmarks
|
||||
'';
|
||||
|
||||
excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Which filetypes to ignore.
|
||||
If a buffer with this filetype is opened, then `marks.nvim` will not track any marks set in
|
||||
this buffer, and will not display any signs.
|
||||
Setting and moving to marks with ` or ' will still work, but movement commands like "m]" or
|
||||
"m[" will not.
|
||||
'';
|
||||
|
||||
excludedBuftypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Which buftypes to ignore.
|
||||
If a buffer with this buftype is opened, then `marks.nvim` will not track any marks set in
|
||||
this buffer, and will not display any signs.
|
||||
Setting and moving to marks with ` or ' will still work, but movement commands like "m]" or
|
||||
"m[" will not.
|
||||
'';
|
||||
|
||||
bookmarks = mkOption {
|
||||
description = "Configuration table for each bookmark group (see `|marks-bookmarks|`).";
|
||||
type =
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
sign = helpers.mkNullOrOption (either str (enum [ false ])) ''
|
||||
The character to use in the signcolumn for this bookmark group.
|
||||
|
||||
Defaults to "!@#$%^&*()" - in order from group 1 to 10.
|
||||
Set to `false` to turn off signs for this bookmark.
|
||||
'';
|
||||
|
||||
virtText = helpers.mkNullOrOption str ''
|
||||
Virtual text annotations to place at the eol of a bookmark.
|
||||
Defaults to `null`, meaning no virtual text.
|
||||
'';
|
||||
|
||||
annotate = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, explicitly prompts the user for an annotation that will be displayed
|
||||
above the bookmark.
|
||||
'';
|
||||
};
|
||||
});
|
||||
default = { };
|
||||
apply = mapAttrs (
|
||||
_: v: with v; {
|
||||
inherit sign;
|
||||
virt_text = virtText;
|
||||
inherit annotate;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
mappings = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ])) { } ''
|
||||
Custom mappings.
|
||||
Set a mapping to `false` to disable it.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = all (n: elem n (range 0 9)) (attrNames cfg.bookmarks);
|
||||
message = ''
|
||||
Nixvim (plugins.marks): The keys of the `bookmarks` option should be integers between 0 and 9.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
bookmarks = mapAttrs' (
|
||||
bookmarkNumber: bookmarkOptions: nameValuePair "bookmark_${bookmarkNumber}" bookmarkOptions
|
||||
) cfg.bookmarks;
|
||||
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
builtin_marks = builtinMarks;
|
||||
default_mappings = defaultMappings;
|
||||
inherit signs cyclic;
|
||||
force_write_shada = forceWriteShada;
|
||||
refresh_interval = refreshInterval;
|
||||
sign_priority = signPriority;
|
||||
excluded_filetypes = excludedFiletypes;
|
||||
excluded_buftypes = excludedBuftypes;
|
||||
inherit mappings;
|
||||
}
|
||||
// bookmarks
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('marks').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
112
plugins/by-name/mini/default.nix
Normal file
112
plugins/by-name/mini/default.nix
Normal file
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "mini";
|
||||
originalName = "mini.nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
package = "mini-nvim";
|
||||
|
||||
extraOptions = {
|
||||
mockDevIcons = lib.mkEnableOption "mockDevIcons" // {
|
||||
defaultText = lib.literalMD "`false` **NOTE**: This option is experimental and the default value may change without notice.";
|
||||
description = ''
|
||||
Whether to tell `mini.icons` to emulate `nvim-web-devicons` for plugins that don't natively support it.
|
||||
|
||||
When enabled, you don't need to set `plugins.web-devicons.enable`. This will replace the need for it.
|
||||
'';
|
||||
};
|
||||
modules = lib.mkOption {
|
||||
type = with lib.types; attrsOf (attrsOf anything);
|
||||
default = { };
|
||||
description = ''
|
||||
Enable and configure the mini modules.
|
||||
|
||||
The attr name represent mini's module names, without the `"mini."` prefix.
|
||||
The attr value is an attrset of options provided to the module's `setup` function.
|
||||
|
||||
See the [plugin documentation] for available modules to configure:
|
||||
|
||||
[plugin documentation]: https://github.com/echasnovski/mini.nvim?tab=readme-ov-file#modules
|
||||
'';
|
||||
example = {
|
||||
ai = {
|
||||
n_lines = 50;
|
||||
search_method = "cover_or_next";
|
||||
};
|
||||
diff = {
|
||||
view = {
|
||||
style = "sign";
|
||||
};
|
||||
};
|
||||
comment = {
|
||||
mappings = {
|
||||
comment = "<leader>/";
|
||||
comment_line = "<leader>/";
|
||||
comment_visual = "<leader>/";
|
||||
textobject = "<leader>/";
|
||||
};
|
||||
};
|
||||
surround = {
|
||||
mappings = {
|
||||
add = "gsa";
|
||||
delete = "gsd";
|
||||
find = "gsf";
|
||||
find_left = "gsF";
|
||||
highlight = "gsh";
|
||||
replace = "gsr";
|
||||
update_n_lines = "gsn";
|
||||
};
|
||||
};
|
||||
starter = {
|
||||
header = ''
|
||||
███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗
|
||||
████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║
|
||||
██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║
|
||||
██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
'';
|
||||
evaluate_single = true;
|
||||
items = {
|
||||
"__unkeyed-1.buildtin_actions".__raw = "require('mini.starter').sections.builtin_actions()";
|
||||
"__unkeyed-2.recent_files_current_directory".__raw = "require('mini.starter').sections.recent_files(10, false)";
|
||||
"__unkeyed-3.recent_files".__raw = "require('mini.starter').sections.recent_files(10, true)";
|
||||
"__unkeyed-4.sessions".__raw = "require('mini.starter').sections.sessions(5, true)";
|
||||
};
|
||||
content_hooks = {
|
||||
"__unkeyed-1.adding_bullet".__raw = "require('mini.starter').gen_hook.adding_bullet()";
|
||||
"__unkeyed-2.indexing".__raw = "require('mini.starter').gen_hook.indexing('all', { 'Builtin actions' })";
|
||||
"__unkeyed-3.padding".__raw = "require('mini.starter').gen_hook.aligning('center', 'center')";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# NOTE: We handle each module explicitly and not a parent settings table
|
||||
callSetup = false;
|
||||
hasSettings = false;
|
||||
extraConfig = cfg: {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.mockDevIcons -> cfg.modules ? icons;
|
||||
message = ''
|
||||
You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`.
|
||||
This setting will have no effect without it.
|
||||
'';
|
||||
}
|
||||
];
|
||||
extraConfigLua =
|
||||
lib.foldlAttrs (lines: name: config: ''
|
||||
${lines}
|
||||
require(${lib.nixvim.toLuaObject "mini.${name}"}).setup(${lib.nixvim.toLuaObject config})
|
||||
'') "" cfg.modules
|
||||
# `MiniIcons` is only in scope if we've called `require('mini.icons')` above
|
||||
+ lib.optionalString ((cfg.modules ? icons) && cfg.mockDevIcons) ''
|
||||
MiniIcons.mock_nvim_web_devicons()
|
||||
'';
|
||||
};
|
||||
}
|
651
plugins/by-name/mkdnflow/default.nix
Normal file
651
plugins/by-name/mkdnflow/default.nix
Normal file
|
@ -0,0 +1,651 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.mkdnflow;
|
||||
in
|
||||
{
|
||||
options.plugins.mkdnflow = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "mkdnflow.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "mkdnflow.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"mkdnflow-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
modules =
|
||||
mapAttrs
|
||||
(
|
||||
moduleName: metadata:
|
||||
helpers.defaultNullOpts.mkBool metadata.default ''
|
||||
Enable module ${moduleName}.
|
||||
${metadata.description}
|
||||
''
|
||||
)
|
||||
{
|
||||
bib = {
|
||||
default = true;
|
||||
description = "Required for parsing bib files and following citations.";
|
||||
};
|
||||
buffers = {
|
||||
default = true;
|
||||
description = "Required for backward and forward navigation through buffers.";
|
||||
};
|
||||
conceal = {
|
||||
default = true;
|
||||
description = ''
|
||||
Required if you wish to enable link concealing.
|
||||
Note that you must declare `links.conceal` as `true` in addition to enabling this
|
||||
module if you wish to conceal links.
|
||||
'';
|
||||
};
|
||||
cursor = {
|
||||
default = true;
|
||||
description = "Required for jumping to links and headings; yanking anchor links.";
|
||||
};
|
||||
folds = {
|
||||
default = true;
|
||||
description = "Required for folding by section.";
|
||||
};
|
||||
links = {
|
||||
default = true;
|
||||
description = "Required for creating and destroying links and following links.";
|
||||
};
|
||||
lists = {
|
||||
default = true;
|
||||
description = "Required for manipulating lists, toggling to-do list items, etc.";
|
||||
};
|
||||
maps = {
|
||||
default = true;
|
||||
description = ''
|
||||
Required for setting mappings via the mappings table.
|
||||
Set to `false` if you wish to set mappings outside of the plugin.
|
||||
'';
|
||||
};
|
||||
paths = {
|
||||
default = true;
|
||||
description = "Required for link interpretation and following links.";
|
||||
};
|
||||
tables = {
|
||||
default = true;
|
||||
description = "Required for table navigation and formatting.";
|
||||
};
|
||||
yaml = {
|
||||
default = false;
|
||||
description = "Required for parsing yaml blocks.";
|
||||
};
|
||||
};
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||
{
|
||||
md = true;
|
||||
rmd = true;
|
||||
markdown = true;
|
||||
}
|
||||
''
|
||||
A matching extension will enable the plugin's functionality for a file with that
|
||||
extension.
|
||||
|
||||
NOTE: This functionality references the file's extension. It does not rely on
|
||||
Neovim's filetype recognition.
|
||||
The extension must be provided in lower case because the plugin converts file names to
|
||||
lowercase.
|
||||
Any arbitrary extension can be supplied.
|
||||
Setting an extension to `false` is the same as not including it in the list.
|
||||
'';
|
||||
|
||||
createDirs = helpers.defaultNullOpts.mkBool true ''
|
||||
- `true`: Directories referenced in a link will be (recursively) created if they do not
|
||||
exist.
|
||||
- `false`: No action will be taken when directories referenced in a link do not exist.
|
||||
Neovim will open a new file, but you will get an error when you attempt to write the
|
||||
file.
|
||||
'';
|
||||
|
||||
perspective = {
|
||||
priority =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"first"
|
||||
"current"
|
||||
"root"
|
||||
]
|
||||
''
|
||||
Specifies the priority perspective to take when interpreting link paths
|
||||
|
||||
- `first` (default): Links will be interpreted relative to the first-opened file (when
|
||||
the current instance of Neovim was started)
|
||||
- `current`: Links will be interpreted relative to the current file
|
||||
- `root`: Links will be interpreted relative to the root directory of the current
|
||||
notebook (requires `perspective.root_tell` to be specified)
|
||||
'';
|
||||
|
||||
fallback =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"first"
|
||||
"current"
|
||||
"root"
|
||||
]
|
||||
''
|
||||
Specifies the backup perspective to take if priority isn't possible (e.g. if it is
|
||||
`root` but no root directory is found).
|
||||
|
||||
- `first` (default): Links will be interpreted relative to the first-opened file (when
|
||||
the current instance of Neovim was started)
|
||||
- `current`: Links will be interpreted relative to the current file
|
||||
- `root`: Links will be interpreted relative to the root directory of the current
|
||||
notebook (requires `perspective.root_tell` to be specified)
|
||||
'';
|
||||
|
||||
rootTell = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str) false ''
|
||||
- `<any file name>`: Any arbitrary filename by which the plugin can uniquely identify
|
||||
the root directory of the current notebook.
|
||||
- If `false` is used instead, the plugin will never search for a root directory, even
|
||||
if `perspective.priority` is set to `root`.
|
||||
'';
|
||||
|
||||
nvimWdHeel = helpers.defaultNullOpts.mkBool false ''
|
||||
Specifies whether changes in perspective will result in corresponding changes to
|
||||
Neovim's working directory.
|
||||
|
||||
- `true`: Changes in perspective will be reflected in the nvim working directory.
|
||||
(In other words, the working directory will "heel" to the plugin's perspective.)
|
||||
This helps ensure (at least) that path completions (if using a completion plugin with
|
||||
support for paths) will be accurate and usable.
|
||||
- `false` (default): Neovim's working directory will not be affected by Mkdnflow.
|
||||
'';
|
||||
|
||||
update = helpers.defaultNullOpts.mkBool true ''
|
||||
Determines whether the plugin looks to determine if a followed link is in a different
|
||||
notebook/wiki than before.
|
||||
If it is, the perspective will be updated.
|
||||
Requires `rootTell` to be defined and `priority` to be `root`.
|
||||
|
||||
- `true` (default): Perspective will be updated when following a link to a file in a
|
||||
separate notebook/wiki (or navigating backwards to a file in another notebook/wiki).
|
||||
- `false`: Perspective will be not updated when following a link to a file in a separate
|
||||
notebook/wiki.
|
||||
Under the hood, links in the file in the separate notebook/wiki will be interpreted
|
||||
relative to the original notebook/wiki.
|
||||
'';
|
||||
};
|
||||
|
||||
wrap = helpers.defaultNullOpts.mkBool false ''
|
||||
- `true`: When jumping to next/previous links or headings, the cursor will continue
|
||||
searching at the beginning/end of the file.
|
||||
- `false`: When jumping to next/previous links or headings, the cursor will stop searching
|
||||
at the end/beginning of the file.
|
||||
'';
|
||||
|
||||
bib = {
|
||||
defaultPath = helpers.mkNullOrOption types.str ''
|
||||
Specifies a path to a default `.bib` file to look for citation keys in (need not be in
|
||||
root directory of notebook).
|
||||
'';
|
||||
|
||||
findInRoot = helpers.defaultNullOpts.mkBool true ''
|
||||
- `true`: When `perspective.priority` is also set to `root` (and a root directory was
|
||||
found), the plugin will search for bib files to reference in the notebook's top-level
|
||||
directory.
|
||||
If `bib.default_path` is also specified, the default path will be appended to the list
|
||||
of bib files found in the top level directory so that it will also be searched.
|
||||
- `false`: The notebook's root directory will not be searched for bib files.
|
||||
'';
|
||||
};
|
||||
|
||||
silent = helpers.defaultNullOpts.mkBool false ''
|
||||
- `true`: The plugin will not display any messages in the console except compatibility
|
||||
warnings related to your config.
|
||||
- `false`: The plugin will display messages to the console (all messages from the plugin
|
||||
start with ⬇️ ).
|
||||
'';
|
||||
|
||||
links = {
|
||||
style =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"markdown"
|
||||
"wiki"
|
||||
]
|
||||
''
|
||||
- `markdown`: Links will be expected in the standard markdown format:
|
||||
`[<title>](<source>)`
|
||||
- `wiki`: Links will be expected in the unofficial wiki-link style, specifically the
|
||||
title-after-pipe format (see https://github.com/jgm/pandoc/pull/7705):
|
||||
`[[<source>|<title>]]`.
|
||||
'';
|
||||
|
||||
conceal = helpers.defaultNullOpts.mkBool false ''
|
||||
- `true`: Link sources and delimiters will be concealed (depending on which link style
|
||||
is selected)
|
||||
- `false`: Link sources and delimiters will not be concealed by mkdnflow
|
||||
'';
|
||||
|
||||
context = helpers.defaultNullOpts.mkInt 0 ''
|
||||
- `0` (default): When following or jumping to links, assume that no link will be split
|
||||
over multiple lines
|
||||
- `n`: When following or jumping to links, consider `n` lines before and after a given
|
||||
line (useful if you ever permit links to be interrupted by a hard line break)
|
||||
'';
|
||||
|
||||
implicitExtension = helpers.mkNullOrOption types.str ''
|
||||
A string that instructs the plugin (a) how to interpret links to files that do not have
|
||||
an extension, and (b) that new links should be created without an explicit extension.
|
||||
'';
|
||||
|
||||
transformExplicit = helpers.defaultNullOpts.mkStrLuaFnOr (types.enum [ false ]) false ''
|
||||
A function that transforms the text to be inserted as the source/path of a link when a
|
||||
link is created.
|
||||
Anchor links are not currently customizable.
|
||||
If you want all link paths to be explicitly prefixed with the year, for instance, and
|
||||
for the path to be converted to uppercase, you could provide the following function
|
||||
under this key.
|
||||
(NOTE: The previous functionality specified under the `prefix` key has been migrated
|
||||
here to provide greater flexibility.)
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(input)
|
||||
return(string.upper(os.date('%Y-')..input))
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
transformImplicit =
|
||||
helpers.defaultNullOpts.mkStrLuaFnOr (types.enum [ false ])
|
||||
''
|
||||
function(text)
|
||||
text = text:gsub(" ", "-")
|
||||
text = text:lower()
|
||||
text = os.date('%Y-%m-%d_')..text
|
||||
return(text)
|
||||
end
|
||||
''
|
||||
''
|
||||
A function that transforms the path of a link immediately before interpretation.
|
||||
It does not transform the actual text in the buffer but can be used to modify link
|
||||
interpretation.
|
||||
For instance, link paths that match a date pattern can be opened in a `journals`
|
||||
subdirectory of your notebook, and all others can be opened in a `pages` subdirectory,
|
||||
using the following function:
|
||||
|
||||
```lua
|
||||
function(input)
|
||||
if input:match('%d%d%d%d%-%d%d%-%d%d') then
|
||||
return('journals/'..input)
|
||||
else
|
||||
return('pages/'..input)
|
||||
end
|
||||
end
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
toDo = {
|
||||
symbols =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
" "
|
||||
"-"
|
||||
"X"
|
||||
]
|
||||
''
|
||||
A list of symbols (each no more than one character) that represent to-do list completion
|
||||
statuses.
|
||||
`MkdnToggleToDo` references these when toggling the status of a to-do item.
|
||||
Three are expected: one representing not-yet-started to-dos (default: `' '`), one
|
||||
representing in-progress to-dos (default: `-`), and one representing complete to-dos
|
||||
(default: `X`).
|
||||
|
||||
NOTE: Native Lua support for UTF-8 characters is limited, so in order to ensure all
|
||||
functionality works as intended if you are using non-ascii to-do symbols, you'll need to
|
||||
install the luarocks module "luautf8".
|
||||
'';
|
||||
|
||||
updateParents = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether parent to-dos' statuses should be updated based on child to-do status changes
|
||||
performed via `MkdnToggleToDo`
|
||||
|
||||
- `true` (default): Parent to-do statuses will be inferred and automatically updated
|
||||
when a child to-do's status is changed
|
||||
- `false`: To-do items can be toggled, but parent to-do statuses (if any) will not be
|
||||
automatically changed
|
||||
'';
|
||||
|
||||
notStarted = helpers.defaultNullOpts.mkStr " " ''
|
||||
This option can be used to stipulate which symbols shall be used when updating a parent
|
||||
to-do's status when a child to-do's status is changed.
|
||||
This is **not required**: if `toDo.symbols` is customized but this option is not
|
||||
provided, the plugin will attempt to infer what the meanings of the symbols in your list
|
||||
are by their order.
|
||||
|
||||
For example, if you set `toDo.symbols` as `[" " "⧖" "✓"]`, `" "` will be assigned to
|
||||
`toDo.notStarted`, "⧖" will be assigned to `toDo.inProgress`, etc.
|
||||
If more than three symbols are specified, the first will be used as `notStarted`, the
|
||||
second will be used as `inProgress`, and the last will be used as `complete`.
|
||||
If two symbols are provided (e.g. `" ", "✓"`), the first will be used as both
|
||||
`notStarted` and `inProgress`, and the second will be used as `complete`.
|
||||
|
||||
`toDo.notStarted` stipulates which symbol represents a not-yet-started to-do.
|
||||
'';
|
||||
|
||||
inProgress = helpers.defaultNullOpts.mkStr "-" ''
|
||||
This option can be used to stipulate which symbols shall be used when updating a parent
|
||||
to-do's status when a child to-do's status is changed.
|
||||
This is **not required**: if `toDo.symbols` is customized but this option is not
|
||||
provided, the plugin will attempt to infer what the meanings of the symbols in your list
|
||||
are by their order.
|
||||
|
||||
For example, if you set `toDo.symbols` as `[" " "⧖" "✓"]`, `" "` will be assigned to
|
||||
`toDo.notStarted`, "⧖" will be assigned to `toDo.inProgress`, etc.
|
||||
If more than three symbols are specified, the first will be used as `notStarted`, the
|
||||
second will be used as `inProgress`, and the last will be used as `complete`.
|
||||
If two symbols are provided (e.g. `" ", "✓"`), the first will be used as both
|
||||
`notStarted` and `inProgress`, and the second will be used as `complete`.
|
||||
|
||||
`toDo.inProgress` stipulates which symbol represents an in-progress to-do.
|
||||
'';
|
||||
|
||||
complete = helpers.defaultNullOpts.mkStr "X" ''
|
||||
This option can be used to stipulate which symbols shall be used when updating a parent
|
||||
to-do's status when a child to-do's status is changed.
|
||||
This is **not required**: if `toDo.symbols` is customized but this option is not
|
||||
provided, the plugin will attempt to infer what the meanings of the symbols in your list
|
||||
are by their order.
|
||||
|
||||
For example, if you set `toDo.symbols` as `[" " "⧖" "✓"]`, `" "` will be assigned to
|
||||
`toDo.notStarted`, "⧖" will be assigned to `toDo.inProgress`, etc.
|
||||
If more than three symbols are specified, the first will be used as `notStarted`, the
|
||||
second will be used as `inProgress`, and the last will be used as `complete`.
|
||||
If two symbols are provided (e.g. `" ", "✓"`), the first will be used as both
|
||||
`notStarted` and `inProgress`, and the second will be used as `complete`.
|
||||
|
||||
`toDo.complete` stipulates which symbol represents a complete to-do.
|
||||
'';
|
||||
};
|
||||
|
||||
tables = {
|
||||
trimWhitespace = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether extra whitespace should be trimmed from the end of a table cell when a table is
|
||||
formatted.
|
||||
'';
|
||||
|
||||
formatOnMove = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether tables should be formatted each time the cursor is moved via
|
||||
`MkdnTableNext/PrevCell` or `MkdnTableNext/Prev/Row`.
|
||||
'';
|
||||
|
||||
autoExtendRows = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether a new row should automatically be added to a table when `:MkdnTableNextRow` is
|
||||
triggered when the cursor is in the final row of the table.
|
||||
If `false`, the cursor will simply leave the table for the next line.
|
||||
'';
|
||||
|
||||
autoExtendCols = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether a new column should automatically be added to a table when `:MkdnTableNextCell`
|
||||
is triggered when the cursor is in the final column of the table.
|
||||
If false, the cursor will jump to the first cell of the next row, unless the cursor is
|
||||
already in the last row, in which case nothing will happen.
|
||||
'';
|
||||
};
|
||||
|
||||
yaml = {
|
||||
bib = {
|
||||
override = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether or not a bib path specified in a yaml block should be the only source
|
||||
considered for bib references in that file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
mappings =
|
||||
helpers.defaultNullOpts.mkAttrsOf
|
||||
(
|
||||
with types;
|
||||
either (enum [ false ]) (submodule {
|
||||
options = {
|
||||
modes = mkOption {
|
||||
type = either str (listOf str);
|
||||
description = ''
|
||||
Either a string or list representing the mode(s) that the mapping should apply
|
||||
in.
|
||||
'';
|
||||
example = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
};
|
||||
|
||||
key = mkOption {
|
||||
type = str;
|
||||
description = "String representing the keymap.";
|
||||
example = "<Space>";
|
||||
};
|
||||
};
|
||||
})
|
||||
)
|
||||
{
|
||||
MkdnEnter = {
|
||||
modes = [
|
||||
"n"
|
||||
"v"
|
||||
"i"
|
||||
];
|
||||
key = "<CR>";
|
||||
};
|
||||
MkdnTab = false;
|
||||
MkdnSTab = false;
|
||||
MkdnNextLink = {
|
||||
modes = "n";
|
||||
key = "<Tab>";
|
||||
};
|
||||
MkdnPrevLink = {
|
||||
modes = "n";
|
||||
key = "<S-Tab>";
|
||||
};
|
||||
MkdnNextHeading = {
|
||||
modes = "n";
|
||||
key = "]]";
|
||||
};
|
||||
MkdnPrevHeading = {
|
||||
modes = "n";
|
||||
key = "[[";
|
||||
};
|
||||
MkdnGoBack = {
|
||||
modes = "n";
|
||||
key = "<BS>";
|
||||
};
|
||||
MkdnGoForward = {
|
||||
modes = "n";
|
||||
key = "<Del>";
|
||||
};
|
||||
MkdnFollowLink = false; # see MkdnEnter
|
||||
MkdnCreateLink = false; # see MkdnEnter
|
||||
MkdnCreateLinkFromClipboard = {
|
||||
modes = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
key = "<leader>p";
|
||||
}; # see MkdnEnter
|
||||
MkdnDestroyLink = {
|
||||
modes = "n";
|
||||
key = "<M-CR>";
|
||||
};
|
||||
MkdnMoveSource = {
|
||||
modes = "n";
|
||||
key = "<F2>";
|
||||
};
|
||||
MkdnYankAnchorLink = {
|
||||
modes = "n";
|
||||
key = "ya";
|
||||
};
|
||||
MkdnYankFileAnchorLink = {
|
||||
modes = "n";
|
||||
key = "yfa";
|
||||
};
|
||||
MkdnIncreaseHeading = {
|
||||
modes = "n";
|
||||
key = "+";
|
||||
};
|
||||
MkdnDecreaseHeading = {
|
||||
modes = "n";
|
||||
key = "-";
|
||||
};
|
||||
MkdnToggleToDo = {
|
||||
modes = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
key = "<C-Space>";
|
||||
};
|
||||
MkdnNewListItem = false;
|
||||
MkdnNewListItemBelowInsert = {
|
||||
modes = "n";
|
||||
key = "o";
|
||||
};
|
||||
MkdnNewListItemAboveInsert = {
|
||||
modes = "n";
|
||||
key = "O";
|
||||
};
|
||||
MkdnExtendList = false;
|
||||
MkdnUpdateNumbering = {
|
||||
modes = "n";
|
||||
key = "<leader>nn";
|
||||
};
|
||||
MkdnTableNextCell = {
|
||||
modes = "i";
|
||||
key = "<Tab>";
|
||||
};
|
||||
MkdnTablePrevCell = {
|
||||
modes = "i";
|
||||
key = "<S-Tab>";
|
||||
};
|
||||
MkdnTableNextRow = false;
|
||||
MkdnTablePrevRow = {
|
||||
modes = "i";
|
||||
key = "<M-CR>";
|
||||
};
|
||||
MkdnTableNewRowBelow = {
|
||||
modes = "n";
|
||||
key = "<leader>ir";
|
||||
};
|
||||
MkdnTableNewRowAbove = {
|
||||
modes = "n";
|
||||
key = "<leader>iR";
|
||||
};
|
||||
MkdnTableNewColAfter = {
|
||||
modes = "n";
|
||||
key = "<leader>ic";
|
||||
};
|
||||
MkdnTableNewColBefore = {
|
||||
modes = "n";
|
||||
key = "<leader>iC";
|
||||
};
|
||||
MkdnFoldSection = {
|
||||
modes = "n";
|
||||
key = "<leader>f";
|
||||
};
|
||||
MkdnUnfoldSection = {
|
||||
modes = "n";
|
||||
key = "<leader>F";
|
||||
};
|
||||
}
|
||||
''
|
||||
An attrs declaring the key mappings.
|
||||
The keys should be the name of a commands defined in
|
||||
`mkdnflow.nvim/plugin/mkdnflow.lua` (see `:h Mkdnflow-commands` for a list).
|
||||
Set to `false` to disable a mapping.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
modules = with modules; {
|
||||
inherit
|
||||
bib
|
||||
buffers
|
||||
conceal
|
||||
cursor
|
||||
folds
|
||||
links
|
||||
lists
|
||||
maps
|
||||
paths
|
||||
tables
|
||||
yaml
|
||||
;
|
||||
};
|
||||
inherit filetypes;
|
||||
create_dirs = createDirs;
|
||||
perspective = with perspective; {
|
||||
inherit priority fallback;
|
||||
root_tell = rootTell;
|
||||
nvim_wd_heel = nvimWdHeel;
|
||||
inherit update;
|
||||
};
|
||||
inherit wrap;
|
||||
bib = with bib; {
|
||||
default_path = defaultPath;
|
||||
find_in_root = findInRoot;
|
||||
};
|
||||
inherit silent;
|
||||
links = with links; {
|
||||
inherit style conceal context;
|
||||
implicit_extension = implicitExtension;
|
||||
transform_implicit = transformImplicit;
|
||||
transform_explicit = transformExplicit;
|
||||
};
|
||||
to_do = with toDo; {
|
||||
inherit symbols;
|
||||
update_parents = updateParents;
|
||||
not_started = notStarted;
|
||||
in_progress = inProgress;
|
||||
inherit complete;
|
||||
};
|
||||
tables = with tables; {
|
||||
trim_whitespace = trimWhitespace;
|
||||
format_on_move = formatOnMove;
|
||||
auto_extend_rows = autoExtendRows;
|
||||
auto_extend_cols = autoExtendCols;
|
||||
};
|
||||
yaml = with yaml; {
|
||||
bib = with bib; {
|
||||
inherit override;
|
||||
};
|
||||
};
|
||||
mappings = helpers.ifNonNull' mappings (
|
||||
mapAttrs (
|
||||
action: options:
|
||||
if isBool options then
|
||||
options
|
||||
else
|
||||
[
|
||||
options.modes
|
||||
options.key
|
||||
]
|
||||
) mappings
|
||||
);
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("mkdnflow").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
240
plugins/by-name/molten/default.nix
Normal file
240
plugins/by-name/molten/default.nix
Normal file
|
@ -0,0 +1,240 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "molten";
|
||||
originalName = "molten-nvim";
|
||||
package = "molten-nvim";
|
||||
globalPrefix = "molten_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-01: remove 2024-05-01
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"autoOpenOutput"
|
||||
"copyOutput"
|
||||
"enterOutputBehavior"
|
||||
"imageProvider"
|
||||
"outputCropBorder"
|
||||
"outputShowMore"
|
||||
"outputVirtLines"
|
||||
"outputWinBorder"
|
||||
"outputWinCoverGutter"
|
||||
"outputWinHideOnLeave"
|
||||
"outputWinMaxHeight"
|
||||
"outputWinMaxWidth"
|
||||
"outputWinStyle"
|
||||
"savePath"
|
||||
"useBorderHighlights"
|
||||
"virtLinesOffBy1"
|
||||
"wrapOutput"
|
||||
"showMimetypeDebug"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
auto_image_popup = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, cells that produce an image output will open the image output automatically with
|
||||
python's `Image.show()`.
|
||||
'';
|
||||
|
||||
auto_init_behavior = helpers.defaultNullOpts.mkStr "init" ''
|
||||
When set to "raise" commands which would otherwise ask for a kernel when they're run without
|
||||
a running kernel will instead raise an exception.
|
||||
Useful for other plugins that want to use `pcall` and do their own error handling.
|
||||
'';
|
||||
|
||||
auto_open_html_in_browser = helpers.defaultNullOpts.mkBool false ''
|
||||
Automatically open HTML outputs in a browser. related: `open_cmd`.
|
||||
'';
|
||||
|
||||
auto_open_output = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically open the floating output window when your cursor moves into a cell.
|
||||
'';
|
||||
|
||||
cover_empty_lines = helpers.defaultNullOpts.mkBool false ''
|
||||
The output window and virtual text will be shown just below the last line of code in the
|
||||
cell.
|
||||
'';
|
||||
|
||||
cover_lines_starting_with = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
When `cover_empty_lines` is `true`, also covers lines starting with these strings.
|
||||
'';
|
||||
|
||||
copy_output = helpers.defaultNullOpts.mkBool false ''
|
||||
Copy evaluation output to clipboard automatically (requires `pyperclip`).
|
||||
'';
|
||||
|
||||
enter_output_behavior = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"open_then_enter"
|
||||
"open_and_enter"
|
||||
"no_open"
|
||||
] "The behavior of [MoltenEnterOutput](https://github.com/benlubas/molten-nvim#moltenenteroutput).";
|
||||
|
||||
image_provider =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"none"
|
||||
"image.nvim"
|
||||
]
|
||||
''
|
||||
How images are displayed.
|
||||
'';
|
||||
|
||||
open_cmd = helpers.mkNullOrOption types.str ''
|
||||
Defaults to `xdg-open` on Linux, `open` on Darwin, and `start` on Windows.
|
||||
But you can override it to whatever you want.
|
||||
The command is called like: `subprocess.run([open_cmd, filepath])`
|
||||
'';
|
||||
|
||||
output_crop_border = helpers.defaultNullOpts.mkBool true ''
|
||||
'crops' the bottom border of the output window when it would otherwise just sit at the
|
||||
bottom of the screen.
|
||||
'';
|
||||
|
||||
output_show_more = helpers.defaultNullOpts.mkBool false ''
|
||||
When the window can't display the entire contents of the output buffer, shows the number of
|
||||
extra lines in the window footer (requires nvim 10.0+ and a window border).
|
||||
'';
|
||||
|
||||
output_virt_lines = helpers.defaultNullOpts.mkBool false ''
|
||||
Pad the main buffer with virtual lines so the floating window doesn't cover anything while
|
||||
it's open.
|
||||
'';
|
||||
|
||||
output_win_border = helpers.defaultNullOpts.mkBorder [
|
||||
""
|
||||
"━"
|
||||
""
|
||||
""
|
||||
] "output window" "";
|
||||
|
||||
output_win_cover_gutter = helpers.defaultNullOpts.mkBool true ''
|
||||
Should the output window cover the gutter (numbers and sign col), or not.
|
||||
If you change this, you probably also want to change `output_win_style`.
|
||||
'';
|
||||
|
||||
output_win_hide_on_leave = helpers.defaultNullOpts.mkBool true ''
|
||||
After leaving the output window (via `:q` or switching windows), do not attempt to redraw
|
||||
the output window.
|
||||
'';
|
||||
|
||||
output_win_max_height = helpers.defaultNullOpts.mkUnsignedInt 999999 ''
|
||||
Max height of the output window.
|
||||
'';
|
||||
|
||||
output_win_max_width = helpers.defaultNullOpts.mkUnsignedInt 999999 ''
|
||||
Max width of the output window.
|
||||
'';
|
||||
|
||||
output_win_style =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
false
|
||||
"minimal"
|
||||
]
|
||||
''
|
||||
Value passed to the style option in `:h nvim_open_win()`.
|
||||
'';
|
||||
|
||||
save_path = helpers.defaultNullOpts.mkStr {
|
||||
__raw = "vim.fn.stdpath('data')..'/molten'";
|
||||
} "Where to save/load data with `:MoltenSave` and `:MoltenLoad`.";
|
||||
|
||||
tick_rate = helpers.defaultNullOpts.mkUnsignedInt 500 ''
|
||||
How often (in ms) we poll the kernel for updates.
|
||||
Determines how quickly the ui will update, if you want a snappier experience, you can set
|
||||
this to 150 or 200.
|
||||
'';
|
||||
|
||||
use_border_highlights = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, uses different highlights for output border depending on the state of the cell
|
||||
(running, done, error).
|
||||
'';
|
||||
|
||||
limit_output_chars = helpers.defaultNullOpts.mkUnsignedInt 1000000 ''
|
||||
Limit on the number of chars in an output.
|
||||
If you're lagging your editor with too much output text, decrease it.
|
||||
'';
|
||||
|
||||
virt_lines_off_by_1 = helpers.defaultNullOpts.mkBool false ''
|
||||
Allows the output window to cover exactly one line of the regular buffer when
|
||||
`output_virt_lines` is `true`, also effects where `virt_text_output` is displayed.
|
||||
(useful for running code in a markdown file where that covered line will just be ```).
|
||||
'';
|
||||
|
||||
virt_text_output = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, show output as virtual text below the cell, virtual text stays after leaving the
|
||||
cell.
|
||||
When true, output window doesn't open automatically on run.
|
||||
Effected by `virt_lines_off_by_1`.
|
||||
'';
|
||||
|
||||
virt_text_max_lines = helpers.defaultNullOpts.mkUnsignedInt 12 ''
|
||||
Max height of the virtual text.
|
||||
'';
|
||||
|
||||
wrap_output = helpers.defaultNullOpts.mkBool false ''
|
||||
Wrap output text.
|
||||
'';
|
||||
|
||||
show_mimetype_debug = helpers.defaultNullOpts.mkBool false ''
|
||||
Before any non-iostream output chunk, the mime-type for that output chunk is shown.
|
||||
Meant for debugging/plugin development.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
auto_open_output = true;
|
||||
copy_output = false;
|
||||
enter_output_behavior = "open_then_enter";
|
||||
image_provider = "none";
|
||||
output_crop_border = true;
|
||||
output_show_more = false;
|
||||
output_virt_lines = false;
|
||||
output_win_border = [
|
||||
""
|
||||
"━"
|
||||
""
|
||||
""
|
||||
];
|
||||
output_win_cover_gutter = true;
|
||||
output_win_hide_on_leave = true;
|
||||
output_win_style = false;
|
||||
save_path.__raw = "vim.fn.stdpath('data')..'/molten'";
|
||||
use_border_highlights = false;
|
||||
virt_lines_off_by1 = false;
|
||||
wrap_output = false;
|
||||
show_mimetype_debug = false;
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
python3Dependencies = mkOption {
|
||||
type = with types; functionTo (listOf package);
|
||||
default =
|
||||
p: with p; [
|
||||
pynvim
|
||||
jupyter-client
|
||||
cairosvg
|
||||
ipython
|
||||
nbformat
|
||||
];
|
||||
defaultText = literalExpression ''
|
||||
p: with p; [
|
||||
pynvim
|
||||
jupyter-client
|
||||
cairosvg
|
||||
ipython
|
||||
nbformat
|
||||
]
|
||||
'';
|
||||
description = "Python packages to add to the `PYTHONPATH` of neovim.";
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: { extraPython3Packages = cfg.python3Dependencies; };
|
||||
}
|
249
plugins/by-name/multicursors/default.nix
Normal file
249
plugins/by-name/multicursors/default.nix
Normal file
|
@ -0,0 +1,249 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.multicursors;
|
||||
|
||||
keyOptionType =
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
method = mkOption {
|
||||
type = either str (enum [ false ]);
|
||||
description = ''
|
||||
Assigning `"nil"` exits from multi cursor mode.
|
||||
Assigning `false` removes the binding
|
||||
'';
|
||||
example = ''
|
||||
function()
|
||||
require('multicursors.utils').call_on_selections(
|
||||
function(selection)
|
||||
vim.api.nvim_win_set_cursor(0, { selection.row + 1, selection.col + 1 })
|
||||
local line_count = selection.end_row - selection.row + 1
|
||||
vim.cmd('normal ' .. line_count .. 'gcc')
|
||||
end
|
||||
)
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
opts = mkOption {
|
||||
type = attrsOf str;
|
||||
default = { };
|
||||
description = "You can pass `:map-arguments` here.";
|
||||
example = {
|
||||
desc = "comment selections";
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.multicursors = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "multicursors.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "multicursors.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"multicursors-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
debugMode = helpers.defaultNullOpts.mkBool false "Enable debug mode.";
|
||||
|
||||
createCommands = helpers.defaultNullOpts.mkBool true "Create Multicursor user commands.";
|
||||
|
||||
updatetime = helpers.defaultNullOpts.mkUnsignedInt 50 ''
|
||||
Selections get updated if this many milliseconds nothing is typed in the insert mode see
|
||||
`:help updatetime`.
|
||||
'';
|
||||
|
||||
nowait = helpers.defaultNullOpts.mkBool true "see `:help :map-nowait`.";
|
||||
|
||||
normalKeys = helpers.mkNullOrOption keyOptionType ''
|
||||
Normal mode key mappings.
|
||||
|
||||
Default: see the [README.md](https://github.com/smoka7/multicursors.nvim)
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
# to change default lhs of key mapping, change the key
|
||||
"," = {
|
||||
# assigning `null` to method exits from multi cursor mode
|
||||
# assigning `false` to method removes the binding
|
||||
method = "require 'multicursors.normal_mode'.clear_others";
|
||||
|
||||
# you can pass :map-arguments here
|
||||
opts = { desc = "Clear others"; };
|
||||
};
|
||||
"<C-/>" = {
|
||||
method = \'\'
|
||||
function()
|
||||
require('multicursors.utils').call_on_selections(
|
||||
function(selection)
|
||||
vim.api.nvim_win_set_cursor(0, { selection.row + 1, selection.col + 1 })
|
||||
local line_count = selection.end_row - selection.row + 1
|
||||
vim.cmd('normal ' .. line_count .. 'gcc')
|
||||
end
|
||||
)
|
||||
end
|
||||
\'\';
|
||||
opts = { desc = "comment selections"; };
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
insertKeys = helpers.mkNullOrOption keyOptionType ''
|
||||
Insert mode key mappings.
|
||||
|
||||
Default: see the [README.md](https://github.com/smoka7/multicursors.nvim)
|
||||
'';
|
||||
|
||||
extendKeys = helpers.mkNullOrOption keyOptionType ''
|
||||
Insert mode key mappings.
|
||||
|
||||
Default: see the [README.md](https://github.com/smoka7/multicursors.nvim)
|
||||
'';
|
||||
|
||||
hintConfig = {
|
||||
type =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"window"
|
||||
"cmdline"
|
||||
"statusline"
|
||||
])
|
||||
''
|
||||
- "window": show hint in a floating window;
|
||||
- "cmdline": show hint in a echo area;
|
||||
- "statusline": show auto-generated hint in the statusline.
|
||||
'';
|
||||
|
||||
position = helpers.defaultNullOpts.mkEnum [
|
||||
"top-left"
|
||||
"top"
|
||||
"top-right"
|
||||
"middle-left"
|
||||
"middle"
|
||||
"middle-right"
|
||||
"bottom-left"
|
||||
"bottom"
|
||||
"bottom-right"
|
||||
] "bottom" "Set the position of the hint.";
|
||||
|
||||
offset = helpers.mkNullOrOption types.int ''
|
||||
The offset from the nearest editor border.
|
||||
(valid when `type` if `"window"`).
|
||||
'';
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "none" "the hint window" "";
|
||||
|
||||
showName = helpers.mkNullOrOption types.bool ''
|
||||
Show hydras name or `HYDRA:` label at the beginning of an auto-generated hint.
|
||||
'';
|
||||
|
||||
funcs = helpers.mkNullOrOption (with types; attrsOf str) ''
|
||||
Attrs where keys are function names and values are functions themselves.
|
||||
Each function should return string.
|
||||
This functions can be required from hint with `%{func_name}` syntaxis.
|
||||
'';
|
||||
};
|
||||
|
||||
generateHints =
|
||||
genAttrs
|
||||
[
|
||||
"normal"
|
||||
"insert"
|
||||
"extend"
|
||||
]
|
||||
(
|
||||
mode:
|
||||
helpers.defaultNullOpts.mkNullable (with types; either bool str) false ''
|
||||
Hints for ${mode} mode.
|
||||
|
||||
Accepted values:
|
||||
- `true`: generate hints
|
||||
- `false`: don't generate hints
|
||||
- str: provide your own hints
|
||||
''
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
let
|
||||
mkMaps =
|
||||
value:
|
||||
helpers.ifNonNull' value (
|
||||
mapAttrs (
|
||||
key: mapping: with mapping; {
|
||||
method =
|
||||
# `false`
|
||||
if isBool method then method else helpers.mkRaw method;
|
||||
inherit opts;
|
||||
}
|
||||
) value
|
||||
);
|
||||
in
|
||||
{
|
||||
DEBUG_MODE = debugMode;
|
||||
create_commands = createCommands;
|
||||
inherit updatetime nowait;
|
||||
normal_keys = mkMaps normalKeys;
|
||||
insert_keys = mkMaps insertKeys;
|
||||
extend_keys = mkMaps extendKeys;
|
||||
hint_config = with hintConfig; {
|
||||
inherit
|
||||
type
|
||||
position
|
||||
offset
|
||||
border
|
||||
;
|
||||
show_name = showName;
|
||||
funcs = helpers.ifNonNull' funcs (mapAttrs (name: helpers.mkRaw) funcs);
|
||||
};
|
||||
generate_hints =
|
||||
genAttrs
|
||||
[
|
||||
"normal"
|
||||
"insert"
|
||||
"extend"
|
||||
]
|
||||
(
|
||||
mode:
|
||||
let
|
||||
value = generateHints.${mode};
|
||||
in
|
||||
helpers.ifNonNull' value (
|
||||
if isBool value then
|
||||
value
|
||||
else
|
||||
helpers.mkRaw ''
|
||||
[[
|
||||
${value}
|
||||
]]
|
||||
''
|
||||
)
|
||||
);
|
||||
}
|
||||
// extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("multicursors").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
273
plugins/by-name/navbuddy/default.nix
Normal file
273
plugins/by-name/navbuddy/default.nix
Normal file
|
@ -0,0 +1,273 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.navbuddy;
|
||||
|
||||
percentageType = types.ints.between 0 100;
|
||||
mkPercentageOpt = default: helpers.defaultNullOpts.mkNullable percentageType (toString default);
|
||||
in
|
||||
{
|
||||
options.plugins.navbuddy = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-navbuddy";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-navbuddy" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-navbuddy"
|
||||
];
|
||||
};
|
||||
|
||||
window = {
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "window border" ''
|
||||
"rounded", "double", "solid", "none" or an array with eight chars building up the border in a clockwise fashion
|
||||
starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }.
|
||||
'';
|
||||
|
||||
size = helpers.defaultNullOpts.mkNullable (
|
||||
with types;
|
||||
either percentageType (submodule {
|
||||
options = {
|
||||
height = mkPercentageOpt 40 "The height size (in %).";
|
||||
|
||||
width = mkPercentageOpt 100 "The width size (in %).";
|
||||
};
|
||||
})
|
||||
) 60 "The size of the window.";
|
||||
|
||||
position = helpers.defaultNullOpts.mkNullable (
|
||||
with types;
|
||||
either percentageType (submodule {
|
||||
options = {
|
||||
height = mkPercentageOpt 40 "The height size (in %).";
|
||||
|
||||
width = mkPercentageOpt 100 "The width size (in %).";
|
||||
};
|
||||
})
|
||||
) 50 "The position of the window.";
|
||||
|
||||
scrolloff = helpers.mkNullOrOption types.int ''
|
||||
scrolloff value within navbuddy window
|
||||
'';
|
||||
|
||||
sections = {
|
||||
left = {
|
||||
size = mkPercentageOpt 20 "The height size (in %).";
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "left section border" ''
|
||||
"rounded", "double", "solid", "none" or an array with eight chars building up the border in a clockwise fashion
|
||||
starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }.
|
||||
'';
|
||||
};
|
||||
|
||||
mid = {
|
||||
size = mkPercentageOpt 40 "The height size (in %).";
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "mid section border" ''
|
||||
"rounded", "double", "solid", "none" or an array with eight chars building up the border in a clockwise fashion
|
||||
starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }.
|
||||
'';
|
||||
};
|
||||
|
||||
right = {
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "right section border" ''
|
||||
"rounded", "double", "solid", "none" or an array with eight chars building up the border in a clockwise fashion
|
||||
starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }.
|
||||
'';
|
||||
|
||||
preview =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"leaf"
|
||||
"always"
|
||||
"never"
|
||||
]
|
||||
''
|
||||
Right section can show previews too.
|
||||
Options: "leaf", "always" or "never"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nodeMarkers = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable node markers.";
|
||||
|
||||
icons = {
|
||||
leaf = helpers.defaultNullOpts.mkStr " " ''
|
||||
The icon to use for leaf nodes.
|
||||
'';
|
||||
|
||||
leafSelected = helpers.defaultNullOpts.mkStr " → " ''
|
||||
The icon to use for selected leaf node.
|
||||
'';
|
||||
|
||||
branch = helpers.defaultNullOpts.mkStr " " ''
|
||||
The icon to use for branch nodes.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
icons = mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "icon for ${name}.") {
|
||||
File = " ";
|
||||
Module = " ";
|
||||
Namespace = " ";
|
||||
Package = " ";
|
||||
Class = " ";
|
||||
Method = " ";
|
||||
Property = " ";
|
||||
Field = " ";
|
||||
Constructor = " ";
|
||||
Enum = "";
|
||||
Interface = "";
|
||||
Function = " ";
|
||||
Variable = " ";
|
||||
Constant = " ";
|
||||
String = " ";
|
||||
Number = " ";
|
||||
Boolean = "◩ ";
|
||||
Array = " ";
|
||||
Object = " ";
|
||||
Key = " ";
|
||||
Null = " ";
|
||||
EnumMember = " ";
|
||||
Struct = " ";
|
||||
Event = " ";
|
||||
Operator = " ";
|
||||
TypeParameter = " ";
|
||||
};
|
||||
|
||||
useDefaultMapping = helpers.defaultNullOpts.mkBool true ''
|
||||
If set to false, only mappings set by user are set. Else default mappings are used for keys that are not set by user
|
||||
'';
|
||||
|
||||
keymapsSilent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether navbuddy keymaps should be silent";
|
||||
default = false;
|
||||
};
|
||||
|
||||
mappings =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
{
|
||||
"<esc>" = "close";
|
||||
"q" = "close";
|
||||
"j" = "next_sibling";
|
||||
"k" = "previous_sibling";
|
||||
|
||||
"h" = "parent";
|
||||
"l" = "children";
|
||||
"0" = "root";
|
||||
|
||||
"v" = "visual_name";
|
||||
"V" = "visual_scope";
|
||||
|
||||
"y" = "yank_name";
|
||||
"Y" = "yank_scope";
|
||||
|
||||
"i" = "insert_name";
|
||||
"I" = "insert_scope";
|
||||
|
||||
"a" = "append_name";
|
||||
"A" = "append_scope";
|
||||
|
||||
"r" = "rename";
|
||||
|
||||
"d" = "delete";
|
||||
|
||||
"f" = "fold_create";
|
||||
"F" = "fold_delete";
|
||||
|
||||
"c" = "comment";
|
||||
|
||||
"<enter>" = "select";
|
||||
"o" = "select";
|
||||
"J" = "move_down";
|
||||
"K" = "move_up";
|
||||
|
||||
"s" = "toggle_preview";
|
||||
|
||||
"<C-v>" = "vsplit";
|
||||
"<C-s>" = "hsplit";
|
||||
}
|
||||
''
|
||||
Actions to be triggered for specified keybindings. It can take either action name i.e `toggle_preview`
|
||||
Or it can a `rawLua`.
|
||||
'';
|
||||
|
||||
lsp = {
|
||||
autoAttach = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, you don't need to manually use attach function
|
||||
'';
|
||||
|
||||
preference = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
list of lsp server names in order of preference
|
||||
'';
|
||||
};
|
||||
|
||||
sourceBuffer = {
|
||||
followNode = helpers.defaultNullOpts.mkBool true "Keep the current node in focus on the source buffer";
|
||||
|
||||
highlight = helpers.defaultNullOpts.mkBool true "Highlight the currently focused node";
|
||||
|
||||
reorient =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"smart"
|
||||
"top"
|
||||
"mid"
|
||||
"none"
|
||||
]
|
||||
''
|
||||
Right section can show previews too.
|
||||
Options: "leaf", "always" or "never"
|
||||
'';
|
||||
|
||||
scrolloff = helpers.defaultNullOpts.mkInt null ''
|
||||
scrolloff value when navbuddy is open.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit window;
|
||||
node_markers = with nodeMarkers; {
|
||||
inherit enabled;
|
||||
icons = with icons; {
|
||||
inherit leaf branch;
|
||||
leaf_selected = leafSelected;
|
||||
};
|
||||
};
|
||||
inherit icons;
|
||||
use_default_mapping = useDefaultMapping;
|
||||
lsp = with lsp; {
|
||||
auto_attach = autoAttach;
|
||||
inherit preference;
|
||||
};
|
||||
source_buffer = sourceBuffer;
|
||||
mappings = helpers.ifNonNull' cfg.mappings (
|
||||
mapAttrs (
|
||||
key: action: if isString action then helpers.mkRaw "actions.${action}()" else action
|
||||
) mappings
|
||||
);
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
local actions = require("nvim-navbuddy.actions")
|
||||
require('nvim-navbuddy').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
242
plugins/by-name/neoclip/default.nix
Normal file
242
plugins/by-name/neoclip/default.nix
Normal file
|
@ -0,0 +1,242 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "neoclip";
|
||||
originalName = "nvim-neoclip.lua";
|
||||
package = "nvim-neoclip-lua";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
history = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
|
||||
The max number of entries to store.
|
||||
'';
|
||||
|
||||
enable_persistent_history = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to `true` the history is stored on `VimLeavePre` using `sqlite.lua` and lazy loaded when
|
||||
querying.
|
||||
'';
|
||||
|
||||
length_limit = helpers.defaultNullOpts.mkUnsignedInt 1048576 ''
|
||||
The max number of characters of an entry to be stored (default 1MiB).
|
||||
If the length of the yanked string is larger than the limit, it will not be stored.
|
||||
'';
|
||||
|
||||
continuous_sync = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to `true`, the runtime history is synced with the persistent storage everytime it's
|
||||
changed or queried.
|
||||
|
||||
If you often use multiple sessions in parallel and wants the history synced you might want to
|
||||
enable this.
|
||||
|
||||
Off by default; it can cause delays because the history file is written everytime you yank
|
||||
something.
|
||||
Although, in practice no real slowdowns were noticed.
|
||||
|
||||
Alternatively see `db_pull` and `db_push` functions in the
|
||||
[README](https://github.com/AckslD/nvim-neoclip.lua#custom-actions).
|
||||
'';
|
||||
|
||||
db_path =
|
||||
helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath('data') .. '/databases/neoclip.sqlite3'"; }
|
||||
''
|
||||
The path to the sqlite database to store history if `enable_persistent_history=true`.
|
||||
Defaults to `$XDG_DATA_HOME/nvim/databases/neoclip.sqlite3`.
|
||||
'';
|
||||
|
||||
filter = helpers.defaultNullOpts.mkLuaFn null ''
|
||||
A function to filter what entries to store (default all are stored).
|
||||
This function filter should return `true` (include the yanked entry) or `false` (don't include
|
||||
it) based on a table as the only argument, which has the following keys:
|
||||
|
||||
- `event`: The event from `TextYankPost` (see ``:help TextYankPost` for which keys it contains).
|
||||
- `filetype`: The filetype of the buffer where the yank happened.
|
||||
- `buffer_name`: The name of the buffer where the yank happened.
|
||||
'';
|
||||
|
||||
preview = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to show a preview (default) of the current entry or not.
|
||||
Useful for for example multiline yanks.
|
||||
When yanking the filetype is recorded in order to enable correct syntax highlighting in the
|
||||
preview.
|
||||
|
||||
NOTE: in order to use the dynamic title showing the type of content and number of lines you
|
||||
need to configure `telescope` with the `dynamic_preview_title = true` option.
|
||||
'';
|
||||
|
||||
prompt = helpers.defaultNullOpts.mkStr null ''
|
||||
The prompt string used by the picker (`telescope`/`fzf-lua`).
|
||||
'';
|
||||
|
||||
default_register =
|
||||
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; either str (listOf str)) "\""
|
||||
''
|
||||
What register to use by default when not specified (e.g. `Telescope neoclip`).
|
||||
Can be a string such as `"\""` (single register) or a table of strings such as
|
||||
`["\"" "+" "*"]`.
|
||||
'';
|
||||
|
||||
default_register_macros = helpers.defaultNullOpts.mkStr "q" ''
|
||||
What register to use for macros by default when not specified (e.g. `Telescope macroscope`).
|
||||
'';
|
||||
|
||||
enable_macro_history = helpers.defaultNullOpts.mkBool true ''
|
||||
If true (default) any recorded macro will be saved, see
|
||||
[macros](https://github.com/AckslD/nvim-neoclip.lua#macros).
|
||||
'';
|
||||
|
||||
content_spec_column = helpers.defaultNullOpts.mkBool false ''
|
||||
Can be set to `true` to use instead of the preview.
|
||||
'';
|
||||
|
||||
disable_keycodes_parsing = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, macroscope will display the internal byte representation, instead of a proper
|
||||
string that can be used in a map.
|
||||
|
||||
So a macro like `"one<CR>two"` will be displayed as `"one\ntwo"`.
|
||||
It will only show the type and number of lines next to the first line of the entry.
|
||||
'';
|
||||
|
||||
on_select = {
|
||||
move_to_front = helpers.defaultNullOpts.mkBool false ''
|
||||
If the entry should be set to last in the list when pressing the key to select a yank.
|
||||
'';
|
||||
|
||||
close_telescope = helpers.defaultNullOpts.mkBool true ''
|
||||
If telescope should close whenever an item is selected.
|
||||
'';
|
||||
};
|
||||
|
||||
on_paste = {
|
||||
set_reg = helpers.defaultNullOpts.mkBool false ''
|
||||
If the register should be populated when pressing the key to paste directly.
|
||||
'';
|
||||
|
||||
move_to_front = helpers.defaultNullOpts.mkBool false ''
|
||||
If the entry should be set to last in the list when pressing the key to paste directly.
|
||||
'';
|
||||
|
||||
close_telescope = helpers.defaultNullOpts.mkBool true ''
|
||||
If `telescope` should close whenever a yank is pasted.
|
||||
'';
|
||||
};
|
||||
|
||||
on_replay = {
|
||||
set_reg = helpers.defaultNullOpts.mkBool false ''
|
||||
If the register should be populated when pressing the key to replay a recorded macro.
|
||||
'';
|
||||
|
||||
move_to_front = helpers.defaultNullOpts.mkBool false ''
|
||||
If the entry should be set to last in the list when pressing the key to replay a recorded
|
||||
macro.
|
||||
'';
|
||||
|
||||
close_telescope = helpers.defaultNullOpts.mkBool true ''
|
||||
If telescope should close whenever a macro is replayed.
|
||||
'';
|
||||
};
|
||||
|
||||
on_custom_action = {
|
||||
close_telescope = helpers.defaultNullOpts.mkBool true ''
|
||||
If telescope should close whenever a custom action is executed.
|
||||
'';
|
||||
};
|
||||
|
||||
keys = {
|
||||
telescope =
|
||||
# Using `anything` here because of the annoying `custom` key (and also, a mapping can target several keys):
|
||||
# https://github.com/AckslD/nvim-neoclip.lua?tab=readme-ov-file#custom-actions
|
||||
helpers.defaultNullOpts.mkAttrsOf (with types; attrsOf anything)
|
||||
{
|
||||
i = {
|
||||
select = "<cr>";
|
||||
paste = "<c-p>";
|
||||
paste_behind = "<c-k>";
|
||||
replay = "<c-q>";
|
||||
delete = "<c-d>";
|
||||
edit = "<c-e>";
|
||||
custom = { };
|
||||
};
|
||||
n = {
|
||||
select = "<cr>";
|
||||
paste = "p";
|
||||
paste_behind = "P";
|
||||
replay = "q";
|
||||
delete = "d";
|
||||
edit = "e";
|
||||
custom = { };
|
||||
};
|
||||
}
|
||||
''
|
||||
Keys to use for the `telescope` picker.
|
||||
Normal key-syntax is supported and both insert `i` and normal mode `n`.
|
||||
You can also use the `custom` entry to specify custom actions to take on certain
|
||||
key-presses, see
|
||||
[here](https://github.com/AckslD/nvim-neoclip.lua?tab=readme-ov-file#custom-actions) for
|
||||
more details.
|
||||
|
||||
NOTE: these are only set in the telescope buffer and you need to setup your own keybindings to for example open telescope.
|
||||
'';
|
||||
|
||||
fzf =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.anything
|
||||
{
|
||||
select = "default";
|
||||
paste = "ctrl-p";
|
||||
paste_behind = "ctrl-k";
|
||||
custom = { };
|
||||
}
|
||||
''
|
||||
Keys to use for the `fzf` picker.
|
||||
Only insert mode is supported and fzf-style key-syntax needs to be used.
|
||||
You can also use the `custom` entry to specify custom actions to take on certain
|
||||
key-presses, see
|
||||
[here](https://github.com/AckslD/nvim-neoclip.lua?tab=readme-ov-file#custom-actions) for
|
||||
more details.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
filter = null;
|
||||
preview = true;
|
||||
default_register = "\"";
|
||||
content_spec_column = false;
|
||||
on_paste = {
|
||||
set_reg = false;
|
||||
};
|
||||
keys = {
|
||||
telescope = {
|
||||
i = {
|
||||
select = "<cr>";
|
||||
paste = "<c-l>";
|
||||
paste_behind = "<c-h>";
|
||||
custom = { };
|
||||
};
|
||||
n = {
|
||||
select = "<cr>";
|
||||
paste = "p";
|
||||
paste_behind = "P";
|
||||
custom = { };
|
||||
};
|
||||
};
|
||||
fzf = {
|
||||
select = "default";
|
||||
paste = "ctrl-l";
|
||||
paste_behind = "ctrl-h";
|
||||
custom = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPlugins = mkIf (
|
||||
isBool cfg.settings.enable_persistent_history && cfg.settings.enable_persistent_history
|
||||
) [ pkgs.vimPlugins.sqlite-lua ];
|
||||
};
|
||||
}
|
184
plugins/by-name/neocord/default.nix
Normal file
184
plugins/by-name/neocord/default.nix
Normal file
|
@ -0,0 +1,184 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "neocord";
|
||||
|
||||
maintainers = [ ];
|
||||
|
||||
settingsOptions = {
|
||||
# General options.
|
||||
auto_update = helpers.defaultNullOpts.mkBool true ''
|
||||
Update activity based on autocmd events.
|
||||
If `false`, map or manually execute
|
||||
`:lua package.loaded.neocord:update()`
|
||||
'';
|
||||
|
||||
logo = helpers.defaultNullOpts.mkStr "auto" ''
|
||||
Update the Logo to the specified option ("auto" or url).
|
||||
'';
|
||||
|
||||
logo_tooltip = helpers.mkNullOrStr ''
|
||||
Sets the logo tooltip
|
||||
'';
|
||||
|
||||
main_image =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"language"
|
||||
"logo"
|
||||
]
|
||||
''
|
||||
Main image display (either "language" or "logo")
|
||||
'';
|
||||
|
||||
client_id = helpers.defaultNullOpts.mkStr "1157438221865717891" ''
|
||||
Use your own Discord application client id. (not recommended)
|
||||
'';
|
||||
|
||||
log_level =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"debug"
|
||||
"info"
|
||||
"warn"
|
||||
"error"
|
||||
]
|
||||
null
|
||||
''
|
||||
Log messages at or above this level.
|
||||
'';
|
||||
|
||||
debounce_timeout = helpers.defaultNullOpts.mkInt 10 ''
|
||||
Number of seconds to debounce events.
|
||||
(or calls to `:lua package.loaded.neocord:update(<filename>, true)`)
|
||||
'';
|
||||
|
||||
enable_line_number = helpers.defaultNullOpts.mkBool false ''
|
||||
Displays the current line number instead of the current project.
|
||||
'';
|
||||
|
||||
blacklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
A list of strings or Lua patterns that disable Rich Presence if the
|
||||
current file name, path, or workspace matches.
|
||||
'';
|
||||
|
||||
buttons =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(
|
||||
with types;
|
||||
submodule {
|
||||
options = {
|
||||
label = helpers.mkNullOrStr "";
|
||||
url = helpers.mkNullOrStr "";
|
||||
};
|
||||
}
|
||||
)
|
||||
[ ]
|
||||
''
|
||||
Button configurations which will always appear in Rich Presence.
|
||||
Can be a list of attribute sets, each with the following attributes:
|
||||
`label`: The label of the button. e.g. `"GitHub Profile"`.
|
||||
`url`: The URL the button leads to. e.g. `"https://github.com/<NAME>"`.
|
||||
Can also be a lua function: `function(buffer: string, repo_url: string|nil): table`
|
||||
'';
|
||||
|
||||
file_assets = helpers.mkNullOrOption (with types; attrsOf (listOf str)) ''
|
||||
Custom file asset definitions keyed by file names and extensions.
|
||||
List elements for each attribute (filetype):
|
||||
`name`: The name of the asset shown as the title of the file in Discord.
|
||||
`source`: The source of the asset, either an art asset key or the URL of an image asset.
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
# Use art assets uploaded in Discord application for the configured client id
|
||||
js = [ "JavaScript" "javascript" ];
|
||||
ts = [ "TypeScript" "typescript" ];
|
||||
# Use image URLs
|
||||
rs = [ "Rust" "https://www.rust-lang.org/logos/rust-logo-512x512.png" ];
|
||||
go = [ "Go" "https://go.dev/blog/go-brand/Go-Logo/PNG/Go-Logo_Aqua.png" ];
|
||||
};
|
||||
```
|
||||
'';
|
||||
|
||||
show_time = helpers.defaultNullOpts.mkBool true "Show the timer.";
|
||||
|
||||
global_timer = helpers.defaultNullOpts.mkBool false "if set true, timer won't update when any event are triggered.";
|
||||
|
||||
# Rich presence text options.
|
||||
editing_text = helpers.defaultNullOpts.mkStr "Editing %s" ''
|
||||
String rendered when an editable file is loaded in the buffer.
|
||||
Can also be a lua function:
|
||||
`function(filename: string): string`
|
||||
'';
|
||||
|
||||
file_explorer_text = helpers.defaultNullOpts.mkStr "Browsing %s" ''
|
||||
String rendered when browsing a file explorer.
|
||||
Can also be a lua function:
|
||||
`function(file_explorer_name: string): string`
|
||||
'';
|
||||
|
||||
git_commit_text = helpers.defaultNullOpts.mkStr "Committing changes" ''
|
||||
String rendered when committing changes in git.
|
||||
Can also be a lua function:
|
||||
`function(filename: string): string`
|
||||
'';
|
||||
|
||||
plugin_manager_text = helpers.defaultNullOpts.mkStr "Managing plugins" ''
|
||||
String rendered when managing plugins.
|
||||
Can also be a lua function:
|
||||
`function(plugin_manager_name: string): string`
|
||||
'';
|
||||
|
||||
reading_text = helpers.defaultNullOpts.mkStr "Reading %s" ''
|
||||
String rendered when a read-only/unmodifiable file is loaded into the buffer.
|
||||
Can also be a lua function:
|
||||
`function(filename: string): string`
|
||||
'';
|
||||
|
||||
workspace_text = helpers.defaultNullOpts.mkStr "Working on %s" ''
|
||||
String rendered when in a git repository.
|
||||
Can also be a lua function:
|
||||
`function(project_name: string|nil, filename: string): string`
|
||||
'';
|
||||
|
||||
line_number_text = helpers.defaultNullOpts.mkStr "Line %s out of %s" ''
|
||||
String rendered when `enableLineNumber` is set to `true` to display the current line number.
|
||||
Can also be a lua function:
|
||||
`function(line_number: number, line_count: number): string`
|
||||
'';
|
||||
|
||||
terminal_text = helpers.defaultNullOpts.mkStr "Using Terminal" ''
|
||||
Format string rendered when in terminal mode.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
#General options
|
||||
auto_update = true;
|
||||
logo = "auto";
|
||||
logo_tooltip = null;
|
||||
main_image = "language";
|
||||
client_id = "1157438221865717891";
|
||||
log_level = null;
|
||||
debounce_timeout = 10;
|
||||
enable_line_number = false;
|
||||
blacklist = [ ];
|
||||
file_assets = null;
|
||||
show_time = true;
|
||||
global_timer = false;
|
||||
|
||||
# Rich Presence text options
|
||||
editing_text = "Editing...";
|
||||
file_explorer_text = "Browsing...";
|
||||
git_commit_text = "Committing changes...";
|
||||
plugin_manager_text = "Managing plugins...";
|
||||
reading_text = "Reading...";
|
||||
workspace_text = "Working on %s";
|
||||
line_number_text = "Line %s out of %s";
|
||||
terminal_text = "Using Terminal...";
|
||||
};
|
||||
}
|
223
plugins/by-name/neogen/default.nix
Normal file
223
plugins/by-name/neogen/default.nix
Normal file
|
@ -0,0 +1,223 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.neogen;
|
||||
|
||||
keymapDef = {
|
||||
generate = {
|
||||
command = "";
|
||||
|
||||
description = ''
|
||||
The only function required to use Neogen.
|
||||
|
||||
It'll try to find the first parent that matches a certain type.
|
||||
For example, if you are inside a function, and called `generate({ type = "func" })`,
|
||||
Neogen will go until the start of the function and start annotating for you.
|
||||
'';
|
||||
};
|
||||
|
||||
generateClass = {
|
||||
command = "class";
|
||||
description = "Generates annotation for class.";
|
||||
};
|
||||
|
||||
generateFunction = {
|
||||
command = "func";
|
||||
description = "Generates annotation for function.";
|
||||
};
|
||||
|
||||
generateType = {
|
||||
command = "type";
|
||||
description = "Generates annotation for type.";
|
||||
};
|
||||
|
||||
generateFile = {
|
||||
command = "file";
|
||||
description = "Generates annotation for file.";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plugins.neogen = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "neogen";
|
||||
|
||||
package = lib.mkPackageOption pkgs "neogen" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"neogen"
|
||||
];
|
||||
};
|
||||
|
||||
keymaps = mapAttrs (
|
||||
optionsName: properties: helpers.mkNullOrOption types.str properties.description
|
||||
) keymapDef;
|
||||
|
||||
keymapsSilent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether Neogen keymaps should be silent";
|
||||
default = false;
|
||||
};
|
||||
|
||||
inputAfterComment = helpers.defaultNullOpts.mkBool true ''
|
||||
If true, go to annotation after insertion, and change to insert mode
|
||||
'';
|
||||
|
||||
enablePlaceholders = helpers.defaultNullOpts.mkBool true ''
|
||||
If true, enables placeholders when inserting annotation
|
||||
'';
|
||||
|
||||
languages = helpers.defaultNullOpts.mkAttrsOf' {
|
||||
# No plugin default (see upstream)
|
||||
type = types.anything;
|
||||
description = ''
|
||||
Configuration for languages.
|
||||
|
||||
`template.annotation_convention` (default: check the language default configurations):
|
||||
Change the annotation convention to use with the language.
|
||||
|
||||
`template.use_default_comment` (default: true):
|
||||
Prepend any template line with the default comment for the filetype
|
||||
|
||||
`template.position` (fun(node: userdata, type: string):(number,number)?):
|
||||
Provide an absolute position for the annotation.
|
||||
If return values are nil, use default position
|
||||
|
||||
`template.append`:
|
||||
If you want to customize the position of the annotation.
|
||||
|
||||
`template.append.child_name`:
|
||||
What child node to use for appending the annotation.
|
||||
|
||||
`template.append.position` (before/after):
|
||||
Relative positioning with `child_name`.
|
||||
|
||||
`template.<convention_name>` (replace <convention_name> with an annotation convention):
|
||||
Template for an annotation convention.
|
||||
To know more about how to create your own template, go here:
|
||||
https://github.com/danymat/neogen/blob/main/docs/adding-languages.md#default-generator
|
||||
'';
|
||||
example = {
|
||||
csharp = {
|
||||
template = {
|
||||
annotation_convention = "...";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
snippetEngine = helpers.mkNullOrOption types.str ''
|
||||
Use a snippet engine to generate annotations.
|
||||
Some snippet engines come out of the box bundled with neogen:
|
||||
- `"luasnip"` (https://github.com/L3MON4D3/LuaSnip)
|
||||
- `"snippy"` (https://github.com/dcampos/nvim-snippy)
|
||||
- `"vsnip"` (https://github.com/hrsh7th/vim-vsnip)
|
||||
'';
|
||||
|
||||
placeholderHighlight = helpers.defaultNullOpts.mkStr "DiagnosticHint" ''
|
||||
Placeholders highlights to use. If you don't want custom highlight, pass "None"
|
||||
'';
|
||||
|
||||
placeholdersText = {
|
||||
description = helpers.defaultNullOpts.mkStr "[TODO:description]" ''
|
||||
Placeholder for description.
|
||||
'';
|
||||
|
||||
tparam = helpers.defaultNullOpts.mkStr "[TODO:tparam]" ''
|
||||
Placeholder for tparam.
|
||||
'';
|
||||
|
||||
parameter = helpers.defaultNullOpts.mkStr "[TODO:parameter]" ''
|
||||
Placeholder for parameter.
|
||||
'';
|
||||
|
||||
return = helpers.defaultNullOpts.mkStr "[TODO:return]" ''
|
||||
Placeholder for return.
|
||||
'';
|
||||
|
||||
class = helpers.defaultNullOpts.mkStr "[TODO:class]" ''
|
||||
Placeholder for class.
|
||||
'';
|
||||
|
||||
throw = helpers.defaultNullOpts.mkStr "[TODO:throw]" ''
|
||||
Placeholder for throw.
|
||||
'';
|
||||
|
||||
varargs = helpers.defaultNullOpts.mkStr "[TODO:varargs]" ''
|
||||
Placeholder for varargs.
|
||||
'';
|
||||
|
||||
type = helpers.defaultNullOpts.mkStr "[TODO:type]" ''
|
||||
Placeholder for type.
|
||||
'';
|
||||
|
||||
attribute = helpers.defaultNullOpts.mkStr "[TODO:attribute]" ''
|
||||
Placeholder for attribute.
|
||||
'';
|
||||
|
||||
args = helpers.defaultNullOpts.mkStr "[TODO:args]" ''
|
||||
Placeholder for args.
|
||||
'';
|
||||
|
||||
kwargs = helpers.defaultNullOpts.mkStr "[TODO:kwargs]" ''
|
||||
Placeholder for kwargs.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# TODO introduced 2024-03-07: remove 2024-05-07
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"neogen"
|
||||
"placeholderHighligt"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"neogen"
|
||||
"placeholderHighlight"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; {
|
||||
enabled = enable;
|
||||
input_after_comment = inputAfterComment;
|
||||
inherit languages;
|
||||
snippet_engine = snippetEngine;
|
||||
enable_placeholders = enablePlaceholders;
|
||||
placeholder_text = placeholdersText;
|
||||
placeholder_hl = placeholderHighlight;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("neogen").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
|
||||
keymaps = flatten (
|
||||
mapAttrsToList (
|
||||
optionName: properties:
|
||||
let
|
||||
key = cfg.keymaps.${optionName};
|
||||
in
|
||||
optional (key != null) {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = ":Neogen ${properties.command}<CR>";
|
||||
options.silent = cfg.keymapsSilent;
|
||||
}
|
||||
) keymapDef
|
||||
);
|
||||
};
|
||||
}
|
162
plugins/by-name/neorg/default.nix
Normal file
162
plugins/by-name/neorg/default.nix
Normal file
|
@ -0,0 +1,162 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.plugins.neorg;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.plugins.neorg = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "neorg";
|
||||
|
||||
package = lib.mkPackageOption pkgs "neorg" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"neorg"
|
||||
];
|
||||
};
|
||||
|
||||
lazyLoading = helpers.defaultNullOpts.mkBool false '''';
|
||||
|
||||
logger =
|
||||
let
|
||||
modes = {
|
||||
trace = {
|
||||
hl = "Comment";
|
||||
level = "trace";
|
||||
};
|
||||
debug = {
|
||||
hl = "Comment";
|
||||
level = "debug";
|
||||
};
|
||||
info = {
|
||||
hl = "None";
|
||||
level = "info";
|
||||
};
|
||||
warn = {
|
||||
hl = "WarningMsg";
|
||||
level = "warn";
|
||||
};
|
||||
error = {
|
||||
hl = "ErrorMsg";
|
||||
level = "error";
|
||||
};
|
||||
fatal = {
|
||||
hl = "ErrorMsg";
|
||||
level = 5;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
plugin = helpers.defaultNullOpts.mkStr "neorg" ''
|
||||
Name of the plugin. Prepended to log messages
|
||||
'';
|
||||
|
||||
useConsole = helpers.defaultNullOpts.mkBool true ''
|
||||
Should print the output to neovim while running
|
||||
'';
|
||||
|
||||
highlights = helpers.defaultNullOpts.mkBool true ''
|
||||
Should highlighting be used in console (using echohl)
|
||||
'';
|
||||
|
||||
useFile = helpers.defaultNullOpts.mkBool true ''
|
||||
Should write to a file
|
||||
'';
|
||||
|
||||
level = helpers.defaultNullOpts.mkEnum (attrNames modes) "warn" ''
|
||||
Any messages above this level will be logged
|
||||
'';
|
||||
|
||||
modes = mapAttrs (
|
||||
mode: defaults:
|
||||
helpers.mkCompositeOption "Settings for mode ${mode}." {
|
||||
hl = helpers.defaultNullOpts.mkStr defaults.hl ''
|
||||
Highlight for mode ${mode}.
|
||||
'';
|
||||
|
||||
level = helpers.defaultNullOpts.mkLogLevel defaults.level ''
|
||||
Level for mode ${mode}.
|
||||
'';
|
||||
}
|
||||
) modes;
|
||||
|
||||
floatPrecision = helpers.defaultNullOpts.mkNullable types.float 1.0e-2 ''
|
||||
Can limit the number of decimals displayed for floats
|
||||
'';
|
||||
};
|
||||
|
||||
modules = mkOption {
|
||||
type = with types; attrsOf attrs;
|
||||
description = "Modules configuration.";
|
||||
default = { };
|
||||
example = {
|
||||
"core.defaults" = {
|
||||
__empty = null;
|
||||
};
|
||||
"core.dirman" = {
|
||||
config = {
|
||||
workspaces = {
|
||||
work = "~/notes/work";
|
||||
home = "~/notes/home";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
lazy_loading = lazyLoading;
|
||||
|
||||
logger = with logger; {
|
||||
inherit plugin;
|
||||
use_console = useConsole;
|
||||
inherit highlights;
|
||||
use_file = useFile;
|
||||
inherit level;
|
||||
|
||||
modes = filter (v: v != null) (
|
||||
mapAttrsToList (
|
||||
mode: modeConfig:
|
||||
helpers.ifNonNull' modeConfig {
|
||||
name = mode;
|
||||
inherit (modeConfig) hl level;
|
||||
}
|
||||
) modes
|
||||
);
|
||||
float_precision = floatPrecision;
|
||||
};
|
||||
|
||||
load = modules;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
|
||||
telescopeSupport = hasAttr "core.integrations.telescope" cfg.modules;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings =
|
||||
(optional (telescopeSupport && (!config.plugins.telescope.enable)) ''
|
||||
Telescope support for neorg (`core.integrations.telescope`) is enabled but the
|
||||
telescope plugin is not.
|
||||
'')
|
||||
++ (optional ((hasAttr "core.defaults" cfg.modules) && (!config.plugins.treesitter.enable)) ''
|
||||
Neorg's `core.defaults` module is enabled but `plugins.treesitter` is not.
|
||||
Treesitter is required when using the `core.defaults`.
|
||||
'');
|
||||
|
||||
extraPlugins = [ cfg.package ] ++ (optional telescopeSupport pkgs.vimPlugins.neorg-telescope);
|
||||
|
||||
extraConfigLua = ''
|
||||
require('neorg').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
35
plugins/by-name/netman/default.nix
Normal file
35
plugins/by-name/netman/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.plugins.netman = {
|
||||
enable = mkEnableOption "netman.nvim, a framework to access remote resources";
|
||||
|
||||
package = lib.mkPackageOption pkgs "netman.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"netman-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
neoTreeIntegration = mkEnableOption "support for netman as a neo-tree source";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.netman;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua = ''
|
||||
require("netman")
|
||||
'';
|
||||
|
||||
plugins.neo-tree.extraSources = mkIf cfg.neoTreeIntegration [ "netman.ui.neo-tree" ];
|
||||
};
|
||||
}
|
61
plugins/by-name/nix-develop/default.nix
Normal file
61
plugins/by-name/nix-develop/default.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.nix-develop;
|
||||
in
|
||||
{
|
||||
options.plugins.nix-develop = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nix-develop.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nix-develop.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nix-develop-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
ignoredVariables = mkOption {
|
||||
type = with types; attrsOf bool;
|
||||
default = { };
|
||||
description = "An attrs specifying the variables should be ignored.";
|
||||
example = {
|
||||
BASHOPTS = true;
|
||||
HOME = true;
|
||||
NIX_BUILD_TOP = true;
|
||||
SHELL = true;
|
||||
TMP = true;
|
||||
};
|
||||
};
|
||||
|
||||
separatedVariables = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
description = "An attrs specifying the separator to use for particular environment variables.";
|
||||
example = {
|
||||
PATH = ":";
|
||||
XDG_DATA_DIRS = ":";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua = ''
|
||||
local __ignored_variables = ${helpers.toLuaObject cfg.ignoredVariables}
|
||||
for ignoredVariable, shouldIgnore in ipairs(__ignored_variables) do
|
||||
require("nix-develop").ignored_variables[ignoredVariable] = shouldIgnore
|
||||
end
|
||||
|
||||
local __separated_variables = ${helpers.toLuaObject cfg.separatedVariables}
|
||||
for variable, separator in ipairs(__separated_variables) do
|
||||
require("nix-develop").separated_variables[variable] = separator
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
128
plugins/by-name/notify/default.nix
Normal file
128
plugins/by-name/notify/default.nix
Normal file
|
@ -0,0 +1,128 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.notify;
|
||||
in
|
||||
{
|
||||
options.plugins.notify = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-notify";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-notify" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-notify"
|
||||
];
|
||||
};
|
||||
|
||||
level = helpers.defaultNullOpts.mkLogLevel "info" ''
|
||||
Minimum log level to display. See `vim.log.levels`.
|
||||
'';
|
||||
|
||||
timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 "Default timeout for notification.";
|
||||
|
||||
maxWidth = helpers.mkNullOrOption (with types; either ints.unsigned helpers.nixvimTypes.rawLua) ''
|
||||
Max number of columns for messages.
|
||||
'';
|
||||
|
||||
maxHeight = helpers.mkNullOrOption (with types; either ints.unsigned helpers.nixvimTypes.rawLua) ''
|
||||
Max number of lines for a message.
|
||||
'';
|
||||
|
||||
stages =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either (enum [
|
||||
"fade"
|
||||
"slide"
|
||||
"fade_in_slide_out"
|
||||
"static"
|
||||
]) (listOf str)
|
||||
)
|
||||
"fade_in_slide_out"
|
||||
''
|
||||
Animation stages.
|
||||
Can be either one of the builtin stages or an array of lua functions.
|
||||
'';
|
||||
|
||||
backgroundColour = helpers.defaultNullOpts.mkStr "NotifyBackground" ''
|
||||
For stages that change opacity this is treated as the highlight behind the window.
|
||||
Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function
|
||||
returning an RGB code for dynamic values.
|
||||
'';
|
||||
|
||||
icons =
|
||||
mapAttrs (name: default: helpers.defaultNullOpts.mkStr default "Icon for the ${name} level.")
|
||||
{
|
||||
error = "";
|
||||
warn = "";
|
||||
info = "";
|
||||
debug = "";
|
||||
trace = "✎";
|
||||
};
|
||||
|
||||
onOpen = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
Function called when a new window is opened, use for changing win settings/config.
|
||||
'';
|
||||
|
||||
onClose = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
Function called when a new window is closed.
|
||||
'';
|
||||
|
||||
render = helpers.defaultNullOpts.mkEnumFirstDefault [
|
||||
"default"
|
||||
"minimal"
|
||||
] "Function to render a notification buffer or a built-in renderer name.";
|
||||
|
||||
minimumWidth = helpers.defaultNullOpts.mkUnsignedInt 50 ''
|
||||
Minimum width for notification windows.
|
||||
'';
|
||||
|
||||
fps = helpers.defaultNullOpts.mkPositiveInt 30 ''
|
||||
Frames per second for animation stages, higher value means smoother animations but more CPU
|
||||
usage.
|
||||
'';
|
||||
|
||||
topDown = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether or not to position the notifications at the top or not.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit level timeout;
|
||||
max_width = maxWidth;
|
||||
max_height = maxHeight;
|
||||
stages = helpers.ifNonNull' stages (if isString stages then stages else map helpers.mkRaw stages);
|
||||
background_colour = backgroundColour;
|
||||
icons = mapAttrs' (name: value: {
|
||||
name = strings.toUpper name;
|
||||
inherit value;
|
||||
}) icons;
|
||||
on_open = onOpen;
|
||||
on_close = onClose;
|
||||
inherit render;
|
||||
minimum_width = minimumWidth;
|
||||
inherit fps;
|
||||
top_down = topDown;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
vim.notify = require('notify');
|
||||
require('notify').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
206
plugins/by-name/nvim-autopairs/default.nix
Normal file
206
plugins/by-name/nvim-autopairs/default.nix
Normal file
|
@ -0,0 +1,206 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "nvim-autopairs";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO: introduced 2024-03-27, remove on 2024-05-27
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"disableInMacro"
|
||||
"disableInVisualblock"
|
||||
"disableInReplaceMode"
|
||||
"ignoredNextChar"
|
||||
"enableMoveright"
|
||||
"enableCheckBracketLine"
|
||||
"enableBracketInQuote"
|
||||
"enableAbbr"
|
||||
"breakUndo"
|
||||
"checkTs"
|
||||
"tsConfig"
|
||||
"mapCr"
|
||||
"mapBs"
|
||||
"mapCH"
|
||||
"mapCW"
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePluginPaths = [
|
||||
"plugins"
|
||||
"nvim-autopairs"
|
||||
];
|
||||
settingsPath = basePluginPaths ++ [ "settings" ];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePluginPaths ++ [ "disabledFiletypes" ]) (
|
||||
settingsPath ++ [ "disable_filetype" ]
|
||||
))
|
||||
(mkRenamedOptionModule (basePluginPaths ++ [ "enableAfterQuote" ]) (
|
||||
settingsPath ++ [ "enable_afterquote" ]
|
||||
))
|
||||
(mkRemovedOptionModule (basePluginPaths ++ [ "pairs" ]) ''
|
||||
This option was having no effect.
|
||||
If you want to customize pairs, please use `extraConfigLua` to define them as described in the plugin documentation.
|
||||
'')
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
disable_filetype = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"TelescopePrompt"
|
||||
"spectre_panel"
|
||||
] "Disabled filetypes.";
|
||||
|
||||
disable_in_macro = helpers.defaultNullOpts.mkBool false ''
|
||||
Disable when recording or executing a macro.
|
||||
'';
|
||||
|
||||
disable_in_visualblock = helpers.defaultNullOpts.mkBool false ''
|
||||
Disable when insert after visual block mode.
|
||||
'';
|
||||
|
||||
disable_in_replace_mode = helpers.defaultNullOpts.mkBool true ''
|
||||
Disable in replace mode.
|
||||
'';
|
||||
|
||||
ignored_next_char = helpers.defaultNullOpts.mkLua "[=[[%w%%%'%[%\"%.%`%$]]=]" ''
|
||||
Regexp to ignore if it matches the next character.
|
||||
'';
|
||||
|
||||
enable_moveright = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable moveright.
|
||||
'';
|
||||
|
||||
enable_afterquote = helpers.defaultNullOpts.mkBool true ''
|
||||
Add bracket pairs after quote.
|
||||
'';
|
||||
|
||||
enable_check_bracket_line = helpers.defaultNullOpts.mkBool true ''
|
||||
Check bracket in same line.
|
||||
'';
|
||||
|
||||
enable_bracket_in_quote = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable bracket in quote.
|
||||
'';
|
||||
|
||||
enable_abbr = helpers.defaultNullOpts.mkBool false ''
|
||||
Trigger abbreviation.
|
||||
'';
|
||||
|
||||
break_undo = helpers.defaultNullOpts.mkBool true ''
|
||||
Switch for basic rule break undo sequence.
|
||||
'';
|
||||
|
||||
check_ts = helpers.defaultNullOpts.mkBool false ''
|
||||
Use treesitter to check for a pair.
|
||||
'';
|
||||
|
||||
ts_config = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
lua = [
|
||||
"string"
|
||||
"source"
|
||||
"string_content"
|
||||
];
|
||||
javascript = [
|
||||
"string"
|
||||
"template_string"
|
||||
];
|
||||
} "Configuration for TreeSitter.";
|
||||
|
||||
map_cr = helpers.defaultNullOpts.mkBool true ''
|
||||
Map the `<CR>` key to confirm the completion.
|
||||
'';
|
||||
|
||||
map_bs = helpers.defaultNullOpts.mkBool true ''
|
||||
Map the `<BS>` key to delete the pair.
|
||||
'';
|
||||
|
||||
map_c_h = helpers.defaultNullOpts.mkBool false ''
|
||||
Map the `<C-h>` key to delete a pair.
|
||||
'';
|
||||
|
||||
map_c_w = helpers.defaultNullOpts.mkBool false ''
|
||||
Map the `<C-w>` key to delete a pair if possible.
|
||||
'';
|
||||
|
||||
fast_wrap = {
|
||||
map = helpers.defaultNullOpts.mkStr "<M-e>" ''
|
||||
The key to trigger fast_wrap.
|
||||
'';
|
||||
|
||||
chars =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"{"
|
||||
"["
|
||||
"("
|
||||
"\""
|
||||
"'"
|
||||
]
|
||||
''
|
||||
Characters for which to enable fast wrap.
|
||||
'';
|
||||
|
||||
pattern = helpers.defaultNullOpts.mkLua ''[=[[%'%"%>%]%)%}%,%`]]=]'' ''
|
||||
The pattern to match against.
|
||||
'';
|
||||
|
||||
end_key = helpers.defaultNullOpts.mkStr "$" ''
|
||||
End key.
|
||||
'';
|
||||
|
||||
before_key = helpers.defaultNullOpts.mkStr "h" ''
|
||||
Before key.
|
||||
'';
|
||||
|
||||
after_key = helpers.defaultNullOpts.mkStr "l" ''
|
||||
After key.
|
||||
'';
|
||||
|
||||
cursor_pos_before = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the cursor should be placed before or after the substitution.
|
||||
'';
|
||||
|
||||
keys = helpers.defaultNullOpts.mkStr "qwertyuiopzxcvbnmasdfghjkl" '''';
|
||||
|
||||
highlight = helpers.defaultNullOpts.mkStr "Search" ''
|
||||
Which highlight group to use for the match.
|
||||
'';
|
||||
|
||||
highlight_grey = helpers.defaultNullOpts.mkStr "Comment" ''
|
||||
Which highlight group to use for the grey part.
|
||||
'';
|
||||
|
||||
manual_position = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable manual position.
|
||||
'';
|
||||
|
||||
use_virt_lines = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to use `virt_lines`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
disable_filetype = [ "TelescopePrompt" ];
|
||||
fast_wrap = {
|
||||
map = "<M-e>";
|
||||
end_key = "$";
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
optional
|
||||
((isBool cfg.settings.check_ts) && cfg.settings.check_ts && !config.plugins.treesitter.enable)
|
||||
''
|
||||
Nixvim (plugins.nvim-autopairs): You have set `settings.check_ts` to `true` but have not enabled the treesitter plugin.
|
||||
We suggest you to set `plugins.treesitter.enable` to `true`.
|
||||
'';
|
||||
};
|
||||
}
|
170
plugins/by-name/nvim-bqf/default.nix
Normal file
170
plugins/by-name/nvim-bqf/default.nix
Normal file
|
@ -0,0 +1,170 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.nvim-bqf;
|
||||
in
|
||||
{
|
||||
options.plugins.nvim-bqf = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-bqf";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-bqf" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-bqf"
|
||||
];
|
||||
};
|
||||
|
||||
autoEnable = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable nvim-bqf in quickfix window automatically.
|
||||
'';
|
||||
|
||||
magicWindow = helpers.defaultNullOpts.mkBool true ''
|
||||
Give the window magic, when the window is split horizontally, keep the distance between the
|
||||
current line and the top/bottom border of neovim unchanged.
|
||||
It's a bit like a floating window, but the window is indeed a normal window, without any
|
||||
floating attributes.
|
||||
'';
|
||||
|
||||
autoResizeHeight = helpers.defaultNullOpts.mkBool false ''
|
||||
Resize quickfix window height automatically.
|
||||
Shrink higher height to size of list in quickfix window, otherwise extend height to size of
|
||||
list or to default height (10).
|
||||
'';
|
||||
|
||||
preview = {
|
||||
autoPreview = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable preview in quickfix window automatically.
|
||||
'';
|
||||
|
||||
borderChars =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"│"
|
||||
"│"
|
||||
"─"
|
||||
"─"
|
||||
"╭"
|
||||
"╮"
|
||||
"╰"
|
||||
"╯"
|
||||
"█"
|
||||
]
|
||||
''
|
||||
Border and scroll bar chars, they respectively represent:
|
||||
vline, vline, hline, hline, ulcorner, urcorner, blcorner, brcorner, sbar
|
||||
'';
|
||||
|
||||
showTitle = helpers.defaultNullOpts.mkBool true ''
|
||||
Show the window title.
|
||||
'';
|
||||
|
||||
delaySyntax = helpers.defaultNullOpts.mkInt 50 ''
|
||||
Delay time, to do syntax for previewed buffer, unit is millisecond.
|
||||
'';
|
||||
|
||||
winHeight = helpers.defaultNullOpts.mkInt 15 ''
|
||||
The height of preview window for horizontal layout.
|
||||
Large value (like 999) perform preview window as a "full" mode.
|
||||
'';
|
||||
|
||||
winVheight = helpers.defaultNullOpts.mkInt 15 ''
|
||||
The height of preview window for vertical layout.
|
||||
'';
|
||||
|
||||
wrap = helpers.defaultNullOpts.mkBool false ''
|
||||
Wrap the line, `:h wrap` for detail.
|
||||
'';
|
||||
|
||||
bufLabel = helpers.defaultNullOpts.mkBool true ''
|
||||
Add label of current item buffer at the end of the item line.
|
||||
'';
|
||||
|
||||
shouldPreviewCb = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
A callback function to decide whether to preview while switching buffer, with
|
||||
(bufnr: number, qwinid: number) parameters.
|
||||
'';
|
||||
};
|
||||
|
||||
funcMap = helpers.mkNullOrOption (types.attrsOf types.str) ''
|
||||
The table for {function = key}.
|
||||
|
||||
Example (some default values):
|
||||
funcMap = {
|
||||
open = "<CR>";
|
||||
tab = "t";
|
||||
sclear = "z<Tab>";
|
||||
};
|
||||
'';
|
||||
|
||||
filter = {
|
||||
fzf = {
|
||||
actionFor = {
|
||||
"ctrl-t" = helpers.defaultNullOpts.mkStr "tabedit" ''
|
||||
Press ctrl-t to open up the item in a new tab.
|
||||
'';
|
||||
|
||||
"ctrl-v" = helpers.defaultNullOpts.mkStr "vsplit" ''
|
||||
Press ctrl-v to open up the item in a new vertical split.
|
||||
'';
|
||||
|
||||
"ctrl-x" = helpers.defaultNullOpts.mkStr "split" ''
|
||||
Press ctrl-x to open up the item in a new horizontal split.
|
||||
'';
|
||||
|
||||
"ctrl-q" = helpers.defaultNullOpts.mkStr "signtoggle" ''
|
||||
Press ctrl-q to toggle sign for the selected items.
|
||||
'';
|
||||
|
||||
"ctrl-c" = helpers.defaultNullOpts.mkStr "closeall" ''
|
||||
Press ctrl-c to close quickfix window and abort fzf.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOpts = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"--bind"
|
||||
"ctrl-o:toggle-all"
|
||||
] "Extra options for fzf.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options = {
|
||||
auto_enable = cfg.autoEnable;
|
||||
magic_window = cfg.magicWindow;
|
||||
auto_resize_height = cfg.autoResizeHeight;
|
||||
preview = with cfg.preview; {
|
||||
auto_preview = autoPreview;
|
||||
border_chars = borderChars;
|
||||
show_title = showTitle;
|
||||
delay_syntax = delaySyntax;
|
||||
win_height = winHeight;
|
||||
win_vheight = winVheight;
|
||||
inherit wrap;
|
||||
buf_label = bufLabel;
|
||||
should_preview_cb = shouldPreviewCb;
|
||||
};
|
||||
func_map = cfg.funcMap;
|
||||
filter = {
|
||||
fzf = with cfg.filter.fzf; {
|
||||
action_for = actionFor;
|
||||
extra_opts = extraOpts;
|
||||
};
|
||||
};
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('bqf').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
179
plugins/by-name/nvim-colorizer/default.nix
Normal file
179
plugins/by-name/nvim-colorizer/default.nix
Normal file
|
@ -0,0 +1,179 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.nvim-colorizer;
|
||||
|
||||
colorizer-options = {
|
||||
RGB = mkOption {
|
||||
description = "#RGB hex codes";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
RRGGBB = mkOption {
|
||||
description = "#RRGGBB hex codes";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
names = mkOption {
|
||||
description = "\"Name\" codes like Blue or blue";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
RRGGBBAA = mkOption {
|
||||
description = "#RRGGBBAA hex codes";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
AARRGGBB = mkOption {
|
||||
description = "0xAARRGGBB hex codes";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
rgb_fn = mkOption {
|
||||
description = "CSS rgb() and rgba() functions";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
hsl_fn = mkOption {
|
||||
description = "CSS hsl() and hsla() functions";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
css = mkOption {
|
||||
description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
css_fn = mkOption {
|
||||
description = "Enable all CSS *functions*: rgb_fn, hsl_fn";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
mode = mkOption {
|
||||
description = "Set the display mode";
|
||||
type = types.nullOr (
|
||||
types.enum [
|
||||
"foreground"
|
||||
"background"
|
||||
"virtualtext"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
tailwind = mkOption {
|
||||
description = "Enable tailwind colors";
|
||||
type = types.nullOr (
|
||||
types.oneOf [
|
||||
types.bool
|
||||
(types.enum [
|
||||
"normal"
|
||||
"lsp"
|
||||
"both"
|
||||
])
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
sass = {
|
||||
enable = mkOption {
|
||||
description = "Enable sass colors";
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
parsers = mkOption {
|
||||
description = "sass parsers settings";
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
virtualtext = mkOption {
|
||||
description = "Set the virtualtext character (only used when mode is set to 'virtualtext')";
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.nvim-colorizer = {
|
||||
enable = mkEnableOption "nvim-colorizer";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-colorizer" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-colorizer-lua"
|
||||
];
|
||||
};
|
||||
|
||||
fileTypes = mkOption {
|
||||
description = "Enable and/or configure highlighting for certain filetypes";
|
||||
type =
|
||||
with types;
|
||||
nullOr (
|
||||
listOf (
|
||||
either str (
|
||||
types.submodule {
|
||||
options = {
|
||||
language = mkOption {
|
||||
type = types.str;
|
||||
description = "The language this configuration should apply to.";
|
||||
};
|
||||
} // colorizer-options;
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
|
||||
userDefaultOptions = mkOption {
|
||||
description = "Default options";
|
||||
type = types.nullOr (types.submodule { options = colorizer-options; });
|
||||
default = null;
|
||||
};
|
||||
|
||||
bufTypes = mkOption {
|
||||
description = "Buftype value is fetched by vim.bo.buftype";
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
filetypes =
|
||||
if (cfg.fileTypes != null) then
|
||||
(
|
||||
let
|
||||
list = map (
|
||||
v:
|
||||
if builtins.isAttrs v then
|
||||
v.language + " = " + helpers.toLuaObject (builtins.removeAttrs v [ "language" ])
|
||||
else
|
||||
"'${v}'"
|
||||
) cfg.fileTypes;
|
||||
in
|
||||
"{" + (concatStringsSep "," list) + "}"
|
||||
)
|
||||
else
|
||||
"nil";
|
||||
in
|
||||
''
|
||||
require("colorizer").setup({
|
||||
filetypes = ${filetypes},
|
||||
user_default_options = ${helpers.toLuaObject cfg.userDefaultOptions},
|
||||
buftypes = ${helpers.toLuaObject cfg.bufTypes},
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
123
plugins/by-name/nvim-osc52/default.nix
Normal file
123
plugins/by-name/nvim-osc52/default.nix
Normal file
|
@ -0,0 +1,123 @@
|
|||
# TODO: As of nvim 0.10 this plugin is obsolete.
|
||||
# warning added 2024-06-21, remove after 24.11.
|
||||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.plugins.nvim-osc52 = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether to enable nvim-osc52, a plugin to use OSC52 sequences to copy/paste.
|
||||
|
||||
Note: this plugin is obsolete and will be removed after 24.11.
|
||||
As of Neovim 0.10 (specifically since [this PR][1]), native support for OSC52 has been added.
|
||||
Check [`:h clipboard-osc52`][2] for more details.
|
||||
|
||||
[1]: https://github.com/neovim/neovim/pull/25872
|
||||
[2]: https://neovim.io/doc/user/provider.html#clipboard-osc52
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-osc52" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-osc52"
|
||||
];
|
||||
};
|
||||
|
||||
maxLength = helpers.defaultNullOpts.mkInt 0 "Maximum length of selection (0 for no limit)";
|
||||
silent = helpers.defaultNullOpts.mkBool false "Disable message on successful copy";
|
||||
trim = helpers.defaultNullOpts.mkBool false "Trim text before copy";
|
||||
|
||||
keymaps = {
|
||||
enable = mkEnableOption "keymaps for copying using OSC52";
|
||||
|
||||
silent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether nvim-osc52 keymaps should be silent";
|
||||
default = false;
|
||||
};
|
||||
|
||||
copy = mkOption {
|
||||
type = types.str;
|
||||
description = "Copy into the system clipboard using OSC52";
|
||||
default = "<leader>y";
|
||||
};
|
||||
|
||||
copyLine = mkOption {
|
||||
type = types.str;
|
||||
description = "Copy line into the system clipboard using OSC52";
|
||||
default = "<leader>yy";
|
||||
};
|
||||
|
||||
copyVisual = mkOption {
|
||||
type = types.str;
|
||||
description = "Copy visual selection into the system clipboard using OSC52";
|
||||
default = "<leader>y";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.nvim-osc52;
|
||||
setupOptions = with cfg; {
|
||||
inherit silent trim;
|
||||
max_length = maxLength;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings = [
|
||||
''
|
||||
Nixvim(plugins.nvim-osc52): this plugin is obsolete and will be removed after 24.11.
|
||||
As of Neovim 0.10, native support for OSC52 has been added.
|
||||
See `:h clipboard-osc52` for more details: https://neovim.io/doc/user/provider.html#clipboard-osc52
|
||||
Definitions: ${lib.options.showDefs options.plugins.nvim-osc52.enable.definitionsWithLocations}
|
||||
''
|
||||
];
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
keymaps =
|
||||
with cfg.keymaps;
|
||||
mkIf enable [
|
||||
{
|
||||
mode = "n";
|
||||
key = copy;
|
||||
action.__raw = "require('osc52').copy_operator";
|
||||
options = {
|
||||
expr = true;
|
||||
inherit silent;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = copyLine;
|
||||
action = "${copy}_";
|
||||
options = {
|
||||
remap = true;
|
||||
inherit silent;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "v";
|
||||
key = copyVisual;
|
||||
action.__raw = "require('osc52').copy_visual";
|
||||
options.silent = silent;
|
||||
}
|
||||
];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('osc52').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
87
plugins/by-name/nvim-ufo/default.nix
Normal file
87
plugins/by-name/nvim-ufo/default.nix
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.nvim-ufo;
|
||||
in
|
||||
{
|
||||
options.plugins.nvim-ufo = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-ufo";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-ufo" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-ufo"
|
||||
];
|
||||
};
|
||||
|
||||
openFoldHlTimeout = helpers.defaultNullOpts.mkInt 400 ''
|
||||
Time in millisecond between the range to be highlgihted and to be cleared
|
||||
while opening the folded line, `0` value will disable the highlight
|
||||
'';
|
||||
|
||||
providerSelector = helpers.defaultNullOpts.mkLuaFn null ''
|
||||
A lua function as a selector for fold providers.
|
||||
'';
|
||||
|
||||
closeFoldKinds = helpers.mkNullOrOption types.attrs ''
|
||||
After the buffer is displayed (opened for the first time), close the
|
||||
folds whose range with `kind` field is included in this option. For now,
|
||||
'lsp' provider's standardized kinds are 'comment', 'imports' and 'region',
|
||||
run `UfoInspect` for details if your provider has extended the kinds.
|
||||
'';
|
||||
|
||||
foldVirtTextHandler = helpers.defaultNullOpts.mkLuaFn null "A lua function to customize fold virtual text";
|
||||
|
||||
enableGetFoldVirtText = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable a function with `lnum` as a parameter to capture the virtual text
|
||||
for the folded lines and export the function to `get_fold_virt_text` field of
|
||||
ctx table as 6th parameter in `fold_virt_text_handler`
|
||||
'';
|
||||
|
||||
preview = {
|
||||
winConfig = {
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "preview window" "";
|
||||
|
||||
winblend = helpers.defaultNullOpts.mkInt 12 "The winblend for preview window, `:h winblend`";
|
||||
|
||||
winhighlight = helpers.defaultNullOpts.mkStr "Normal:Normal" "The winhighlight for preview window, `:h winhighlight`";
|
||||
|
||||
maxheight = helpers.defaultNullOpts.mkInt 20 "The max height of preview window";
|
||||
};
|
||||
|
||||
mappings = helpers.mkNullOrOption types.attrs "Mappings for preview window";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
open_fold_hl_timeout = openFoldHlTimeout;
|
||||
provider_selector = providerSelector;
|
||||
close_fold_kinds = closeFoldKinds;
|
||||
fold_virt_text_handler = foldVirtTextHandler;
|
||||
enable_get_fold_virt_text = enableGetFoldVirtText;
|
||||
|
||||
preview = with preview; {
|
||||
inherit mappings;
|
||||
win_config = winConfig;
|
||||
};
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("ufo").setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
271
plugins/by-name/obsidian/default.nix
Normal file
271
plugins/by-name/obsidian/default.nix
Normal file
|
@ -0,0 +1,271 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "obsidian";
|
||||
originalName = "obsidian.nvim";
|
||||
package = "obsidian-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
## DEPRECATIONS
|
||||
# Introduced 2024-03-12
|
||||
# TODO: remove 2024-05-12
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"dir"
|
||||
"logLevel"
|
||||
"notesSubdir"
|
||||
[
|
||||
"templates"
|
||||
"subdir"
|
||||
]
|
||||
[
|
||||
"templates"
|
||||
"dateFormat"
|
||||
]
|
||||
[
|
||||
"templates"
|
||||
"timeFormat"
|
||||
]
|
||||
[
|
||||
"templates"
|
||||
"substitutions"
|
||||
]
|
||||
"noteIdFunc"
|
||||
"followUrlFunc"
|
||||
"noteFrontmatterFunc"
|
||||
"disableFrontmatter"
|
||||
[
|
||||
"completion"
|
||||
"nvimCmp"
|
||||
]
|
||||
[
|
||||
"completion"
|
||||
"minChars"
|
||||
]
|
||||
"mappings"
|
||||
[
|
||||
"dailyNotes"
|
||||
"folder"
|
||||
]
|
||||
[
|
||||
"dailyNotes"
|
||||
"dateFormat"
|
||||
]
|
||||
[
|
||||
"dailyNotes"
|
||||
"aliasFormat"
|
||||
]
|
||||
[
|
||||
"dailyNotes"
|
||||
"template"
|
||||
]
|
||||
"useAdvancedUri"
|
||||
"openAppForeground"
|
||||
"sortBy"
|
||||
"sortReversed"
|
||||
"openNotesIn"
|
||||
[
|
||||
"ui"
|
||||
"enable"
|
||||
]
|
||||
[
|
||||
"ui"
|
||||
"updateDebounce"
|
||||
]
|
||||
[
|
||||
"ui"
|
||||
"externalLinkIcon"
|
||||
"char"
|
||||
]
|
||||
[
|
||||
"ui"
|
||||
"externalLinkIcon"
|
||||
"hlGroup"
|
||||
]
|
||||
[
|
||||
"ui"
|
||||
"referenceText"
|
||||
"hlGroup"
|
||||
]
|
||||
[
|
||||
"ui"
|
||||
"highlightText"
|
||||
"hlGroup"
|
||||
]
|
||||
[
|
||||
"ui"
|
||||
"tags"
|
||||
"hlGroup"
|
||||
]
|
||||
[
|
||||
"ui"
|
||||
"hlGroups"
|
||||
]
|
||||
[
|
||||
"attachments"
|
||||
"imgFolder"
|
||||
]
|
||||
[
|
||||
"attachments"
|
||||
"imgTextFunc"
|
||||
]
|
||||
"yamlParser"
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"obsidian"
|
||||
];
|
||||
in
|
||||
[
|
||||
(
|
||||
# We have to remove the option here because the user could set old-style camelCase options in each workspaces element.
|
||||
mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "workspaces" ]
|
||||
) "Please use `plugins.obsidian.settings.workspaces` instead."
|
||||
)
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "finder" ]) (
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"picker"
|
||||
"name"
|
||||
]
|
||||
))
|
||||
(
|
||||
# https://github.com/epwalsh/obsidian.nvim/blob/656d9c2c64528839db8b2d9a091843b3c90155a2/CHANGELOG.md?plain=1#L184
|
||||
mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"completion"
|
||||
"newNotesLocation"
|
||||
]
|
||||
)
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
"new_notes_location"
|
||||
]
|
||||
)
|
||||
)
|
||||
(
|
||||
# We have to remove the option here because the user could set old-style camelCase options in each checkbox element.
|
||||
mkRemovedOptionModule (
|
||||
basePluginPath
|
||||
++ [
|
||||
"ui"
|
||||
"checkboxes"
|
||||
]
|
||||
) "Please use `plugins.obsidian.settings.ui.checkboxes` instead."
|
||||
)
|
||||
]
|
||||
++ (map
|
||||
(
|
||||
optionPath:
|
||||
mkRemovedOptionModule (basePluginPath ++ optionPath) "This option was deprecated by upstream."
|
||||
)
|
||||
[
|
||||
[ "detectCwd" ]
|
||||
[ "backlinks" ]
|
||||
[
|
||||
"completion"
|
||||
"prependNoteId"
|
||||
]
|
||||
[
|
||||
"completion"
|
||||
"prependNotePath"
|
||||
]
|
||||
[
|
||||
"completion"
|
||||
"usePathOnly"
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
opts = import ./options.nix { inherit lib helpers; };
|
||||
in
|
||||
{
|
||||
dir = helpers.mkNullOrOption types.str ''
|
||||
Alternatively to `workspaces` - and for backwards compatibility - you can set `dir` to a
|
||||
single path instead of `workspaces`.
|
||||
|
||||
For example:
|
||||
```nix
|
||||
dir = "~/vaults/work";
|
||||
```
|
||||
'';
|
||||
|
||||
workspaces =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
listOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
description = "The name for this workspace";
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
description = "The of the workspace.";
|
||||
};
|
||||
|
||||
overrides = opts;
|
||||
};
|
||||
}
|
||||
)
|
||||
)
|
||||
[ ]
|
||||
''
|
||||
A list of vault names and paths.
|
||||
Each path should be the path to the vault root.
|
||||
If you use the Obsidian app, the vault root is the parent directory of the `.obsidian`
|
||||
folder.
|
||||
You can also provide configuration overrides for each workspace through the `overrides`
|
||||
field.
|
||||
'';
|
||||
}
|
||||
// opts;
|
||||
|
||||
settingsExample = {
|
||||
workspaces = [
|
||||
{
|
||||
name = "work";
|
||||
path = "~/obsidian/work";
|
||||
}
|
||||
{
|
||||
name = "startup";
|
||||
path = "~/obsidian/startup";
|
||||
}
|
||||
];
|
||||
new_notes_location = "current_dir";
|
||||
completion = {
|
||||
nvim_cmp = true;
|
||||
min_chars = 2;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
let
|
||||
nvimCmpEnabled = isBool cfg.settings.completion.nvim_cmp && cfg.settings.completion.nvim_cmp;
|
||||
in
|
||||
optional (nvimCmpEnabled && !config.plugins.cmp.enable) ''
|
||||
Nixvim (plugins.obsidian): You have enabled `completion.nvim_cmp` but `plugins.cmp.enable` is `false`.
|
||||
You should probably enable `nvim-cmp`.
|
||||
'';
|
||||
};
|
||||
}
|
576
plugins/by-name/obsidian/options.nix
Normal file
576
plugins/by-name/obsidian/options.nix
Normal file
|
@ -0,0 +1,576 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
{
|
||||
# https://github.com/epwalsh/obsidian.nvim/blob/main/lua/obsidian/config.lua
|
||||
|
||||
log_level = helpers.defaultNullOpts.mkLogLevel "info" ''
|
||||
Set the log level for obsidian.nvim.
|
||||
'';
|
||||
|
||||
notes_subdir = helpers.mkNullOrStr ''
|
||||
If you keep notes in a specific subdirectory of your vault.
|
||||
'';
|
||||
|
||||
templates = {
|
||||
subdir = helpers.mkNullOrStr ''
|
||||
The name of the directory where templates are stored.
|
||||
|
||||
Example: "templates"
|
||||
'';
|
||||
|
||||
date_format = helpers.mkNullOrStr ''
|
||||
Which date format to use.
|
||||
|
||||
Example: "%Y-%m-%d"
|
||||
'';
|
||||
|
||||
time_format = helpers.mkNullOrStr ''
|
||||
Which time format to use.
|
||||
|
||||
Example: "%H:%M"
|
||||
'';
|
||||
|
||||
substitutions = helpers.defaultNullOpts.mkAttrsOf (
|
||||
with helpers.nixvimTypes; either str rawLua
|
||||
) { } "A map for custom variables, the key should be the variable and the value a function.";
|
||||
};
|
||||
|
||||
new_notes_location =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"current_dir"
|
||||
"notes_subdir"
|
||||
]
|
||||
''
|
||||
Where to put new notes created from completion.
|
||||
|
||||
Valid options are
|
||||
- "current_dir" - put new notes in same directory as the current buffer.
|
||||
- "notes_subdir" - put new notes in the default notes subdirectory.
|
||||
'';
|
||||
|
||||
note_id_func = helpers.mkNullOrLuaFn ''
|
||||
Customize how names/IDs for new notes are created.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(title)
|
||||
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
|
||||
-- In this case a note with the title 'My new note' will be given an ID that looks
|
||||
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
|
||||
local suffix = ""
|
||||
if title ~= nil then
|
||||
-- If title is given, transform it into valid file name.
|
||||
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
|
||||
else
|
||||
-- If title is nil, just add 4 random uppercase letters to the suffix.
|
||||
for _ = 1, 4 do
|
||||
suffix = suffix .. string.char(math.random(65, 90))
|
||||
end
|
||||
end
|
||||
return tostring(os.time()) .. "-" .. suffix
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
note_path_func = helpers.mkNullOrLuaFn ''
|
||||
Customize how note file names are generated given the ID, target directory, and title.
|
||||
|
||||
```lua
|
||||
---@param spec { id: string, dir: obsidian.Path, title: string|? }
|
||||
---@return string|obsidian.Path The full path to the new note.
|
||||
```
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(spec)
|
||||
-- This is equivalent to the default behavior.
|
||||
local path = spec.dir / tostring(spec.id)
|
||||
return path:with_suffix(".md")
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
wiki_link_func = helpers.mkNullOrLuaFn ''
|
||||
Customize how wiki links are formatted.
|
||||
|
||||
```lua
|
||||
---@param opts {path: string, label: string, id: string|?}
|
||||
---@return string
|
||||
```
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(opts)
|
||||
if opts.id == nil then
|
||||
return string.format("[[%s]]", opts.label)
|
||||
elseif opts.label ~= opts.id then
|
||||
return string.format("[[%s|%s]]", opts.id, opts.label)
|
||||
else
|
||||
return string.format("[[%s]]", opts.id)
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Default: See source
|
||||
'';
|
||||
|
||||
markdown_link_func = helpers.mkNullOrLuaFn ''
|
||||
Customize how markdown links are formatted.
|
||||
|
||||
```lua
|
||||
---@param opts {path: string, label: string, id: string|?}
|
||||
---@return string links are formatted.
|
||||
```
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(opts)
|
||||
return string.format("[%s](%s)", opts.label, opts.path)
|
||||
end
|
||||
```
|
||||
|
||||
Default: See source
|
||||
'';
|
||||
|
||||
preferred_link_style =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"wiki"
|
||||
"markdown"
|
||||
]
|
||||
''
|
||||
Either 'wiki' or 'markdown'.
|
||||
'';
|
||||
|
||||
follow_url_func = helpers.mkNullOrLuaFn ''
|
||||
By default when you use `:ObsidianFollowLink` on a link to an external URL it will be
|
||||
ignored but you can customize this behavior here.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(url)
|
||||
-- Open the URL in the default web browser.
|
||||
vim.fn.jobstart({"open", url}) -- Mac OS
|
||||
-- vim.fn.jobstart({"xdg-open", url}) -- linux
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
image_name_func = helpers.mkNullOrLuaFn ''
|
||||
Customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function()
|
||||
-- Prefix image names with timestamp.
|
||||
return string.format("%s-", os.time())
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
note_frontmatter_func = helpers.mkNullOrLuaFn ''
|
||||
You can customize the frontmatter data.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(note)
|
||||
-- Add the title of the note as an alias.
|
||||
if note.title then
|
||||
note:add_alias(note.title)
|
||||
end
|
||||
|
||||
local out = { id = note.id, aliases = note.aliases, tags = note.tags }
|
||||
|
||||
-- `note.metadata` contains any manually added fields in the frontmatter.
|
||||
-- So here we just make sure those fields are kept in the frontmatter.
|
||||
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
|
||||
for k, v in pairs(note.metadata) do
|
||||
out[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
return out
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
disable_frontmatter = helpers.mkNullOrStrLuaFnOr types.bool ''
|
||||
Boolean or a function that takes a filename and returns a boolean.
|
||||
`true` indicates that you don't want obsidian.nvim to manage frontmatter.
|
||||
|
||||
Default: `false`
|
||||
'';
|
||||
|
||||
completion = {
|
||||
# FIXME should this accept raw types?
|
||||
nvim_cmp = helpers.mkNullOrOption' {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Set to false to disable completion.
|
||||
'';
|
||||
defaultText = literalMD "`true` if `plugins.cmp.enable` is enabled (otherwise `null`).";
|
||||
};
|
||||
|
||||
min_chars = helpers.defaultNullOpts.mkUnsignedInt 2 ''
|
||||
Trigger completion at this many chars.
|
||||
'';
|
||||
};
|
||||
|
||||
mappings =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
action = mkOption {
|
||||
type = helpers.nixvimTypes.strLua;
|
||||
description = "The lua code for this keymap action.";
|
||||
apply = helpers.mkRaw;
|
||||
};
|
||||
opts = helpers.keymaps.mapConfigOptions // {
|
||||
buffer = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, the mapping will be effective in the current buffer only.
|
||||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
)
|
||||
{
|
||||
gf = {
|
||||
action = "require('obsidian').util.gf_passthrough";
|
||||
opts = {
|
||||
noremap = false;
|
||||
expr = true;
|
||||
buffer = true;
|
||||
};
|
||||
};
|
||||
|
||||
"<leader>ch" = {
|
||||
action = "require('obsidian').util.toggle_checkbox";
|
||||
opts.buffer = true;
|
||||
};
|
||||
}
|
||||
''
|
||||
Configure key mappings.
|
||||
'';
|
||||
|
||||
picker = {
|
||||
name =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"telescope.nvim"
|
||||
"fzf-lua"
|
||||
"mini.pick"
|
||||
])
|
||||
''
|
||||
Set your preferred picker.
|
||||
'';
|
||||
|
||||
note_mappings =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
{
|
||||
new = "<C-x>";
|
||||
insert_link = "<C-l>";
|
||||
}
|
||||
''
|
||||
Optional, configure note mappings for the picker. These are the defaults.
|
||||
Not all pickers support all mappings.
|
||||
'';
|
||||
|
||||
tag_mappings =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.str
|
||||
{
|
||||
tag_note = "<C-x>";
|
||||
insert_tag = "<C-l>";
|
||||
}
|
||||
''
|
||||
Optional, configure tag mappings for the picker. These are the defaults.
|
||||
Not all pickers support all mappings.
|
||||
'';
|
||||
};
|
||||
|
||||
daily_notes = {
|
||||
folder = helpers.mkNullOrStr ''
|
||||
Optional, if you keep daily notes in a separate directory.
|
||||
'';
|
||||
|
||||
date_format = helpers.mkNullOrStr ''
|
||||
Optional, if you want to change the date format for the ID of daily notes.
|
||||
|
||||
Example: "%Y-%m-%d"
|
||||
'';
|
||||
|
||||
alias_format = helpers.mkNullOrStr ''
|
||||
Optional, if you want to change the date format of the default alias of daily notes.
|
||||
|
||||
Example: "%B %-d, %Y"
|
||||
'';
|
||||
|
||||
template = helpers.mkNullOrStr ''
|
||||
Optional, if you want to automatically insert a template from your template directory like
|
||||
'daily.md'.
|
||||
'';
|
||||
};
|
||||
|
||||
use_advanced_uri = helpers.defaultNullOpts.mkBool false ''
|
||||
Set to true to force ':ObsidianOpen' to bring the app to the foreground.
|
||||
'';
|
||||
|
||||
open_app_foreground = helpers.defaultNullOpts.mkBool false ''
|
||||
Set to true to force `:ObsidianOpen` to bring the app to the foreground.
|
||||
'';
|
||||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"path"
|
||||
"modified"
|
||||
"accessed"
|
||||
"created"
|
||||
]
|
||||
"modified"
|
||||
''
|
||||
Sort search results by "path", "modified", "accessed", or "created".
|
||||
The recommend value is "modified" and `true` for `sortReversed`, which means, for example,
|
||||
that `:ObsidianQuickSwitch` will show the notes sorted by latest modified time.
|
||||
'';
|
||||
|
||||
sort_reversed = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether search results should be reversed.
|
||||
'';
|
||||
|
||||
open_notes_in =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"current"
|
||||
"vsplit"
|
||||
"hsplit"
|
||||
]
|
||||
''
|
||||
Determines how certain commands open notes.
|
||||
|
||||
The valid options are:
|
||||
- "current" (the default) - to always open in the current window
|
||||
- "vsplit" - to open in a vertical split if there's not already a vertical split
|
||||
- "hsplit" - to open in a horizontal split if there's not already a horizontal split
|
||||
'';
|
||||
|
||||
ui = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Set to false to disable all additional syntax features.
|
||||
'';
|
||||
|
||||
update_debounce = helpers.defaultNullOpts.mkUnsignedInt 200 ''
|
||||
Update delay after a text change (in milliseconds).
|
||||
'';
|
||||
|
||||
checkboxes =
|
||||
helpers.defaultNullOpts.mkAttrsOf
|
||||
(
|
||||
with types;
|
||||
submodule {
|
||||
options = {
|
||||
char = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
description = "The character to use for this checkbox.";
|
||||
};
|
||||
|
||||
hl_group = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
description = "The name of the highlight group to use for this checkbox.";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
{
|
||||
" " = {
|
||||
char = "";
|
||||
hl_group = "ObsidianTodo";
|
||||
};
|
||||
"x" = {
|
||||
char = "";
|
||||
hl_group = "ObsidianDone";
|
||||
};
|
||||
">" = {
|
||||
char = "";
|
||||
hl_group = "ObsidianRightArrow";
|
||||
};
|
||||
"~" = {
|
||||
char = "";
|
||||
hl_group = "ObsidianTilde";
|
||||
};
|
||||
}
|
||||
''
|
||||
Define how various check-boxes are displayed.
|
||||
You can also add more custom ones...
|
||||
|
||||
NOTE: the 'char' value has to be a single character, and the highlight groups are defined
|
||||
in the `ui.hl_groups` option.
|
||||
'';
|
||||
|
||||
bullets = {
|
||||
char = helpers.defaultNullOpts.mkStr "•" ''
|
||||
Which character to use for the bullets.
|
||||
'';
|
||||
|
||||
hl_group = helpers.defaultNullOpts.mkStr "ObsidianBullet" ''
|
||||
The name of the highlight group to use for the bullets.
|
||||
'';
|
||||
};
|
||||
|
||||
external_link_icon = {
|
||||
char = helpers.defaultNullOpts.mkStr "" ''
|
||||
Which character to use for the external link icon.
|
||||
'';
|
||||
|
||||
hl_group = helpers.defaultNullOpts.mkStr "ObsidianExtLinkIcon" ''
|
||||
The name of the highlight group to use for the external link icon.
|
||||
'';
|
||||
};
|
||||
|
||||
reference_text = {
|
||||
hl_group = helpers.defaultNullOpts.mkStr "ObsidianRefText" ''
|
||||
The name of the highlight group to use for reference text.
|
||||
'';
|
||||
};
|
||||
|
||||
highlight_text = {
|
||||
hl_group = helpers.defaultNullOpts.mkStr "ObsidianHighlightText" ''
|
||||
The name of the highlight group to use for highlight text.
|
||||
'';
|
||||
};
|
||||
|
||||
tags = {
|
||||
hl_group = helpers.defaultNullOpts.mkStr "ObsidianTag" ''
|
||||
The name of the highlight group to use for tags.
|
||||
'';
|
||||
};
|
||||
|
||||
hl_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight {
|
||||
ObsidianTodo = {
|
||||
bold = true;
|
||||
fg = "#f78c6c";
|
||||
};
|
||||
ObsidianDone = {
|
||||
bold = true;
|
||||
fg = "#89ddff";
|
||||
};
|
||||
ObsidianRightArrow = {
|
||||
bold = true;
|
||||
fg = "#f78c6c";
|
||||
};
|
||||
ObsidianTilde = {
|
||||
bold = true;
|
||||
fg = "#ff5370";
|
||||
};
|
||||
ObsidianRefText = {
|
||||
underline = true;
|
||||
fg = "#c792ea";
|
||||
};
|
||||
ObsidianExtLinkIcon = {
|
||||
fg = "#c792ea";
|
||||
};
|
||||
ObsidianTag = {
|
||||
italic = true;
|
||||
fg = "#89ddff";
|
||||
};
|
||||
ObsidianHighlightText = {
|
||||
bg = "#75662e";
|
||||
};
|
||||
} "Highlight group definitions.";
|
||||
};
|
||||
|
||||
attachments = {
|
||||
img_folder = helpers.defaultNullOpts.mkStr "assets/imgs" ''
|
||||
The default folder to place images in via `:ObsidianPasteImg`.
|
||||
|
||||
If this is a relative path it will be interpreted as relative to the vault root.
|
||||
You can always override this per image by passing a full path to the command instead of just
|
||||
a filename.
|
||||
'';
|
||||
|
||||
img_text_func =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(client, path)
|
||||
---@type string
|
||||
local link_path
|
||||
local vault_relative_path = client:vault_relative_path(path)
|
||||
if vault_relative_path ~= nil then
|
||||
-- Use relative path if the image is saved in the vault dir.
|
||||
link_path = vault_relative_path
|
||||
else
|
||||
-- Otherwise use the absolute path.
|
||||
link_path = tostring(path)
|
||||
end
|
||||
local display_name = vim.fs.basename(link_path)
|
||||
return string.format("", display_name, link_path)
|
||||
end
|
||||
''
|
||||
''
|
||||
A function that determines the text to insert in the note when pasting an image.
|
||||
It takes two arguments, the `obsidian.Client` and a plenary `Path` to the image file.
|
||||
|
||||
```lua
|
||||
@param client obsidian.Client
|
||||
@param path Path the absolute path to the image file
|
||||
@return string
|
||||
```
|
||||
'';
|
||||
|
||||
confirm_img_paste = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to prompt for confirmation when pasting an image.
|
||||
'';
|
||||
};
|
||||
|
||||
callbacks = {
|
||||
post_setup = helpers.mkNullOrLuaFn ''
|
||||
`fun(client: obsidian.Client)`
|
||||
|
||||
Runs right after the `obsidian.Client` is initialized.
|
||||
'';
|
||||
|
||||
enter_note = helpers.mkNullOrLuaFn ''
|
||||
`fun(client: obsidian.Client, note: obsidian.Note)`
|
||||
|
||||
Runs when entering a note buffer.
|
||||
'';
|
||||
|
||||
leave_note = helpers.mkNullOrLuaFn ''
|
||||
`fun(client: obsidian.Client, note: obsidian.Note)`
|
||||
|
||||
Runs when leaving a note buffer.
|
||||
'';
|
||||
|
||||
pre_write_note = helpers.mkNullOrLuaFn ''
|
||||
`fun(client: obsidian.Client, note: obsidian.Note)`
|
||||
|
||||
Runs right before writing a note buffer.
|
||||
'';
|
||||
|
||||
post_set_workspace = helpers.mkNullOrLuaFn ''
|
||||
`fun(client: obsidian.Client, workspace: obsidian.Workspace)`
|
||||
|
||||
Runs anytime the workspace is set/changed.
|
||||
'';
|
||||
};
|
||||
|
||||
yaml_parser =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"native"
|
||||
"yq"
|
||||
]
|
||||
''
|
||||
Set the YAML parser to use.
|
||||
|
||||
The valid options are:
|
||||
- "native" - uses a pure Lua parser that's fast but potentially misses some edge cases.
|
||||
- "yq" - uses the command-line tool yq (https://github.com/mikefarah/yq), which is more robust
|
||||
but much slower and needs to be installed separately.
|
||||
|
||||
In general you should be using the native parser unless you run into a bug with it, in which
|
||||
case you can temporarily switch to the "yq" parser until the bug is fixed.
|
||||
'';
|
||||
}
|
559
plugins/by-name/oil/default.nix
Normal file
559
plugins/by-name/oil/default.nix
Normal file
|
@ -0,0 +1,559 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "oil";
|
||||
originalName = "oil.nvim";
|
||||
package = "oil-nvim";
|
||||
|
||||
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.")
|
||||
];
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
dimensionType =
|
||||
with types;
|
||||
oneOf [
|
||||
ints.unsigned
|
||||
(numbers.between 0.0 1.0)
|
||||
(listOf (either ints.unsigned (numbers.between 0.0 1.0)))
|
||||
];
|
||||
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 = [ ];
|
||||
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"}`)
|
||||
|
||||
Default: `["icon"]`
|
||||
'';
|
||||
example = [
|
||||
"type"
|
||||
{
|
||||
__unkeyed = "icon";
|
||||
highlight = "Foo";
|
||||
default_file = "bar";
|
||||
directory = "dir";
|
||||
}
|
||||
"size"
|
||||
"permissions"
|
||||
];
|
||||
};
|
||||
|
||||
# Buffer-local options to use for oil buffers
|
||||
buf_options = {
|
||||
buflisted = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
bufhidden = helpers.defaultNullOpts.mkStr "hide" "";
|
||||
};
|
||||
|
||||
# Window-local options to use for oil buffers
|
||||
win_options = {
|
||||
wrap = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
signcolumn = helpers.defaultNullOpts.mkStr "no" "";
|
||||
|
||||
cursorcolumn = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
foldcolumn = helpers.defaultNullOpts.mkStr "0" "";
|
||||
|
||||
spell = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
list = helpers.defaultNullOpts.mkBool false "";
|
||||
|
||||
conceallevel = helpers.defaultNullOpts.mkUnsignedInt 3 "";
|
||||
|
||||
concealcursor = helpers.defaultNullOpts.mkStr "nvic" "";
|
||||
};
|
||||
|
||||
delete_to_trash = helpers.defaultNullOpts.mkBool false ''
|
||||
Deleted files will be removed with the trash_command (below).
|
||||
'';
|
||||
|
||||
skip_confirm_for_simple_edits = helpers.defaultNullOpts.mkBool false ''
|
||||
Skip the confirmation popup for simple operations.
|
||||
'';
|
||||
|
||||
prompt_save_on_select_new_entry = helpers.defaultNullOpts.mkBool true ''
|
||||
Selecting a new/moved/renamed file or directory will prompt you to save changes first.
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
lsp_file_method = {
|
||||
timeout_ms = helpers.defaultNullOpts.mkUnsignedInt 1000 ''
|
||||
Time to wait for LSP file operations to complete before skipping.
|
||||
'';
|
||||
|
||||
autosave_changes = helpers.defaultNullOpts.mkNullable (with types; either bool str) "false" ''
|
||||
Set to true to autosave buffers that are updated with LSP `willRenameFiles`.
|
||||
Set to "unmodified" to only save unmodified buffers.
|
||||
'';
|
||||
};
|
||||
|
||||
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.
|
||||
'';
|
||||
|
||||
experimental_watch_for_changes = helpers.defaultNullOpts.mkBool false ''
|
||||
Set to true to watch the filesystem for changes and reload oil.
|
||||
'';
|
||||
|
||||
keymaps =
|
||||
helpers.defaultNullOpts.mkAttrsOf
|
||||
(
|
||||
with types;
|
||||
oneOf [
|
||||
str
|
||||
(attrsOf anything)
|
||||
(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.
|
||||
'';
|
||||
|
||||
keymaps_help = helpers.defaultNullOpts.mkAttrsOf types.anything { border = "rounded"; } ''
|
||||
Configuration for the floating keymaps help window.
|
||||
'';
|
||||
|
||||
use_default_keymaps = helpers.defaultNullOpts.mkBool true ''
|
||||
Set to false to disable all of the above keymaps.
|
||||
'';
|
||||
|
||||
view_options = {
|
||||
show_hidden = helpers.defaultNullOpts.mkBool false ''
|
||||
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_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.
|
||||
Is less performant, so you may want to set to `false` if you work with large directories.
|
||||
'';
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
float = {
|
||||
padding = helpers.defaultNullOpts.mkUnsignedInt 2 "Padding around the floating window.";
|
||||
|
||||
max_width = helpers.defaultNullOpts.mkUnsignedInt 0 "";
|
||||
|
||||
max_height = helpers.defaultNullOpts.mkUnsignedInt 0 "";
|
||||
|
||||
border = helpers.defaultNullOpts.mkBorder "rounded" "oil.open_float" "";
|
||||
|
||||
win_options = {
|
||||
winblend = helpers.defaultNullOpts.mkUnsignedInt 0 "";
|
||||
};
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
preview = {
|
||||
max_width = helpers.defaultNullOpts.mkNullable dimensionType 0.9 ''
|
||||
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`max_width = [100 0.8]` means "the lesser of 100 columns or 80% of total".
|
||||
'';
|
||||
|
||||
min_width =
|
||||
helpers.defaultNullOpts.mkNullable dimensionType
|
||||
[
|
||||
40
|
||||
0.4
|
||||
]
|
||||
''
|
||||
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`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.";
|
||||
|
||||
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%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`max_height = [80 0.9]` means "the lesser of 80 columns or 90% of total".
|
||||
'';
|
||||
|
||||
min_height =
|
||||
helpers.defaultNullOpts.mkNullable dimensionType
|
||||
[
|
||||
5
|
||||
0.1
|
||||
]
|
||||
''
|
||||
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`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.";
|
||||
|
||||
border = helpers.defaultNullOpts.mkStr "rounded" "";
|
||||
|
||||
win_options = {
|
||||
winblend = helpers.defaultNullOpts.mkUnsignedInt 0 "";
|
||||
};
|
||||
|
||||
update_on_cursor_moved = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the preview window is automatically updated when the cursor is moved.
|
||||
'';
|
||||
};
|
||||
|
||||
progress = {
|
||||
max_width = helpers.defaultNullOpts.mkNullable dimensionType 0.9 ''
|
||||
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`max_width = [100 0.8]` means "the lesser of 100 columns or 80% of total".
|
||||
'';
|
||||
|
||||
min_width =
|
||||
helpers.defaultNullOpts.mkNullable dimensionType
|
||||
[
|
||||
40
|
||||
0.4
|
||||
]
|
||||
''
|
||||
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`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.";
|
||||
|
||||
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%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`max_height = [80 0.9]` means "the lesser of 80 columns or 90% of total".
|
||||
'';
|
||||
|
||||
min_height =
|
||||
helpers.defaultNullOpts.mkNullable dimensionType
|
||||
[
|
||||
5
|
||||
0.1
|
||||
]
|
||||
''
|
||||
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
|
||||
Can be a single value or a list of mixed integer/float types.
|
||||
`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.";
|
||||
|
||||
border = helpers.defaultNullOpts.mkStr "rounded" "";
|
||||
|
||||
minimized_border = helpers.defaultNullOpts.mkStr "none" "";
|
||||
|
||||
win_options = {
|
||||
winblend = helpers.defaultNullOpts.mkUnsignedInt 0 "";
|
||||
};
|
||||
};
|
||||
|
||||
ssh = {
|
||||
border = helpers.defaultNullOpts.mkStr "rounded" ''
|
||||
Configuration for the floating SSH window.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
233
plugins/by-name/ollama/default.nix
Normal file
233
plugins/by-name/ollama/default.nix
Normal file
|
@ -0,0 +1,233 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.ollama;
|
||||
|
||||
actionOptionType =
|
||||
with helpers.nixvimTypes;
|
||||
oneOf [
|
||||
rawLua
|
||||
(enum [
|
||||
"display"
|
||||
"replace"
|
||||
"insert"
|
||||
"display_replace"
|
||||
"display_insert"
|
||||
"display_prompt"
|
||||
])
|
||||
(submodule {
|
||||
options = {
|
||||
fn = helpers.mkNullOrStrLuaFnOr (enum [ false ]) ''
|
||||
fun(prompt: table): Ollama.PromptActionResponseCallback
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(prompt)
|
||||
-- This function is called when the prompt is selected
|
||||
-- just before sending the prompt to the LLM.
|
||||
-- Useful for setting up UI or other state.
|
||||
|
||||
-- Return a function that will be used as a callback
|
||||
-- when a response is received.
|
||||
---@type Ollama.PromptActionResponseCallback
|
||||
return function(body, job)
|
||||
-- body is a table of the json response
|
||||
-- body.response is the response text received
|
||||
|
||||
-- job is the plenary.job object when opts.stream = true
|
||||
-- job is nil otherwise
|
||||
end
|
||||
|
||||
end
|
||||
```
|
||||
'';
|
||||
|
||||
opts = {
|
||||
stream = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to stream the response.
|
||||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.ollama = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "ollama.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "ollama.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"ollama-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
model = helpers.defaultNullOpts.mkStr "mistral" ''
|
||||
The default model to use.
|
||||
'';
|
||||
|
||||
prompts =
|
||||
let
|
||||
promptOptions = {
|
||||
prompt = mkOption {
|
||||
type = with helpers.nixvimTypes; maybeRaw str;
|
||||
description = ''
|
||||
The prompt to send to the model.
|
||||
|
||||
Replaces the following tokens:
|
||||
- `$input`: The input from the user
|
||||
- `$sel`: The currently selected text
|
||||
- `$ftype`: The filetype of the current buffer
|
||||
- `$fname`: The filename of the current buffer
|
||||
- `$buf`: The contents of the current buffer
|
||||
- `$line`: The current line in the buffer
|
||||
- `$lnum`: The current line number in the buffer
|
||||
'';
|
||||
};
|
||||
|
||||
inputLabel = helpers.defaultNullOpts.mkStr "> " ''
|
||||
The label to use for an input field.
|
||||
'';
|
||||
|
||||
action = helpers.mkNullOrOption actionOptionType ''
|
||||
How to handle the output.
|
||||
|
||||
See [here](https://github.com/nomnivore/ollama.nvim/tree/main#actions) for more details.
|
||||
|
||||
Defaults to the value of `plugins.ollama.action`.
|
||||
'';
|
||||
|
||||
model = helpers.mkNullOrStr ''
|
||||
The model to use for this prompt.
|
||||
|
||||
Defaults to the value of `plugins.ollama.model`.
|
||||
'';
|
||||
|
||||
extract =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with helpers.nixvimTypes; maybeRaw (either str (enum [ false ])))
|
||||
"```$ftype\n(.-)```"
|
||||
''
|
||||
A `string.match` pattern to use for an Action to extract the output from the response
|
||||
(Insert/Replace).
|
||||
'';
|
||||
|
||||
options = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
Additional model parameters, such as temperature, listed in the documentation for the [Modelfile](https://github.com/jmorganca/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values).
|
||||
'';
|
||||
|
||||
system = helpers.mkNullOrStr ''
|
||||
The SYSTEM instruction specifies the system prompt to be used in the Modelfile template,
|
||||
if applicable.
|
||||
(overrides what's in the Modelfile).
|
||||
'';
|
||||
|
||||
format = helpers.defaultNullOpts.mkEnumFirstDefault [ "json" ] ''
|
||||
The format to return a response in.
|
||||
Currently the only accepted value is `"json"`.
|
||||
'';
|
||||
};
|
||||
|
||||
processPrompt =
|
||||
prompt:
|
||||
if isAttrs prompt then
|
||||
{
|
||||
inherit (prompt) prompt;
|
||||
input_label = prompt.inputLabel;
|
||||
inherit (prompt)
|
||||
action
|
||||
model
|
||||
extract
|
||||
options
|
||||
system
|
||||
format
|
||||
;
|
||||
}
|
||||
else
|
||||
prompt;
|
||||
in
|
||||
mkOption {
|
||||
type = with types; attrsOf (either (submodule { options = promptOptions; }) (enum [ false ]));
|
||||
default = { };
|
||||
apply = v: mapAttrs (_: processPrompt) v;
|
||||
description = ''
|
||||
A table of prompts to use for each model.
|
||||
Default prompts are defined [here](https://github.com/nomnivore/ollama.nvim/blob/main/lua/ollama/prompts.lua).
|
||||
'';
|
||||
};
|
||||
|
||||
action = helpers.defaultNullOpts.mkNullable actionOptionType "display" ''
|
||||
How to handle prompt outputs when not specified by prompt.
|
||||
|
||||
See [here](https://github.com/nomnivore/ollama.nvim/tree/main#actions) for more details.
|
||||
'';
|
||||
|
||||
url = helpers.defaultNullOpts.mkStr "http://127.0.0.1:11434" ''
|
||||
The url to use to connect to the ollama server.
|
||||
'';
|
||||
|
||||
serve = {
|
||||
onStart = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to start the ollama server on startup.
|
||||
'';
|
||||
|
||||
command = helpers.defaultNullOpts.mkStr "ollama" ''
|
||||
The command to use to start the ollama server.
|
||||
'';
|
||||
|
||||
args = helpers.defaultNullOpts.mkListOf types.str [ "serve" ] ''
|
||||
The arguments to pass to the serve command.
|
||||
'';
|
||||
|
||||
stopCommand = helpers.defaultNullOpts.mkStr "pkill" ''
|
||||
The command to use to stop the ollama server.
|
||||
'';
|
||||
|
||||
stopArgs =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"-SIGTERM"
|
||||
"ollama"
|
||||
]
|
||||
''
|
||||
The arguments to pass to the stop command.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit
|
||||
model
|
||||
prompts
|
||||
action
|
||||
url
|
||||
;
|
||||
serve = with serve; {
|
||||
on_start = onStart;
|
||||
inherit command args;
|
||||
stop_command = stopCommand;
|
||||
stop_args = stopArgs;
|
||||
};
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('ollama').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
79
plugins/by-name/persistence/default.nix
Normal file
79
plugins/by-name/persistence/default.nix
Normal file
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.plugins.persistence = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "persistence.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "persistence.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"persistence-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
dir = helpers.defaultNullOpts.mkStr {
|
||||
__raw = ''vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/")'';
|
||||
} "directory where session files are saved";
|
||||
|
||||
options =
|
||||
let
|
||||
# https://neovim.io/doc/user/options.html#'sessionoptions'
|
||||
sessionOpts = [
|
||||
"blank"
|
||||
"buffers"
|
||||
"curdir"
|
||||
"folds"
|
||||
"globals"
|
||||
"help"
|
||||
"localoptions"
|
||||
"options"
|
||||
"skiprtp"
|
||||
"resize"
|
||||
"sesdir"
|
||||
"tabpages"
|
||||
"terminal"
|
||||
"winpos"
|
||||
"winsize"
|
||||
];
|
||||
in
|
||||
helpers.defaultNullOpts.mkListOf (types.enum sessionOpts) [
|
||||
"buffers"
|
||||
"curdir"
|
||||
"tabpages"
|
||||
"winsize"
|
||||
"skiprtp"
|
||||
] "sessionoptions used for saving";
|
||||
|
||||
preSave = helpers.defaultNullOpts.mkLuaFn "nil" "a function to call before saving the session";
|
||||
|
||||
saveEmpty = helpers.defaultNullOpts.mkBool false ''
|
||||
don't save if there are no open file buffers
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.persistence;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
opts = {
|
||||
inherit (cfg) dir options;
|
||||
pre_save = cfg.preSave;
|
||||
save_empty = cfg.saveEmpty;
|
||||
};
|
||||
in
|
||||
''
|
||||
require('persistence').setup(${helpers.toLuaObject opts})
|
||||
'';
|
||||
};
|
||||
}
|
222
plugins/by-name/presence-nvim/default.nix
Normal file
222
plugins/by-name/presence-nvim/default.nix
Normal file
|
@ -0,0 +1,222 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.presence-nvim;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.presence-nvim = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "presence-nvim";
|
||||
package = lib.mkPackageOption pkgs "presence-nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"presence-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
# General options.
|
||||
autoUpdate = helpers.defaultNullOpts.mkBool true ''
|
||||
Update activity based on autocmd events.
|
||||
If `false`, map or manually execute
|
||||
`:lua package.loaded.presence:update()`
|
||||
'';
|
||||
|
||||
neovimImageText = helpers.defaultNullOpts.mkStr "The One True Text Editor" ''
|
||||
Text displayed when hovered over the Neovim image.
|
||||
'';
|
||||
|
||||
mainImage =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"neovim"
|
||||
"file"
|
||||
]
|
||||
''
|
||||
Main image display.
|
||||
'';
|
||||
|
||||
clientId = helpers.defaultNullOpts.mkStr "793271441293967371" ''
|
||||
Use your own Discord application client id. (not recommended)
|
||||
'';
|
||||
|
||||
logLevel =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"debug"
|
||||
"info"
|
||||
"warn"
|
||||
"error"
|
||||
]
|
||||
null
|
||||
''
|
||||
Log messages at or above this level.
|
||||
'';
|
||||
|
||||
debounceTimeout = helpers.defaultNullOpts.mkInt 10 ''
|
||||
Number of seconds to debounce events.
|
||||
(or calls to `:lua package.loaded.presence:update(<filename>, true)`)
|
||||
'';
|
||||
|
||||
enableLineNumber = helpers.defaultNullOpts.mkBool false ''
|
||||
Displays the current line number instead of the current project.
|
||||
'';
|
||||
|
||||
blacklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
A list of strings or Lua patterns that disable Rich Presence if the
|
||||
current file name, path, or workspace matches.
|
||||
'';
|
||||
|
||||
buttons =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(types.submodule {
|
||||
options = {
|
||||
label = helpers.mkNullOrOption types.str "";
|
||||
url = helpers.mkNullOrOption types.str "";
|
||||
};
|
||||
})
|
||||
[ ]
|
||||
''
|
||||
Button configurations which will always appear in Rich Presence.
|
||||
|
||||
Can be a list of attribute sets, each with the following attributes:
|
||||
|
||||
`label`: The label of the button. e.g. `"GitHub Profile"`.
|
||||
|
||||
`url`: The URL the button leads to. e.g. `"https://github.com/<NAME>"`.
|
||||
|
||||
Can also be a lua function: `function(buffer: string, repo_url: string|nil): table)`
|
||||
'';
|
||||
|
||||
fileAssets = helpers.mkNullOrOption (with types; attrsOf (listOf str)) ''
|
||||
Custom file asset definitions keyed by file names and extensions.
|
||||
|
||||
List elements for each attribute (filetype):
|
||||
|
||||
`name`: The name of the asset shown as the title of the file in Discord.
|
||||
|
||||
`source`: The source of the asset, either an art asset key or the URL of an image asset.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
# Use art assets uploaded in Discord application for the configured client id
|
||||
js = [ "JavaScript" "javascript" ];
|
||||
ts = [ "TypeScript" "typescript" ];
|
||||
# Use image URLs
|
||||
rs = [ "Rust" "https://www.rust-lang.org/logos/rust-logo-512x512.png" ];
|
||||
go = [ "Go" "https://go.dev/blog/go-brand/Go-Logo/PNG/Go-Logo_Aqua.png" ];
|
||||
};
|
||||
```
|
||||
'';
|
||||
|
||||
showTime = helpers.defaultNullOpts.mkBool true "Show the timer.";
|
||||
|
||||
# Rich presence text options.
|
||||
editingText =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Editing %s"
|
||||
''
|
||||
String rendered when an editable file is loaded in the buffer.
|
||||
|
||||
Can also be a lua function:
|
||||
`function(filename: string): string`
|
||||
'';
|
||||
|
||||
fileExplorerText =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Browsing %s"
|
||||
''
|
||||
String rendered when browsing a file explorer.
|
||||
|
||||
Can also be a lua function:
|
||||
`function(file_explorer_name: string): string`
|
||||
'';
|
||||
|
||||
gitCommitText =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
|
||||
"Committing changes"
|
||||
''
|
||||
String rendered when committing changes in git.
|
||||
|
||||
Can also be a lua function:
|
||||
`function(filename: string): string`
|
||||
'';
|
||||
|
||||
pluginManagerText =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
|
||||
"Managing plugins"
|
||||
''
|
||||
String rendered when managing plugins.
|
||||
|
||||
Can also be a lua function:
|
||||
`function(plugin_manager_name: string): string`
|
||||
'';
|
||||
|
||||
readingText =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Reading %s"
|
||||
''
|
||||
String rendered when a read-only/unmodifiable file is loaded into the buffer.
|
||||
|
||||
Can also be a lua function:
|
||||
`function(filename: string): string`
|
||||
'';
|
||||
|
||||
workspaceText =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
|
||||
"Working on %s"
|
||||
''
|
||||
String rendered when in a git repository.
|
||||
|
||||
Can also be a lua function:
|
||||
`function(project_name: string|nil, filename: string): string`
|
||||
'';
|
||||
|
||||
lineNumberText =
|
||||
helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua)
|
||||
"Line %s out of %s"
|
||||
''
|
||||
String rendered when `enableLineNumber` is set to `true` to display the current line number.
|
||||
|
||||
Can also be a lua function:
|
||||
`function(line_number: number, line_count: number): string`
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
# General options.
|
||||
auto_update = cfg.autoUpdate;
|
||||
neovim_image_text = cfg.neovimImageText;
|
||||
main_image = cfg.mainImage;
|
||||
client_id = cfg.clientId;
|
||||
log_level = cfg.logLevel;
|
||||
debounce_timeout = cfg.debounceTimeout;
|
||||
enable_line_number = cfg.enableLineNumber;
|
||||
inherit (cfg) blacklist;
|
||||
file_assets = cfg.fileAssets;
|
||||
show_time = cfg.showTime;
|
||||
inherit (cfg) buttons;
|
||||
|
||||
# Rich presence text options.
|
||||
editing_text = cfg.editingText;
|
||||
file_explorer_text = cfg.fileExplorerText;
|
||||
git_commit_text = cfg.gitCommitText;
|
||||
plugin_manager_text = cfg.pluginManagerText;
|
||||
reading_text = cfg.readingText;
|
||||
workspace_text = cfg.workspaceText;
|
||||
line_number_text = cfg.lineNumberText;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua = ''
|
||||
require("presence").setup${helpers.toLuaObject setupOptions}
|
||||
'';
|
||||
};
|
||||
}
|
130
plugins/by-name/project-nvim/default.nix
Normal file
130
plugins/by-name/project-nvim/default.nix
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "project-nvim";
|
||||
originalName = "project.nvim";
|
||||
luaName = "project_nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
# TODO: added 2024-09-03 remove after 24.11
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"manualMode"
|
||||
"detectionMethods"
|
||||
"patterns"
|
||||
"ignoreLsp"
|
||||
"excludeDirs"
|
||||
"showHidden"
|
||||
"silentChdir"
|
||||
"scopeChdir"
|
||||
"dataPath"
|
||||
];
|
||||
imports = [
|
||||
# TODO: added 2024-03-13 remove after 24.11
|
||||
(lib.mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"telescope"
|
||||
"extensions"
|
||||
"project-nvim"
|
||||
"enable"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"project-nvim"
|
||||
"enableTelescope"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
manual_mode = defaultNullOpts.mkBool false ''
|
||||
Manual mode doesn't automatically change your root directory, so you have the option to
|
||||
manually do so using `:ProjectRoot` command.
|
||||
'';
|
||||
|
||||
detection_methods =
|
||||
defaultNullOpts.mkListOf lib.types.str
|
||||
[
|
||||
"lsp"
|
||||
"pattern"
|
||||
]
|
||||
''
|
||||
Methods of detecting the root directory.
|
||||
**"lsp"** uses the native neovim lsp, while **"pattern"** uses vim-rooter like glob pattern
|
||||
matching.
|
||||
Here order matters: if one is not detected, the other is used as fallback.
|
||||
You can also delete or rearangne the detection methods.
|
||||
'';
|
||||
|
||||
patterns =
|
||||
defaultNullOpts.mkListOf lib.types.str
|
||||
[
|
||||
".git"
|
||||
"_darcs"
|
||||
".hg"
|
||||
".bzr"
|
||||
".svn"
|
||||
"Makefile"
|
||||
"package.json"
|
||||
]
|
||||
''
|
||||
All the patterns used to detect root dir, when **"pattern"** is in `detectionMethods`.
|
||||
'';
|
||||
|
||||
ignore_lsp = defaultNullOpts.mkListOf lib.types.str [ ] "Table of lsp clients to ignore by name.";
|
||||
|
||||
exclude_dirs =
|
||||
defaultNullOpts.mkListOf lib.types.str [ ]
|
||||
"Don't calculate root dir on specific directories.";
|
||||
|
||||
show_hidden = defaultNullOpts.mkBool false "Show hidden files in telescope.";
|
||||
|
||||
silent_chdir = defaultNullOpts.mkBool true ''
|
||||
When set to false, you will get a message when `project.nvim` changes your directory.
|
||||
'';
|
||||
|
||||
scope_chdir =
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"global"
|
||||
"tab"
|
||||
"win"
|
||||
]
|
||||
''
|
||||
What scope to change the directory.
|
||||
'';
|
||||
|
||||
data_path = defaultNullOpts.mkStr {
|
||||
__raw = "vim.fn.stdpath('data')";
|
||||
} "Path where project.nvim will store the project history for use in telescope.";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
detection_methods = [ "lsp" ];
|
||||
patterns = [ ".git" ];
|
||||
ignore_lsp = [ "tsserver" ];
|
||||
excludeDirs = [ "/home/user/secret-directory" ];
|
||||
showHidden = true;
|
||||
silent_chdir = false;
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
enableTelescope = lib.mkEnableOption "project-nvim telescope integration";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = lib.optional (cfg.enableTelescope && (!config.plugins.telescope.enable)) ''
|
||||
Telescope support for project-nvim is enabled but the telescope plugin is not.
|
||||
'';
|
||||
|
||||
plugins.telescope.enabledExtensions = lib.mkIf cfg.enableTelescope [ "projects" ];
|
||||
};
|
||||
}
|
46
plugins/by-name/quickmath/default.nix
Normal file
46
plugins/by-name/quickmath/default.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.quickmath;
|
||||
in
|
||||
{
|
||||
options.plugins.quickmath = {
|
||||
enable = mkEnableOption "quickmath.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "quickmath.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"quickmath-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
keymap = {
|
||||
key = helpers.mkNullOrOption types.str "Keymap to run the `:Quickmath` command.";
|
||||
|
||||
silent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether the quickmath keymap should be silent.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
keymaps =
|
||||
with cfg.keymap;
|
||||
optional (key != null) {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = ":Quickmath<CR>";
|
||||
options.silent = cfg.keymap.silent;
|
||||
};
|
||||
};
|
||||
}
|
161
plugins/by-name/refactoring/default.nix
Normal file
161
plugins/by-name/refactoring/default.nix
Normal file
|
@ -0,0 +1,161 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "refactoring";
|
||||
originalName = "refactoring.nvim";
|
||||
package = "refactoring-nvim";
|
||||
|
||||
maintainers = [ maintainers.MattSturgeon ];
|
||||
|
||||
# TODO: introduced 2024-05-24, remove on 2024-08-24
|
||||
optionsRenamedToSettings = [
|
||||
"promptFuncReturnType"
|
||||
"promptFuncParamType"
|
||||
"printVarStatements"
|
||||
"printfStatements"
|
||||
"extractVarStatements"
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
enableTelescope = mkEnableOption "telescope integration";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
message = ''
|
||||
Nixvim: You have enabled the `telescope` integration with refactoring-nvim.
|
||||
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope [ "refactoring" ];
|
||||
};
|
||||
|
||||
settingsOptions = with helpers.nixvimTypes; {
|
||||
prompt_func_return_type =
|
||||
helpers.defaultNullOpts.mkAttrsOf bool
|
||||
{
|
||||
go = false;
|
||||
java = false;
|
||||
cpp = false;
|
||||
c = false;
|
||||
h = false;
|
||||
hpp = false;
|
||||
cxx = false;
|
||||
}
|
||||
''
|
||||
For certain languages like Golang, types are required for functions that return an object(s).
|
||||
Unfortunately, for some functions there is no way to automatically find their type. In those instances,
|
||||
we want to provide a way to input a type instead of inserting a placeholder value.
|
||||
|
||||
Set the relevant language(s) to `true` to enable prompting for a return type, e.g:
|
||||
|
||||
|
||||
```nix
|
||||
{
|
||||
go = true;
|
||||
cpp = true;
|
||||
c = true;
|
||||
java = true;
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
prompt_func_param_type =
|
||||
helpers.defaultNullOpts.mkAttrsOf bool
|
||||
{
|
||||
go = false;
|
||||
java = false;
|
||||
cpp = false;
|
||||
c = false;
|
||||
h = false;
|
||||
hpp = false;
|
||||
cxx = false;
|
||||
}
|
||||
''
|
||||
For certain languages like Golang, types are required for functions parameters.
|
||||
Unfortunately, for some parameters there is no way to automatically find their type. In those instances,
|
||||
we want to provide a way to input a type instead of inserting a placeholder value.
|
||||
|
||||
Set the relevant language(s) to `true` to enable prompting for parameter types, e.g:
|
||||
|
||||
|
||||
```nix
|
||||
{
|
||||
go = true;
|
||||
cpp = true;
|
||||
c = true;
|
||||
java = true;
|
||||
}
|
||||
'';
|
||||
|
||||
printf_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } ''
|
||||
In any custom printf statement, it is possible to optionally add a **max of one `%s` pattern**, which is where the debug path will go.
|
||||
For an example custom printf statement, go to [this folder][folder], select your language, and click on `multiple-statements/printf.config`.
|
||||
|
||||
Note: if you have multiple custom statements, the plugin will prompt for which one should be inserted.
|
||||
If you just have one custom statement in your config, it will override the default automatically.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{
|
||||
# add a custom printf statement for cpp
|
||||
cpp = [ "std::cout << \"%s\" << std::endl;" ];
|
||||
}
|
||||
```
|
||||
|
||||
[folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/printf
|
||||
'';
|
||||
|
||||
print_var_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } ''
|
||||
In any custom print var statement, it is possible to optionally add a **max of two `%s` patterns**, which is where the debug path and
|
||||
the actual variable reference will go, respectively. To add a literal `"%s"` to the string, escape the sequence like this: `%%s`.
|
||||
For an example custom print var statement, go to [this folder][folder], select your language, and view `multiple-statements/print_var.config`.
|
||||
|
||||
Note: if you have multiple custom statements, the plugin will prompt for which one should be inserted.
|
||||
If you just have one custom statement in your config, it will override the default automatically.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{
|
||||
# add a custom print var statement for cpp
|
||||
cpp = [ "printf(\"a custom statement %%s %s\", %s)" ];
|
||||
}
|
||||
```
|
||||
|
||||
[folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/print_var
|
||||
'';
|
||||
|
||||
extract_var_statements = helpers.defaultNullOpts.mkAttrsOf str { } ''
|
||||
When performing an `extract_var` refactor operation, you can custom how the new variable would be declared by setting configuration
|
||||
like the below example.
|
||||
|
||||
Example:
|
||||
|
||||
```nix
|
||||
{
|
||||
# overriding extract statement for go
|
||||
go = "%s := %s // poggers";
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
show_success_message = helpers.defaultNullOpts.mkBool false ''
|
||||
Shows a message with information about the refactor on success. Such as:
|
||||
|
||||
```
|
||||
[Refactor] Inlined 3 variable occurrences
|
||||
```
|
||||
'';
|
||||
};
|
||||
}
|
11
plugins/by-name/repeat/default.nix
Normal file
11
plugins/by-name/repeat/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
lib.nixvim.vim-plugin.mkVimPlugin {
|
||||
name = "repeat";
|
||||
originalName = "vim-repeat";
|
||||
package = "vim-repeat";
|
||||
|
||||
maintainers = [ lib.nixvim.maintainers.refaelsh ];
|
||||
}
|
402
plugins/by-name/rest/default.nix
Normal file
402
plugins/by-name/rest/default.nix
Normal file
|
@ -0,0 +1,402 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "rest";
|
||||
originalName = "rest.nvim";
|
||||
luaName = "rest-nvim";
|
||||
package = "rest-nvim";
|
||||
|
||||
extraPackages = [ pkgs.curl ];
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-04-07: remove 2024-06-07
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"envFile"
|
||||
"encodeUrl"
|
||||
"skipSslVerification"
|
||||
"customDynamicVariables"
|
||||
[
|
||||
"highlight"
|
||||
"timeout"
|
||||
]
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"rest"
|
||||
];
|
||||
settingsPath = basePluginPath ++ [ "settings" ];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "resultSplitHorizontal" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"split"
|
||||
"horizontal"
|
||||
]
|
||||
))
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "resultSplitInPlace" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"split"
|
||||
"in_place"
|
||||
]
|
||||
))
|
||||
(mkRenamedOptionModule (basePluginPath ++ [ "stayInCurrentWindowAfterSplit" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"split"
|
||||
"stay_in_current_window_after_split"
|
||||
]
|
||||
))
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"result"
|
||||
"showUrl"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"behavior"
|
||||
"show_info"
|
||||
"url"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"result"
|
||||
"showHeaders"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"behavior"
|
||||
"show_info"
|
||||
"headers"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"result"
|
||||
"showHttpInfo"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"behavior"
|
||||
"show_info"
|
||||
"http_info"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"result"
|
||||
"showCurlCommand"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"behavior"
|
||||
"show_info"
|
||||
"curl_command"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRemovedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"result"
|
||||
"showStatistics"
|
||||
]
|
||||
)
|
||||
''
|
||||
Use `plugins.rest.settings.result.behavior.statistics.{enable,stats}` instead.
|
||||
Refer to the documentation for more information.
|
||||
''
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"result"
|
||||
"formatters"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"result"
|
||||
"behavior"
|
||||
"formatters"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"highlight"
|
||||
"enabled"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"highlight"
|
||||
"enable"
|
||||
]
|
||||
)
|
||||
)
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "jumpToRequest" ]) ''
|
||||
This option has been deprecated upstream.
|
||||
'')
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "yankDryRun" ]) ''
|
||||
This option has been deprecated upstream.
|
||||
'')
|
||||
(mkRemovedOptionModule (basePluginPath ++ [ "searchBack" ]) ''
|
||||
This option has been deprecated upstream.
|
||||
'')
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
client = helpers.defaultNullOpts.mkStr "curl" ''
|
||||
The HTTP client to be used when running requests.
|
||||
'';
|
||||
|
||||
env_file = helpers.defaultNullOpts.mkStr ".env" ''
|
||||
Environment variables file to be used for the request variables in the document.
|
||||
'';
|
||||
|
||||
env_pattern = helpers.defaultNullOpts.mkStr "\\.env$" ''
|
||||
Environment variables file pattern for `telescope.nvim`.
|
||||
'';
|
||||
|
||||
env_edit_command = helpers.defaultNullOpts.mkStr "tabedit" ''
|
||||
Neovim command to edit an environment file.
|
||||
'';
|
||||
|
||||
encode_url = helpers.defaultNullOpts.mkBool true ''
|
||||
Encode URL before making request.
|
||||
'';
|
||||
|
||||
skip_ssl_verification = helpers.defaultNullOpts.mkBool false ''
|
||||
Skip SSL verification, useful for unknown certificates.
|
||||
'';
|
||||
|
||||
custom_dynamic_variables = mkOption {
|
||||
type = with helpers.nixvimTypes; nullOr (maybeRaw (attrsOf strLuaFn));
|
||||
default = null;
|
||||
example = {
|
||||
"$timestamp" = "os.time";
|
||||
"$randomInt" = ''
|
||||
function()
|
||||
return math.random(0, 1000)
|
||||
end
|
||||
'';
|
||||
};
|
||||
description = ''
|
||||
Custom dynamic variables. Keys are variable names and values are lua functions.
|
||||
|
||||
default: `{}`
|
||||
'';
|
||||
apply = v: if isAttrs v then mapAttrs (_: helpers.mkRaw) v else v;
|
||||
};
|
||||
|
||||
logs = {
|
||||
level = helpers.defaultNullOpts.mkNullable helpers.nixvimTypes.logLevel "info" ''
|
||||
The logging level name, see `:h vim.log.levels`.
|
||||
'';
|
||||
|
||||
save = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to save log messages into a `.log` file.
|
||||
'';
|
||||
};
|
||||
|
||||
result = {
|
||||
split = {
|
||||
horizontal = helpers.defaultNullOpts.mkBool false ''
|
||||
Open request results in a horizontal split.
|
||||
'';
|
||||
|
||||
in_place = helpers.defaultNullOpts.mkBool false ''
|
||||
Keep the HTTP file buffer above|left when split horizontal|vertical.
|
||||
'';
|
||||
|
||||
stay_in_current_window_after_split = helpers.defaultNullOpts.mkBool true ''
|
||||
Stay in the current window (HTTP file) or change the focus to the results window.
|
||||
'';
|
||||
};
|
||||
|
||||
behavior = {
|
||||
show_info = {
|
||||
url = helpers.defaultNullOpts.mkBool true ''
|
||||
Display the request URL.
|
||||
'';
|
||||
|
||||
headers = helpers.defaultNullOpts.mkBool true ''
|
||||
Display the request headers.
|
||||
'';
|
||||
|
||||
http_info = helpers.defaultNullOpts.mkBool true ''
|
||||
Display the request HTTP information.
|
||||
'';
|
||||
|
||||
curl_command = helpers.defaultNullOpts.mkBool true ''
|
||||
Display the cURL command that was used for the request.
|
||||
'';
|
||||
};
|
||||
|
||||
decode_url = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to decode the request URL query parameters to improve readability.
|
||||
'';
|
||||
|
||||
statistics = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable statistics or not.
|
||||
'';
|
||||
|
||||
stats = helpers.defaultNullOpts.mkListOf (with types; attrsOf str) [
|
||||
{
|
||||
__unkeyed = "total_time";
|
||||
title = "Time taken:";
|
||||
}
|
||||
{
|
||||
__unkeyed = "size_download_t";
|
||||
title = "Download size:";
|
||||
}
|
||||
] "See https://curl.se/libcurl/c/curl_easy_getinfo.html.";
|
||||
};
|
||||
|
||||
formatters = {
|
||||
json = helpers.defaultNullOpts.mkStr "jq" ''
|
||||
JSON formatter.
|
||||
'';
|
||||
|
||||
html = helpers.defaultNullOpts.mkStr {
|
||||
__raw = ''
|
||||
function(body)
|
||||
if vim.fn.executable("tidy") == 0 then
|
||||
return body, { found = false, name = "tidy" }
|
||||
end
|
||||
local fmt_body = vim.fn.system({
|
||||
"tidy",
|
||||
"-i",
|
||||
"-q",
|
||||
"--tidy-mark", "no",
|
||||
"--show-body-only", "auto",
|
||||
"--show-errors", "0",
|
||||
"--show-warnings", "0",
|
||||
"-",
|
||||
}, body):gsub("\n$", "")
|
||||
|
||||
return fmt_body, { found = true, name = "tidy" }
|
||||
end
|
||||
'';
|
||||
} "HTML formatter.";
|
||||
};
|
||||
};
|
||||
|
||||
keybinds = {
|
||||
buffer_local = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable keybinds only in request result buffer.
|
||||
'';
|
||||
|
||||
prev = helpers.defaultNullOpts.mkStr "H" ''
|
||||
Mapping for cycle to previous result pane.
|
||||
'';
|
||||
|
||||
next = helpers.defaultNullOpts.mkStr "L" ''
|
||||
Mapping for cycle to next result pane.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
highlight = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether current request highlighting is enabled or not.
|
||||
'';
|
||||
|
||||
timeout = helpers.defaultNullOpts.mkUnsignedInt 750 ''
|
||||
Duration time of the request highlighting in milliseconds.
|
||||
'';
|
||||
};
|
||||
|
||||
keybinds =
|
||||
helpers.defaultNullOpts.mkListOf (with types; listOf str)
|
||||
[
|
||||
[
|
||||
"<localleader>rr"
|
||||
"<cmd>Rest run<cr>"
|
||||
"Run request under the cursor"
|
||||
]
|
||||
[
|
||||
"<localleader>rl"
|
||||
"<cmd>Rest run last<cr>"
|
||||
"Re-run latest request"
|
||||
]
|
||||
]
|
||||
''
|
||||
Declare some keybindings.
|
||||
Format: list of 3 strings lists: key, action and description.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
client = "curl";
|
||||
env_file = ".env";
|
||||
logs = {
|
||||
level = "info";
|
||||
save = true;
|
||||
};
|
||||
result = {
|
||||
split = {
|
||||
horizontal = false;
|
||||
in_place = false;
|
||||
stay_in_current_window_after_split = true;
|
||||
};
|
||||
};
|
||||
keybinds = [
|
||||
[
|
||||
"<localleader>rr"
|
||||
"<cmd>Rest run<cr>"
|
||||
"Run request under the cursor"
|
||||
]
|
||||
[
|
||||
"<localleader>rl"
|
||||
"<cmd>Rest run last<cr>"
|
||||
"Re-run latest request"
|
||||
]
|
||||
];
|
||||
};
|
||||
}
|
41
plugins/by-name/sandwich/default.nix
Normal file
41
plugins/by-name/sandwich/default.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "sandwich";
|
||||
originalName = "vim-sandwich";
|
||||
package = "vim-sandwich";
|
||||
globalPrefix = "sandwich_";
|
||||
|
||||
description = ''
|
||||
The `settings` option will not let you define the options starting with `sandwich#`.
|
||||
For those, you can directly use the `globals` option:
|
||||
```nix
|
||||
globals."sandwich#magicchar#f#patterns" = [
|
||||
{
|
||||
header.__raw = "[[\<\%(\h\k*\.\)*\h\k*]]";
|
||||
bra = "(";
|
||||
ket = ")";
|
||||
footer = "";
|
||||
}
|
||||
];
|
||||
```
|
||||
'';
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
no_default_key_mappings = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Whether to disable the default mappings.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
no_default_key_mappings = 1;
|
||||
no_tex_ftplugin = 1;
|
||||
no_vim_ftplugin = 1;
|
||||
};
|
||||
}
|
48
plugins/by-name/scope/default.nix
Normal file
48
plugins/by-name/scope/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "scope";
|
||||
originalName = "scope.nvim";
|
||||
package = "scope-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.insipx ];
|
||||
|
||||
settingsOptions = {
|
||||
hooks = {
|
||||
pre_tab_enter = lib.nixvim.defaultNullOpts.mkLuaFn null ''
|
||||
Run custom logic before entering a tab.
|
||||
'';
|
||||
|
||||
post_tab_enter = lib.nixvim.defaultNullOpts.mkLuaFn null ''
|
||||
Run custom logic after entering a tab.
|
||||
'';
|
||||
|
||||
pre_tab_leave = lib.nixvim.defaultNullOpts.mkLuaFn null ''
|
||||
Run custom logic before leaving a tab.
|
||||
'';
|
||||
post_tab_leave = lib.nixvim.defaultNullOpts.mkLuaFn null ''
|
||||
Run custom logic after leaving a tab.
|
||||
'';
|
||||
|
||||
pre_tab_close = lib.nixvim.defaultNullOpts.mkLuaFn null ''
|
||||
Run custom logic before closing a tab.
|
||||
'';
|
||||
|
||||
post_tab_close = lib.nixvim.defaultNullOpts.mkLuaFn null ''
|
||||
Run custom logic after closing a tab.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
settings = {
|
||||
pre_tab_enter.__raw = ''
|
||||
function()
|
||||
print("about to enter tab!")
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
38
plugins/by-name/sleuth/default.nix
Normal file
38
plugins/by-name/sleuth/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "sleuth";
|
||||
originalName = "vim-sleuth";
|
||||
package = "vim-sleuth";
|
||||
globalPrefix = "sleuth_";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
heuristics = helpers.defaultNullOpts.mkFlagInt 1 ''
|
||||
Whether to enable/disable heuristics by default.
|
||||
|
||||
You can also disable heuristics for individual filetypes:
|
||||
```nix
|
||||
settings = {
|
||||
heuristics = 1;
|
||||
gitcommit_heuristics = 0;
|
||||
};
|
||||
```
|
||||
'';
|
||||
|
||||
no_filetype_indent_on = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
Sleuth forces `|:filetype-indent-on|` by default, which enables file-type specific indenting
|
||||
algorithms and is highly recommended.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
heuristics = 1;
|
||||
gitcommit_heuristics = 0;
|
||||
no_filetype_indent_on = 1;
|
||||
};
|
||||
}
|
29
plugins/by-name/smart-splits/default.nix
Normal file
29
plugins/by-name/smart-splits/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "smart-splits";
|
||||
originalName = "smart-splits.nvim";
|
||||
package = "smart-splits-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.foo-dogsquared ];
|
||||
|
||||
settingsExample = {
|
||||
resize_mode = {
|
||||
quit_key = "<ESC>";
|
||||
resize_keys = [
|
||||
"h"
|
||||
"j"
|
||||
"k"
|
||||
"l"
|
||||
];
|
||||
silent = true;
|
||||
};
|
||||
ignored_events = [
|
||||
"BufEnter"
|
||||
"WinEnter"
|
||||
];
|
||||
};
|
||||
}
|
290
plugins/by-name/spectre/default.nix
Normal file
290
plugins/by-name/spectre/default.nix
Normal file
|
@ -0,0 +1,290 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "spectre";
|
||||
originalName = "nvim-spectre";
|
||||
package = "nvim-spectre";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
description = ''
|
||||
You may want to set the package for your find/replace tool(s) like shown below:
|
||||
|
||||
```nix
|
||||
plugins.spectre.findPackage = pkgs.rg;
|
||||
plugins.spectre.replacePackage = pkgs.gnused;
|
||||
```
|
||||
'';
|
||||
|
||||
settingsOptions =
|
||||
let
|
||||
mkEngineOption =
|
||||
type:
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
cmd = mkOption {
|
||||
type = types.str;
|
||||
description = "Executable to run.";
|
||||
};
|
||||
|
||||
args = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
List of arguments to provide to the engine.
|
||||
'';
|
||||
|
||||
options = helpers.defaultNullOpts.mkAttrsOf (types.submodule {
|
||||
options = {
|
||||
value = mkOption {
|
||||
type = types.str;
|
||||
example = "-i";
|
||||
description = "The option flag.";
|
||||
};
|
||||
|
||||
icon = mkOption {
|
||||
type = types.str;
|
||||
example = "[I]";
|
||||
description = "The option icon.";
|
||||
};
|
||||
|
||||
desc = helpers.mkNullOrStr ''
|
||||
The description for this option.
|
||||
'';
|
||||
};
|
||||
}) { } "The options for this engine.";
|
||||
};
|
||||
})
|
||||
)
|
||||
''
|
||||
Definition of the ${type} engines.
|
||||
|
||||
default: see [here](https://github.com/nvim-pack/nvim-spectre/blob/master/lua/spectre/config.lua)
|
||||
'';
|
||||
in
|
||||
{
|
||||
color_devicons = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to enable color devicons.
|
||||
'';
|
||||
|
||||
open_cmd = helpers.defaultNullOpts.mkStr "vnew" ''
|
||||
The open command.
|
||||
'';
|
||||
|
||||
live_update = helpers.defaultNullOpts.mkBool false ''
|
||||
Auto execute search again when you write to any file in vim.
|
||||
'';
|
||||
|
||||
lnum_for_results = helpers.defaultNullOpts.mkBool false ''
|
||||
Show line number for search/replace results.
|
||||
'';
|
||||
|
||||
line_sep_start = helpers.defaultNullOpts.mkStr "┌──────────────────────────────────────────────────────" "Start of the line separator";
|
||||
|
||||
result_padding = helpers.defaultNullOpts.mkStr "│ " ''
|
||||
Result padding string.
|
||||
'';
|
||||
|
||||
line_sep = helpers.defaultNullOpts.mkStr "└──────────────────────────────────────────────────────" "Line separator.";
|
||||
|
||||
highlight = helpers.defaultNullOpts.mkAttrsOf types.str {
|
||||
headers = "SpectreHeader";
|
||||
ui = "SpectreBody";
|
||||
filename = "SpectreFile";
|
||||
filedirectory = "SpectreDir";
|
||||
search = "SpectreSearch";
|
||||
border = "SpectreBorder";
|
||||
replace = "SpectreReplace";
|
||||
} "Highlight groups.";
|
||||
|
||||
mapping =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
map = mkOption {
|
||||
type = types.str;
|
||||
description = "Keyboard shortcut.";
|
||||
};
|
||||
|
||||
cmd = mkOption {
|
||||
type = types.str;
|
||||
description = "Command to run.";
|
||||
example = "<cmd>lua require('spectre').tab()<cr>";
|
||||
};
|
||||
|
||||
desc = helpers.mkNullOrStr ''
|
||||
Description for this mapping.
|
||||
'';
|
||||
};
|
||||
})
|
||||
)
|
||||
''
|
||||
Keymaps declaration.
|
||||
|
||||
default: see [here](https://github.com/nvim-pack/nvim-spectre/blob/master/lua/spectre/config.lua)
|
||||
'';
|
||||
|
||||
find_engine = mkEngineOption "find";
|
||||
|
||||
replace_engine = mkEngineOption "replace";
|
||||
|
||||
default = {
|
||||
find = {
|
||||
cmd = helpers.defaultNullOpts.mkStr "rg" ''
|
||||
Which find engine to use. Pick one from the `find_engine` list.
|
||||
'';
|
||||
|
||||
options = helpers.defaultNullOpts.mkListOf types.str [ "ignore-case" ] ''
|
||||
Options to use for this engine.
|
||||
'';
|
||||
};
|
||||
|
||||
replace = {
|
||||
cmd = helpers.defaultNullOpts.mkStr "rg" ''
|
||||
Which find engine to use. Pick one from the `replace_engine` list.
|
||||
'';
|
||||
|
||||
options = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Options to use for this engine.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
replace_vim_cmd = helpers.defaultNullOpts.mkStr "cdo" ''
|
||||
The replace command to use within vim.
|
||||
'';
|
||||
|
||||
is_open_target_win = helpers.defaultNullOpts.mkBool true ''
|
||||
Open file on opener window.
|
||||
'';
|
||||
|
||||
is_insert_mode = helpers.defaultNullOpts.mkBool false ''
|
||||
Start open panel in insert mode.
|
||||
'';
|
||||
|
||||
is_block_ui_break = helpers.defaultNullOpts.mkBool false ''
|
||||
Mapping backspace and enter key to avoid ui break.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
live_update = true;
|
||||
is_insert_mode = false;
|
||||
find_engine = {
|
||||
rg = {
|
||||
cmd = "rg";
|
||||
args = [
|
||||
"--color=never"
|
||||
"--no-heading"
|
||||
"--with-filename"
|
||||
"--line-number"
|
||||
"--column"
|
||||
];
|
||||
options = {
|
||||
ignore-case = {
|
||||
value = "--ignore-case";
|
||||
icon = "[I]";
|
||||
desc = "ignore case";
|
||||
};
|
||||
hidden = {
|
||||
value = "--hidden";
|
||||
desc = "hidden file";
|
||||
icon = "[H]";
|
||||
};
|
||||
line = {
|
||||
value = "-x";
|
||||
icon = "[L]";
|
||||
desc = "match in line";
|
||||
};
|
||||
word = {
|
||||
value = "-w";
|
||||
icon = "[W]";
|
||||
desc = "match in word";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
default = {
|
||||
find = {
|
||||
cmd = "rg";
|
||||
options = [
|
||||
"word"
|
||||
"hidden"
|
||||
];
|
||||
};
|
||||
replace = {
|
||||
cmd = "sed";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extraOptions =
|
||||
let
|
||||
defaults = config.plugins.spectre.settings.default;
|
||||
|
||||
# NOTE: changes here should also be reflected in the `defaultText` below
|
||||
findPackages = {
|
||||
rg = pkgs.ripgrep;
|
||||
};
|
||||
|
||||
# NOTE: changes here should also be reflected in the `defaultText` below
|
||||
replacePackages = {
|
||||
sed = pkgs.gnused;
|
||||
inherit (pkgs) sd;
|
||||
};
|
||||
in
|
||||
{
|
||||
findPackage = lib.mkOption {
|
||||
type = with lib.types; nullOr package;
|
||||
default = findPackages.${toString defaults.find.cmd} or null;
|
||||
defaultText = literalMD ''
|
||||
Based on the value defined in `config.plugins.spectre.settings.default.find.cmd`,
|
||||
if the value defined there is a key in the attrset below, then the corresponding value is used. Otherwise the default will be `null`.
|
||||
|
||||
```nix
|
||||
{
|
||||
rg = pkgs.ripgrep;
|
||||
}
|
||||
```
|
||||
'';
|
||||
description = ''
|
||||
The package to use for the find command.
|
||||
'';
|
||||
};
|
||||
|
||||
replacePackage = lib.mkOption {
|
||||
type = with lib.types; nullOr package;
|
||||
default = replacePackages.${toString defaults.replace.cmd} or null;
|
||||
defaultText = literalMD ''
|
||||
Based on the value defined in `config.plugins.spectre.settings.default.replace.cmd`,
|
||||
if the value defined there is a key in the attrset below, then the corresponding value is used. Otherwise the default will be `null`.
|
||||
|
||||
```nix
|
||||
{
|
||||
sd = pkgs.sd;
|
||||
sed = pkgs.gnused;
|
||||
}
|
||||
```
|
||||
'';
|
||||
description = ''
|
||||
The package to use for the replace command.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPackages = [
|
||||
cfg.findPackage
|
||||
cfg.replacePackage
|
||||
];
|
||||
};
|
||||
}
|
80
plugins/by-name/spider/default.nix
Normal file
80
plugins/by-name/spider/default.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
pluginName = "spider";
|
||||
cfg = config.plugins.${pluginName};
|
||||
in
|
||||
{
|
||||
options.plugins.${pluginName} = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption pluginName;
|
||||
|
||||
package = lib.mkPackageOption pkgs pluginName {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-spider"
|
||||
];
|
||||
};
|
||||
|
||||
skipInsignificantPunctuation = helpers.defaultNullOpts.mkBool true "Whether to skip insignificant punctuation.";
|
||||
|
||||
keymaps = {
|
||||
silent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether ${pluginName} keymaps should be silent.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
motions = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
description = ''
|
||||
Mappings for spider motions.
|
||||
The keys are the motion and the values are the keyboard shortcuts.
|
||||
The shortcut might not necessarily be the same as the motion name.
|
||||
'';
|
||||
default = { };
|
||||
example = {
|
||||
w = "w";
|
||||
e = "e";
|
||||
b = "b";
|
||||
ge = "ge";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
inherit (cfg) skipInsignificantPunctuation;
|
||||
} // cfg.extraOptions;
|
||||
|
||||
mappings = mapAttrsToList (motion: key: {
|
||||
mode = [
|
||||
"n"
|
||||
"o"
|
||||
"x"
|
||||
];
|
||||
inherit key;
|
||||
action.__raw = "function() require('spider').motion('${motion}') end";
|
||||
options = {
|
||||
inherit (cfg.keymaps) silent;
|
||||
desc = "Spider-${motion}";
|
||||
};
|
||||
}) cfg.keymaps.motions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
keymaps = mappings;
|
||||
|
||||
extraConfigLua = ''
|
||||
require("${pluginName}").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
111
plugins/by-name/startify/default.nix
Normal file
111
plugins/by-name/startify/default.nix
Normal file
|
@ -0,0 +1,111 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "startify";
|
||||
originalName = "vim-startify";
|
||||
package = "vim-startify";
|
||||
globalPrefix = "startify_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-01: remove 2024-05-01
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"sessionDir"
|
||||
"lists"
|
||||
"bookmarks"
|
||||
"commands"
|
||||
"filesNumber"
|
||||
"sessionAutoload"
|
||||
"sessionBeforeSave"
|
||||
"sessionPersistence"
|
||||
"sessionDeleteBuffers"
|
||||
"changeToDir"
|
||||
"changeToVcsRoot"
|
||||
"changeCmd"
|
||||
"paddingLeft"
|
||||
"enableSpecial"
|
||||
"enableUnsafe"
|
||||
"sessionRemoveLines"
|
||||
"sessionNumber"
|
||||
"sessionSort"
|
||||
"customIndices"
|
||||
"customHeader"
|
||||
"customFooter"
|
||||
"relativePath"
|
||||
"useEnv"
|
||||
];
|
||||
imports =
|
||||
map
|
||||
(
|
||||
option:
|
||||
mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"startify"
|
||||
option.old
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"startify"
|
||||
"settings"
|
||||
option.new
|
||||
]
|
||||
)
|
||||
[
|
||||
{
|
||||
old = "updateOldFiles";
|
||||
new = "update_oldfiles";
|
||||
}
|
||||
{
|
||||
old = "skipList";
|
||||
new = "skiplist";
|
||||
}
|
||||
{
|
||||
old = "useUnicode";
|
||||
new = "fortune_use_unicode";
|
||||
}
|
||||
{
|
||||
old = "skipListServer";
|
||||
new = "skiplist_server";
|
||||
}
|
||||
{
|
||||
old = "sessionSaveVars";
|
||||
new = "session_savevars";
|
||||
}
|
||||
{
|
||||
old = "sessionCmds";
|
||||
new = "session_savecmds";
|
||||
}
|
||||
{
|
||||
old = "customQuotes";
|
||||
new = "custom_header_quotes";
|
||||
}
|
||||
{
|
||||
old = "disableAtVimEnter";
|
||||
new = "disable_at_vimenter";
|
||||
}
|
||||
];
|
||||
|
||||
settingsOptions = import ./options.nix { inherit lib helpers; };
|
||||
|
||||
# TODO
|
||||
settingsExample = {
|
||||
custom_header = [
|
||||
""
|
||||
" ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||
" ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||
" ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||
" ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||
" ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||
" ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||
];
|
||||
change_to_dir = false;
|
||||
fortune_use_unicode = true;
|
||||
};
|
||||
}
|
393
plugins/by-name/startify/options.nix
Normal file
393
plugins/by-name/startify/options.nix
Normal file
|
@ -0,0 +1,393 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
{
|
||||
session_dir = helpers.defaultNullOpts.mkStr "~/.vim/session" ''
|
||||
The directory to save/load sessions to/from.
|
||||
'';
|
||||
|
||||
lists = mkOption {
|
||||
type =
|
||||
with helpers.nixvimTypes;
|
||||
listOf (
|
||||
either strLua (submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = types.str;
|
||||
description = "The type of the list";
|
||||
example = "files";
|
||||
};
|
||||
|
||||
header = helpers.mkNullOrOption (with helpers.nixvimTypes; listOf (maybeRaw str)) ''
|
||||
The 'header' is a list of strings, whereas each string will be put on its own
|
||||
line in the header.
|
||||
'';
|
||||
|
||||
indices = helpers.mkNullOrOption (with helpers.nixvimTypes; listOf (maybeRaw str)) ''
|
||||
The 'indices' is a list of strings, which act as indices for the current list.
|
||||
Opposed to the global `custom_indices`, this is limited to the current list.
|
||||
'';
|
||||
};
|
||||
})
|
||||
);
|
||||
apply = v: map (listElem: if isString listElem then helpers.mkRaw listElem else listElem) v;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Startify displays lists. Each list consists of a `type` and optionally a `header` and
|
||||
custom `indices`.
|
||||
|
||||
Default:
|
||||
```nix
|
||||
[
|
||||
{
|
||||
type = "files";
|
||||
header = [" MRU"];
|
||||
}
|
||||
{
|
||||
type = "dir";
|
||||
header = [{__raw = "' MRU' .. vim.loop.cwd()";}];
|
||||
}
|
||||
{
|
||||
type = "sessions";
|
||||
header = [" Sessions"];
|
||||
}
|
||||
{
|
||||
type = "bookmarks";
|
||||
header = [" Bookmarks"];
|
||||
}
|
||||
{
|
||||
type = "commands";
|
||||
header = [" Commands"];
|
||||
}
|
||||
]
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
bookmarks =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(
|
||||
with helpers.nixvimTypes;
|
||||
oneOf [
|
||||
str
|
||||
rawLua
|
||||
attrs
|
||||
]
|
||||
)
|
||||
[ ]
|
||||
''
|
||||
A list of files or directories to bookmark.
|
||||
The list can contain two kinds of types.
|
||||
Either a path (str) or an attrs where the key is the custom index and the value is the path.
|
||||
'';
|
||||
|
||||
commands =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(
|
||||
with types;
|
||||
oneOf [
|
||||
str
|
||||
(attrsOf (either str (listOf str)))
|
||||
(listOf str)
|
||||
]
|
||||
)
|
||||
[ ]
|
||||
''
|
||||
A list of commands to execute on selection.
|
||||
Leading colons are optional.
|
||||
It supports optional custom indices and/or command descriptions.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
":help reference"
|
||||
["Vim Reference" "h ref"]
|
||||
{h = "h ref";}
|
||||
{m = ["My magical function" "call Magic()"];}
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
files_number = helpers.defaultNullOpts.mkUnsignedInt 10 ''
|
||||
The number of files to list.
|
||||
'';
|
||||
|
||||
update_oldfiles = helpers.defaultNullOpts.mkBool false ''
|
||||
Usually `|v:oldfiles|` only gets updated when Vim exits.
|
||||
Using this option updates it on-the-fly, so that `:Startify` is always up-to-date.
|
||||
'';
|
||||
|
||||
session_autoload = helpers.defaultNullOpts.mkBool false ''
|
||||
If this option is enabled and you start Vim in a directory that contains a `Session.vim`,
|
||||
that session will be loaded automatically.
|
||||
Otherwise it will be shown as the top entry in the Startify buffer.
|
||||
|
||||
The same happens when you `|:cd|` to a directory that contains a `Session.vim` and execute
|
||||
`|:Startify|`.
|
||||
|
||||
It also works if you open a bookmarked directory. See the `bookmarks` option.
|
||||
|
||||
This is great way to create a portable project folder!
|
||||
|
||||
NOTE: This option is affected by `session_delete_buffers`.
|
||||
'';
|
||||
|
||||
session_before_save = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
This is a list of commands to be executed before saving a session.
|
||||
|
||||
Example: `["silent! tabdo NERDTreeClose"]`
|
||||
'';
|
||||
|
||||
session_persistence = helpers.defaultNullOpts.mkBool false ''
|
||||
Automatically update sessions in two cases:
|
||||
- Before leaving Vim
|
||||
- Before loading a new session via `:SLoad`
|
||||
'';
|
||||
|
||||
session_delete_buffers = helpers.defaultNullOpts.mkBool true ''
|
||||
Delete all buffers when loading or closing a session:
|
||||
- When using `|startify-:SLoad|`.
|
||||
- When using `|startify-:SClose|`.
|
||||
- When using `session_autoload`.
|
||||
- When choosing a session from the Startify buffer.
|
||||
|
||||
NOTE: Buffers with unsaved changes are silently ignored.
|
||||
'';
|
||||
|
||||
change_to_dir = helpers.defaultNullOpts.mkBool true ''
|
||||
When opening a file or bookmark, change to its directory.
|
||||
|
||||
You want to disable this, if you're using `|'autochdir'|` as well.
|
||||
|
||||
NOTE: It defaults to `true`, because that was already the behaviour at the time this option was
|
||||
introduced.
|
||||
'';
|
||||
|
||||
change_to_vcs_root = helpers.defaultNullOpts.mkBool false ''
|
||||
When opening a file or bookmark, seek and change to the root directory of the VCS (if there is
|
||||
one).
|
||||
|
||||
At the moment only git, hg, bzr and svn are supported.
|
||||
'';
|
||||
|
||||
change_cmd = helpers.defaultNullOpts.mkStr "lcd" ''
|
||||
The default command for switching directories.
|
||||
|
||||
Valid values:
|
||||
- `cd`
|
||||
- `lcd`
|
||||
- `tcd`
|
||||
|
||||
Affects `change_to_dir` and `change_to_vcs_root`.
|
||||
'';
|
||||
|
||||
skiplist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
A list of Vim regular expressions that is used to filter recently used files.
|
||||
See `|pattern.txt|` for what patterns can be used.
|
||||
|
||||
The following patterns are filtered by default:
|
||||
- `'runtime/doc/.*\.txt$'`
|
||||
- `'bundle/.*/doc/.*\.txt$'`
|
||||
- `'plugged/.*/doc/.*\.txt$'`
|
||||
- `'/.git/'`
|
||||
- `'fugitiveblame$'`
|
||||
- `escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc/.*\.txt$'`
|
||||
|
||||
NOTE: Due to the nature of patterns, you can't just use "~/mysecret" but have to use
|
||||
"$HOME .'/mysecret.txt'".
|
||||
The former would do something entirely different: `|/\~|`.
|
||||
|
||||
NOTE: When using backslashes as path separators, escape them. Otherwise using
|
||||
"C:\this\vim\path\is\problematic" would not match what you would expect, since `|/\v|` is a
|
||||
pattern, too.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
"\.vimgolf"
|
||||
"^/tmp"
|
||||
"/project/.*/documentation"
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
fortune_use_unicode = helpers.defaultNullOpts.mkBool false ''
|
||||
By default, the fortune header uses ASCII characters, because they work for everyone.
|
||||
If you set this option to `true` and your 'encoding' is "utf-8", Unicode box-drawing characters
|
||||
will be used instead.
|
||||
|
||||
This is not the default, because users of East Asian languages often set 'ambiwidth' to "double"
|
||||
or make their terminal emulator treat characters of ambiguous width as double width.
|
||||
Both would make the drawn box look funny.
|
||||
|
||||
For more information: http://unicode.org/reports/tr11
|
||||
'';
|
||||
|
||||
padding_left = helpers.defaultNullOpts.mkUnsignedInt 3 ''
|
||||
The number of spaces used for left padding.
|
||||
'';
|
||||
|
||||
skiplist_server = helpers.defaultNullOpts.mkListOf (with helpers.nixvimTypes; maybeRaw str) [ ] ''
|
||||
Do not create the startify buffer, if this is a Vim server instance with a name contained in
|
||||
this list.
|
||||
|
||||
Example: `["GVIM"]`
|
||||
'';
|
||||
|
||||
enable_special = helpers.defaultNullOpts.mkBool true ''
|
||||
Show `<empty buffer>` and `<quit>`.
|
||||
'';
|
||||
|
||||
enable_unsafe = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable the option only in case you think Vim starts too slowly (because of `:Startify`) or if
|
||||
you often edit files on remote filesystems.
|
||||
|
||||
It's called unsafe because it improves the time `:Startify` needs to execute by reducing the
|
||||
amount of syscalls to the underlying operating system, but sacrifices the precision of shown
|
||||
entries.
|
||||
|
||||
This could lead to inconsistences in the shown `:Startify` entries (e.g. the same file could be
|
||||
shown twice, because one time file was opened via absolute path and another time via symlink).
|
||||
|
||||
Currently this option does this:
|
||||
- don't resolves symlinks (`readlink(2)`)
|
||||
- don't check every file if it's readable (`stat(2)`)
|
||||
- don't filter through the bookmark list
|
||||
'';
|
||||
|
||||
session_remove_lines = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Lines matching any of the patterns in this list, will be removed from the session file.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
["setlocal" "winheight"]
|
||||
```
|
||||
Internally this simply does:
|
||||
- `:global/setlocal/delete`
|
||||
- `:global/winheight/delete`
|
||||
|
||||
So you can use any `|pattern|`.
|
||||
|
||||
NOTE: Take care not to mess up any expressions within the session file, otherwise you'll
|
||||
probably get problems when trying to load it.
|
||||
'';
|
||||
|
||||
session_savevars = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Include a list of variables in here which you would like Startify to save into the session file
|
||||
in addition to what Vim normally saves into the session file.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
"g:startify_session_savevars"
|
||||
"g:startify_session_savecmds"
|
||||
"g:random_plugin_use_feature"
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
session_savecmds = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Include a list of cmdline commands which Vim will run upon loading the session.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
[
|
||||
"silent !pdfreader ~/latexproject/main.pdf &"
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
session_number = helpers.defaultNullOpts.mkUnsignedInt 999 ''
|
||||
The maximum number of sessions to display.
|
||||
Makes the most sense together with `session_sort`.
|
||||
'';
|
||||
|
||||
session_sort = helpers.defaultNullOpts.mkBool false ''
|
||||
Sort sessions by modification time (when the session files were written) rather than
|
||||
alphabetically.
|
||||
'';
|
||||
|
||||
custom_indices = helpers.defaultNullOpts.mkListOf' {
|
||||
type = types.str;
|
||||
pluginDefault = [ ];
|
||||
description = ''
|
||||
Use any list of strings as indices instead of increasing numbers. If there are more startify
|
||||
entries than actual items in the custom list, the remaining entries will be filled using the
|
||||
default numbering scheme starting from 0.
|
||||
|
||||
Thus you can create your own indexing scheme that fits your keyboard layout.
|
||||
You don't want to leave the home row, do you?!
|
||||
'';
|
||||
example = [
|
||||
"f"
|
||||
"g"
|
||||
"h"
|
||||
];
|
||||
};
|
||||
|
||||
custom_header = helpers.defaultNullOpts.mkListOf' {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Define your own header.
|
||||
|
||||
This option takes a `list of strings`, whereas each string will be put on its own line.
|
||||
If it is a simple `string`, it should evaluate to a list of strings.
|
||||
'';
|
||||
example = [
|
||||
""
|
||||
" ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||
" ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||
" ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||
" ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||
" ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||
" ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||
];
|
||||
};
|
||||
|
||||
custom_header_quotes = helpers.defaultNullOpts.mkListOf' {
|
||||
type = with types; listOf str;
|
||||
pluginDefault = [ ];
|
||||
description = ''
|
||||
If you don't set `custom_header`, the internal cowsay implementation with
|
||||
predefined random quotes will be used.
|
||||
|
||||
To use your own quotes, set this option to a list of quotes. Each quote is
|
||||
either another list or a `|Funcref|` (see `|expr-lambda|`) that returns a list.
|
||||
'';
|
||||
example = [
|
||||
[ "quote #1" ]
|
||||
[
|
||||
"quote #2"
|
||||
"using"
|
||||
"three lines"
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
custom_footer = helpers.defaultNullOpts.mkListOf' {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Same as the custom header, but shown at the bottom of the startify buffer.
|
||||
'';
|
||||
};
|
||||
|
||||
disable_at_vimenter = helpers.defaultNullOpts.mkBool false ''
|
||||
Don't run Startify at Vim startup.
|
||||
You can still call it anytime via `:Startify`.
|
||||
'';
|
||||
|
||||
relative_path = helpers.defaultNullOpts.mkBool false ''
|
||||
If the file is in or below the current working directory, use a relative path.
|
||||
Otherwise an absolute path is used.
|
||||
The latter prevents hard to grasp entries like `../../../../../foo`.
|
||||
|
||||
NOTE: This only applies to the "files" list, since the "dir" list is relative by nature.
|
||||
'';
|
||||
|
||||
use_env = helpers.defaultNullOpts.mkBool false ''
|
||||
Show environment variables in path, if their name is shorter than their value.
|
||||
See `|startify-colors|` for highlighting them.
|
||||
|
||||
`$PWD` and `$OLDPWD` are ignored.
|
||||
'';
|
||||
}
|
343
plugins/by-name/startup/default.nix
Normal file
343
plugins/by-name/startup/default.nix
Normal file
|
@ -0,0 +1,343 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.startup;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.startup = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "startup.nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "startup.nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"startup-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
theme = helpers.defaultNullOpts.mkStr "dashboard" ''
|
||||
Use a pre-defined theme.
|
||||
'';
|
||||
|
||||
sections =
|
||||
let
|
||||
sectionType =
|
||||
with types;
|
||||
submodule {
|
||||
options = {
|
||||
type =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"text"
|
||||
"mapping"
|
||||
"oldfiles"
|
||||
]
|
||||
''
|
||||
- "text" -> text that will be displayed
|
||||
- "mapping" -> create mappings for commands that can be used.
|
||||
use `mappings.executeCommand` on the commands to execute.
|
||||
- "oldfiles" -> display oldfiles (can be opened with `mappings.openFile`/`openFileSplit`)
|
||||
'';
|
||||
|
||||
oldfilesDirectory = helpers.defaultNullOpts.mkBool false ''
|
||||
if the oldfiles of the current directory should be displayed.
|
||||
'';
|
||||
|
||||
align =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"center"
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
''
|
||||
How to align the section.
|
||||
'';
|
||||
|
||||
foldSection = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to fold or not.
|
||||
'';
|
||||
|
||||
title = helpers.defaultNullOpts.mkStr "title" ''
|
||||
Title for the folded section.
|
||||
'';
|
||||
|
||||
margin =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) 5
|
||||
''
|
||||
The margin for left or right alignment.
|
||||
- if < 1 fraction of screen width
|
||||
- if > 1 numbers of column
|
||||
'';
|
||||
|
||||
content =
|
||||
helpers.mkNullOrOption
|
||||
(
|
||||
with types;
|
||||
oneOf [
|
||||
# for "text" "mapping"
|
||||
(listOf (either str (listOf str)))
|
||||
helpers.nixvimTypes.rawLua
|
||||
# for "oldfiles" sections
|
||||
(enum [ "" ])
|
||||
]
|
||||
)
|
||||
''
|
||||
The type of `content` depends on the section `type`:
|
||||
- "text" -> a list of strings or a function (`rawLua`) that requires a function that returns a table of strings
|
||||
- "mapping" -> a list of list of strings in the format:
|
||||
```nix
|
||||
[
|
||||
[<displayed_command_name> <command> <mapping>]
|
||||
[<displayed_command_name> <command> <mapping>]
|
||||
]
|
||||
```
|
||||
Example: `[" Find File" "Telescope find_files" "<leader>ff"]`
|
||||
- "oldfiles" -> `""`
|
||||
'';
|
||||
|
||||
highlight = helpers.mkNullOrOption types.str ''
|
||||
Highlight group in which the section text should be highlighted.
|
||||
'';
|
||||
|
||||
defaultColor = helpers.defaultNullOpts.mkStr "#FF0000" ''
|
||||
A hex color that gets used if you don't specify `highlight`.
|
||||
'';
|
||||
|
||||
oldfilesAmount = helpers.defaultNullOpts.mkUnsignedInt 5 ''
|
||||
The amount of oldfiles to be displayed.
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
mkOption {
|
||||
type = with types; attrsOf sectionType;
|
||||
default = { };
|
||||
description = '''';
|
||||
example = {
|
||||
header = {
|
||||
type = "text";
|
||||
align = "center";
|
||||
foldSection = false;
|
||||
title = "Header";
|
||||
margin = 5;
|
||||
content.__raw = "require('startup.headers').hydra_header";
|
||||
highlight = "Statement";
|
||||
defaultColor = "";
|
||||
oldfilesAmount = 0;
|
||||
};
|
||||
body = {
|
||||
type = "mapping";
|
||||
align = "center";
|
||||
foldSection = true;
|
||||
title = "Basic Commands";
|
||||
margin = 5;
|
||||
content = [
|
||||
[
|
||||
" Find File"
|
||||
"Telescope find_files"
|
||||
"<leader>ff"
|
||||
]
|
||||
[
|
||||
" Find Word"
|
||||
"Telescope live_grep"
|
||||
"<leader>lg"
|
||||
]
|
||||
[
|
||||
" Recent Files"
|
||||
"Telescope oldfiles"
|
||||
"<leader>of"
|
||||
]
|
||||
[
|
||||
" File Browser"
|
||||
"Telescope file_browser"
|
||||
"<leader>fb"
|
||||
]
|
||||
[
|
||||
" Colorschemes"
|
||||
"Telescope colorscheme"
|
||||
"<leader>cs"
|
||||
]
|
||||
[
|
||||
" New File"
|
||||
"lua require'startup'.new_file()"
|
||||
"<leader>nf"
|
||||
]
|
||||
];
|
||||
highlight = "String";
|
||||
defaultColor = "";
|
||||
oldfilesAmount = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
options = {
|
||||
mappingKeys = helpers.defaultNullOpts.mkBool true ''
|
||||
Display mapping (e.g. `<leader>ff`).
|
||||
'';
|
||||
|
||||
cursorColumn =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) 0.5
|
||||
''
|
||||
- if < 1, fraction of screen width
|
||||
- if > 1 numbers of column
|
||||
'';
|
||||
|
||||
after = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
A function that gets executed at the end.
|
||||
'';
|
||||
|
||||
emptyLinesBetweenMappings = helpers.defaultNullOpts.mkBool true ''
|
||||
Add an empty line between mapping/commands.
|
||||
'';
|
||||
|
||||
disableStatuslines = helpers.defaultNullOpts.mkBool true ''
|
||||
Disable status-, buffer- and tablines.
|
||||
'';
|
||||
|
||||
paddings = helpers.defaultNullOpts.mkListOf types.ints.unsigned [ ] ''
|
||||
Amount of empty lines before each section (must be equal to amount of sections).
|
||||
'';
|
||||
};
|
||||
|
||||
mappings = {
|
||||
executeCommand = helpers.defaultNullOpts.mkStr "<CR>" ''
|
||||
Keymapping to execute a command.
|
||||
'';
|
||||
|
||||
openFile = helpers.defaultNullOpts.mkStr "o" ''
|
||||
Keymapping to open a file.
|
||||
'';
|
||||
|
||||
openFileSplit = helpers.defaultNullOpts.mkStr "<c-o>" ''
|
||||
Keymapping to open a file in a split.
|
||||
'';
|
||||
|
||||
openSection = helpers.defaultNullOpts.mkStr "<TAB>" ''
|
||||
Keymapping to open a section.
|
||||
'';
|
||||
|
||||
openHelp = helpers.defaultNullOpts.mkStr "?" ''
|
||||
Keymapping to open help.
|
||||
'';
|
||||
};
|
||||
|
||||
colors = {
|
||||
background = helpers.defaultNullOpts.mkStr "#1f2227" ''
|
||||
The background color.
|
||||
'';
|
||||
|
||||
foldedSection = helpers.defaultNullOpts.mkStr "#56b6c2" ''
|
||||
The color of folded sections.
|
||||
This can also be changed with the `StartupFoldedSection` highlight group.
|
||||
'';
|
||||
};
|
||||
|
||||
parts = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = "List all sections in order.";
|
||||
example = [
|
||||
"section_1"
|
||||
"section_2"
|
||||
];
|
||||
};
|
||||
|
||||
userMappings = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
description = "Add your own mappings as key-command pairs.";
|
||||
default = { };
|
||||
example = {
|
||||
"<leader>ff" = "<cmd>Telescope find_files<CR>";
|
||||
"<leader>lg" = "<cmd>Telescope live_grep<CR>";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions =
|
||||
let
|
||||
sectionNames = attrNames cfg.sections;
|
||||
numSections = length sectionNames;
|
||||
in
|
||||
[
|
||||
{
|
||||
assertion = (cfg.options.paddings == null) || (length cfg.options.paddings) == numSections;
|
||||
message = ''
|
||||
Nixvim (plugins.startup): Make sure that `plugins.startup.options.paddings` has the same
|
||||
number of elements as there are sections.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
((length cfg.parts) <= numSections) && (all (part: hasAttr part cfg.sections) cfg.parts);
|
||||
message = ''
|
||||
Nixvim (plugins.startup): You should not have more section names in `plugins.startup.parts` than you have sections defined.
|
||||
'';
|
||||
}
|
||||
];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
sections = mapAttrs (
|
||||
name: sectionAttrs: with sectionAttrs; {
|
||||
inherit type;
|
||||
oldfiles_directory = oldfilesDirectory;
|
||||
inherit align;
|
||||
fold_section = foldSection;
|
||||
inherit
|
||||
title
|
||||
margin
|
||||
content
|
||||
highlight
|
||||
;
|
||||
default_color = defaultColor;
|
||||
oldfiles_amount = oldfilesAmount;
|
||||
}
|
||||
) cfg.sections;
|
||||
|
||||
options =
|
||||
with cfg.options;
|
||||
{
|
||||
mapping_keys = mappingKeys;
|
||||
cursor_column = cursorColumn;
|
||||
inherit after;
|
||||
empty_lines_between_mappings = emptyLinesBetweenMappings;
|
||||
disable_statuslines = disableStatuslines;
|
||||
inherit paddings;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
|
||||
setupOptions = {
|
||||
inherit (cfg) theme;
|
||||
inherit options;
|
||||
mappings = with cfg.mappings; {
|
||||
execute_command = executeCommand;
|
||||
open_file = openFile;
|
||||
open_file_split = openFileSplit;
|
||||
open_section = openSection;
|
||||
open_help = openHelp;
|
||||
};
|
||||
colors = with cfg.colors; {
|
||||
inherit background;
|
||||
folded_section = foldedSection;
|
||||
};
|
||||
inherit (cfg) parts;
|
||||
} // sections;
|
||||
in
|
||||
''
|
||||
require('startup').setup(${helpers.toLuaObject setupOptions})
|
||||
''
|
||||
+ (optionalString (
|
||||
cfg.userMappings != { }
|
||||
) "require('startup').create_mappings(${helpers.toLuaObject cfg.userMappings})");
|
||||
};
|
||||
}
|
12
plugins/by-name/surround/default.nix
Normal file
12
plugins/by-name/surround/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "surround";
|
||||
originalName = "surround.vim";
|
||||
package = "vim-surround";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
}
|
192
plugins/by-name/tmux-navigator/default.nix
Normal file
192
plugins/by-name/tmux-navigator/default.nix
Normal file
|
@ -0,0 +1,192 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "tmux-navigator";
|
||||
originalName = "vim-tmux-navigator";
|
||||
package = "vim-tmux-navigator";
|
||||
globalPrefix = "tmux_navigator_";
|
||||
|
||||
maintainers = [ maintainers.MattSturgeon ];
|
||||
|
||||
description = ''
|
||||
When combined with a set of tmux key bindings, the plugin will allow you to navigate seamlessly between vim splits and tmux panes using a consistent set of hotkeys.
|
||||
|
||||
**WARNING:** to work correctly, you must configure tmux separately.
|
||||
|
||||
## Usage
|
||||
|
||||
This plugin provides the following mappings which allow you to move between vim splits and tmux panes seamlessly.
|
||||
|
||||
- `<ctrl-h>` => Left
|
||||
- `<ctrl-j>` => Down
|
||||
- `<ctrl-k>` => Up
|
||||
- `<ctrl-l>` => Right
|
||||
- `<ctrl-\>` => Previous split
|
||||
|
||||
To use alternative key mappings, see [`plugins.tmux-navigator.settings.no_mappings`][no_mappings].
|
||||
|
||||
## Configure tmux
|
||||
|
||||
There are two main ways to configure tmux. Either install the `tmuxPlugins.vim-tmux-navigator` plugin or add a snippet to your tmux config:
|
||||
|
||||
```shell
|
||||
# Smart pane switching with awareness of vim splits.
|
||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
|
||||
|
||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
||||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
||||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
||||
|
||||
# Forwarding <C-\\> needs different syntax, depending on tmux version
|
||||
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||||
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||||
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||||
|
||||
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
||||
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
||||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||
```
|
||||
|
||||
See the [upstream docs] for more info.
|
||||
|
||||
[no_mappings]: ./settings.html#pluginstmux-navigatorsettingsno_mappings
|
||||
[upstream docs]: https://github.com/christoomey/vim-tmux-navigator#installation
|
||||
'';
|
||||
|
||||
settingsOptions = {
|
||||
save_on_switch =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
1
|
||||
2
|
||||
])
|
||||
''
|
||||
You can configure the plugin to write the current buffer, or all buffers, when navigating from vim to tmux.
|
||||
|
||||
null: don't save on switch (default value)
|
||||
1: `:update` (write the current buffer, but only if changed)
|
||||
2: `:wall` (write all buffers)
|
||||
'';
|
||||
|
||||
disable_when_zoomed = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
By default, if you zoom the tmux pane running vim and then attempt to navigate "past" the edge of the vim session, tmux will unzoom the pane.
|
||||
This is the default tmux behavior, but may be confusing if you've become accustomed to navigation "wrapping" around the sides due to this plugin.
|
||||
|
||||
This option disables the unzooming behavior, keeping all navigation within vim until the tmux pane is explicitly unzoomed.
|
||||
'';
|
||||
|
||||
preserve_zoom = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
As noted in `disable_when_zoomed`, navigating from a vim pane to another tmux pane normally causes the window to be unzoomed.
|
||||
Some users may prefer the behavior of tmux's `-Z` option to `select-pane`, which keeps the window zoomed if it was zoomed.
|
||||
|
||||
This option enables that behavior.
|
||||
|
||||
Naturally, if `disable_when_zoomed` is enabled, this option will have no effect.
|
||||
'';
|
||||
|
||||
no_wrap = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
By default, if you try to move past the edge of the screen, tmux/vim will "wrap" around to the opposite side.
|
||||
|
||||
This option disables "wrapping" in vim, but tmux will need to be configured separately.
|
||||
|
||||
Tmux doesn't have a "no_wrap" option, so whatever key bindings you have need to conditionally wrap based on position on screen:
|
||||
|
||||
```shell
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
|
||||
|
||||
bind-key -n 'C-h' if-shell "$is_vim" { send-keys C-h } { if-shell -F '#{pane_at_left}' {} { select-pane -L } }
|
||||
bind-key -n 'C-j' if-shell "$is_vim" { send-keys C-j } { if-shell -F '#{pane_at_bottom}' {} { select-pane -D } }
|
||||
bind-key -n 'C-k' if-shell "$is_vim" { send-keys C-k } { if-shell -F '#{pane_at_top}' {} { select-pane -U } }
|
||||
bind-key -n 'C-l' if-shell "$is_vim" { send-keys C-l } { if-shell -F '#{pane_at_right}' {} { select-pane -R } }
|
||||
|
||||
bind-key -T copy-mode-vi 'C-h' if-shell -F '#{pane_at_left}' {} { select-pane -L }
|
||||
bind-key -T copy-mode-vi 'C-j' if-shell -F '#{pane_at_bottom}' {} { select-pane -D }
|
||||
bind-key -T copy-mode-vi 'C-k' if-shell -F '#{pane_at_top}' {} { select-pane -U }
|
||||
bind-key -T copy-mode-vi 'C-l' if-shell -F '#{pane_at_right}' {} { select-pane -R }
|
||||
```
|
||||
'';
|
||||
|
||||
no_mappings = helpers.defaultNullOpts.mkFlagInt 0 ''
|
||||
By default `<C-h>`, `<C-j>`, `<C-k>`, `<C-l>`, & `<C-\\>`
|
||||
are mapped to navigating left, down, up, right, & previous, respectively.
|
||||
|
||||
This option disables those default mappings being created.
|
||||
|
||||
You can use `plugins.tmux-navigator.keymaps` to define your own custom mappings.
|
||||
You will also need to **update your tmux bindings** separately,
|
||||
if you want them to match.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
keymaps = mkOption {
|
||||
description = ''
|
||||
Keymaps for the `:TmuxNavigate*` commands.
|
||||
|
||||
Note: by default, tmux-navigator adds its own keymaps.
|
||||
If you wish to disable that behaviour, use `settings.no_mappings`.
|
||||
|
||||
You will also need to **update your tmux bindings** separately,
|
||||
if you want them to match.
|
||||
'';
|
||||
example = [
|
||||
{
|
||||
key = "<C-w>h";
|
||||
action = "left";
|
||||
}
|
||||
{
|
||||
key = "<C-w>j";
|
||||
action = "down";
|
||||
}
|
||||
{
|
||||
key = "<C-w>k";
|
||||
action = "up";
|
||||
}
|
||||
{
|
||||
key = "<C-w>l";
|
||||
action = "right";
|
||||
}
|
||||
{
|
||||
key = "<C-w>\\";
|
||||
action = "previous";
|
||||
}
|
||||
];
|
||||
default = [ ];
|
||||
type = types.listOf (
|
||||
helpers.keymaps.mkMapOptionSubmodule {
|
||||
action = {
|
||||
description = "The direction in which to navigate.";
|
||||
type = types.enum [
|
||||
"left"
|
||||
"down"
|
||||
"up"
|
||||
"right"
|
||||
"previous"
|
||||
];
|
||||
example = "left";
|
||||
};
|
||||
lua = true;
|
||||
}
|
||||
);
|
||||
apply = map helpers.keymaps.removeDeprecatedMapAttrs;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
keymaps = map (
|
||||
mapping: mapping // { action = "<cmd>TmuxNavigate${helpers.upperFirstChar mapping.action}<cr>"; }
|
||||
) cfg.keymaps;
|
||||
};
|
||||
}
|
449
plugins/by-name/todo-comments/default.nix
Normal file
449
plugins/by-name/todo-comments/default.nix
Normal file
|
@ -0,0 +1,449 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.nixvim)
|
||||
defaultNullOpts
|
||||
keymaps
|
||||
mkNullOrOption'
|
||||
transitionType
|
||||
;
|
||||
types = lib.nixvim.nixvimTypes;
|
||||
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "todo-comments";
|
||||
originalName = "todo-comments.nvim";
|
||||
package = "todo-comments-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
# TODO: Added 2023-11-06, remove after 24.11
|
||||
imports = [
|
||||
(mkRemovedOptionModule [
|
||||
"plugins"
|
||||
"todo-comments"
|
||||
"keymapsSilent"
|
||||
] "Use `plugins.todo-comments.keymaps.<COMMAND>.options.silent`.")
|
||||
];
|
||||
|
||||
# TODO: Added 2024-08-16, remove after 24.11
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"signs"
|
||||
"signPriority"
|
||||
"keywords"
|
||||
[
|
||||
"guiStyle"
|
||||
"bg"
|
||||
]
|
||||
[
|
||||
"guiStyle"
|
||||
"fg"
|
||||
]
|
||||
"mergeKeywords"
|
||||
[
|
||||
"highlight"
|
||||
"multiline"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"multilinePattern"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"multilineContext"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"before"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"keyword"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"after"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"pattern"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"commentsOnly"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"maxLineLen"
|
||||
]
|
||||
[
|
||||
"highlight"
|
||||
"exclude"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"error"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"warning"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"info"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"hint"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"default"
|
||||
]
|
||||
[
|
||||
"colors"
|
||||
"test"
|
||||
]
|
||||
[
|
||||
"search"
|
||||
"command"
|
||||
]
|
||||
[
|
||||
"search"
|
||||
"args"
|
||||
]
|
||||
[
|
||||
"search"
|
||||
"pattern"
|
||||
]
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
signs = defaultNullOpts.mkBool true "Show icons in the signs column.";
|
||||
|
||||
sign_priority = defaultNullOpts.mkInt 8 "Sign priority.";
|
||||
|
||||
keywords =
|
||||
defaultNullOpts.mkAttrsOf
|
||||
(
|
||||
with types;
|
||||
submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = {
|
||||
icon = defaultNullOpts.mkStr null ''
|
||||
Icon used for the sign, and in search results.
|
||||
'';
|
||||
|
||||
color = defaultNullOpts.mkStr null ''
|
||||
Can be a hex color, or a named color.
|
||||
'';
|
||||
|
||||
alt = defaultNullOpts.mkListOf types.str null ''
|
||||
A set of other keywords that all map to this FIX keywords.
|
||||
'';
|
||||
|
||||
signs = defaultNullOpts.mkBool null ''
|
||||
Configure signs for some keywords individually.
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
{
|
||||
FIX = {
|
||||
icon = " ";
|
||||
color = "error";
|
||||
alt = [
|
||||
"FIXME"
|
||||
"BUG"
|
||||
"FIXIT"
|
||||
"ISSUE"
|
||||
];
|
||||
};
|
||||
TODO = {
|
||||
icon = " ";
|
||||
color = "info";
|
||||
};
|
||||
HACK = {
|
||||
icon = " ";
|
||||
color = "warning";
|
||||
};
|
||||
WARN = {
|
||||
icon = " ";
|
||||
color = "warning";
|
||||
alt = [
|
||||
"WARNING"
|
||||
"XXX"
|
||||
];
|
||||
};
|
||||
PERF = {
|
||||
icon = " ";
|
||||
alt = [
|
||||
"OPTIM"
|
||||
"PERFORMANCE"
|
||||
"OPTIMIZE"
|
||||
];
|
||||
};
|
||||
NOTE = {
|
||||
icon = " ";
|
||||
color = "hint";
|
||||
alt = [ "INFO" ];
|
||||
};
|
||||
TEST = {
|
||||
icon = "⏲ ";
|
||||
color = "test";
|
||||
alt = [
|
||||
"TESTING"
|
||||
"PASSED"
|
||||
"FAILED"
|
||||
];
|
||||
};
|
||||
}
|
||||
''
|
||||
Configurations for keywords to be recognized as todo comments.
|
||||
'';
|
||||
|
||||
gui_style = {
|
||||
fg = defaultNullOpts.mkStr "NONE" ''
|
||||
The gui style to use for the fg highlight group.
|
||||
'';
|
||||
|
||||
bg = defaultNullOpts.mkStr "BOLD" ''
|
||||
The gui style to use for the bg highlight group.
|
||||
'';
|
||||
};
|
||||
|
||||
merge_keywords = defaultNullOpts.mkBool true ''
|
||||
When true, custom keywords will be merged with the default.
|
||||
'';
|
||||
|
||||
highlight = {
|
||||
multiline = defaultNullOpts.mkBool true ''
|
||||
Enable multiline todo comments.
|
||||
'';
|
||||
|
||||
multiline_pattern = defaultNullOpts.mkStr "^." ''
|
||||
Lua pattern to match the next multiline from the start of the
|
||||
matched keyword.
|
||||
'';
|
||||
|
||||
multiline_context = defaultNullOpts.mkInt 10 ''
|
||||
Extra lines that will be re-evaluated when changing a line.
|
||||
'';
|
||||
|
||||
before =
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
""
|
||||
"fg"
|
||||
"bg"
|
||||
]
|
||||
''
|
||||
Whether to apply the before highlight to the foreground or background.
|
||||
'';
|
||||
|
||||
keyword =
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"wide"
|
||||
"fg"
|
||||
"bg"
|
||||
"wide_bg"
|
||||
"wide_fg"
|
||||
""
|
||||
]
|
||||
''
|
||||
How highlighting is applied to the keyword.
|
||||
|
||||
`wide` and `wide_bg` are the same as `bg`, but will also highlight
|
||||
surrounding characters, `wide_fg` acts accordingly but with `fg`.
|
||||
'';
|
||||
|
||||
after =
|
||||
defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"fg"
|
||||
"bg"
|
||||
""
|
||||
]
|
||||
''
|
||||
Whether to apply the after highlight to the foreground or background.
|
||||
'';
|
||||
|
||||
pattern = defaultNullOpts.mkNullable' {
|
||||
type = with types; either str (listOf str);
|
||||
pluginDefault = ".*<(KEYWORDS)\\s*:";
|
||||
description = ''
|
||||
Pattern or list of patterns, used for highlighting (vim regex).
|
||||
'';
|
||||
};
|
||||
|
||||
comments_only = defaultNullOpts.mkBool true ''
|
||||
Uses treesitter to match keywords in comments only.
|
||||
'';
|
||||
|
||||
max_line_len = defaultNullOpts.mkInt 400 ''
|
||||
Ignore lines longer than this.
|
||||
'';
|
||||
|
||||
exclude = defaultNullOpts.mkListOf types.str [ ] ''
|
||||
List of file types to exclude highlighting.
|
||||
'';
|
||||
};
|
||||
|
||||
colors =
|
||||
defaultNullOpts.mkAttrsOf (types.listOf types.str)
|
||||
{
|
||||
error = [
|
||||
"DiagnosticError"
|
||||
"ErrorMsg"
|
||||
"#DC2626"
|
||||
];
|
||||
warning = [
|
||||
"DiagnosticWarn"
|
||||
"WarningMsg"
|
||||
"#FBBF24"
|
||||
];
|
||||
info = [
|
||||
"DiagnosticInfo"
|
||||
"#2563EB"
|
||||
];
|
||||
hint = [
|
||||
"DiagnosticHint"
|
||||
"#10B981"
|
||||
];
|
||||
default = [
|
||||
"Identifier"
|
||||
"#7C3AED"
|
||||
];
|
||||
test = [
|
||||
"Identifier"
|
||||
"#FF00FF"
|
||||
];
|
||||
}
|
||||
''
|
||||
List of named colors where we try to extract the guifg from the list
|
||||
of highlight groups or use the hex color if hl not found as a fallback.
|
||||
'';
|
||||
|
||||
search = {
|
||||
command = defaultNullOpts.mkStr "rg" "Command to use for searching for keywords.";
|
||||
|
||||
args =
|
||||
defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"--color=never"
|
||||
"--no-heading"
|
||||
"--with-filename"
|
||||
"--line-number"
|
||||
"--column"
|
||||
]
|
||||
''
|
||||
Arguments to use for the search command in list form.
|
||||
'';
|
||||
|
||||
pattern = defaultNullOpts.mkStr "\\b(KEYWORDS):" ''
|
||||
Regex that will be used to match keywords.
|
||||
Don't replace the (KEYWORDS) placeholder.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
highlight = {
|
||||
pattern = [
|
||||
".*<(KEYWORDS)\s*:"
|
||||
".*<(KEYWORDS)\s*"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
keymaps =
|
||||
mapAttrs
|
||||
(
|
||||
optionName: action:
|
||||
mkNullOrOption' {
|
||||
type = keymaps.mkMapOptionSubmodule {
|
||||
defaults = {
|
||||
inherit action;
|
||||
mode = "n";
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
cwd = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "Specify the directory to search for comments";
|
||||
default = null;
|
||||
example = "~/projects/foobar";
|
||||
};
|
||||
|
||||
keywords = mkOption {
|
||||
type = with types; transitionType str (splitString ",") (nullOr (listOf str));
|
||||
description = ''
|
||||
Comma separated list of keywords to filter results by.
|
||||
Keywords are case-sensitive.
|
||||
'';
|
||||
default = null;
|
||||
example = "TODO,FIX";
|
||||
};
|
||||
};
|
||||
};
|
||||
description = "Keymap for function ${action}";
|
||||
}
|
||||
)
|
||||
{
|
||||
todoQuickFix = "TodoQuickFix";
|
||||
todoLocList = "TodoLocList";
|
||||
todoTrouble = "TodoTrouble";
|
||||
todoTelescope = "TodoTelescope";
|
||||
};
|
||||
|
||||
ripgrepPackage = lib.mkPackageOption pkgs "ripgrep" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.keymaps.todoTelescope.key or null != null -> config.plugins.telescope.enable;
|
||||
message = ''
|
||||
Nixvim(plugins.todo-comments): You have enabled todo-comment's `telescope` integration.
|
||||
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = cfg.keymaps.todoTrouble.key or null != null -> config.plugins.trouble.enable;
|
||||
message = ''
|
||||
Nixvim(plugins.todo-comments): You have enabled todo-comment's `trouble` integration.
|
||||
However, you have not enabled the `trouble` plugin itself (`plugins.trouble.enable = true`).
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraPackages = [ cfg.ripgrepPackage ];
|
||||
|
||||
keymaps = lib.pipe cfg.keymaps [
|
||||
(filterAttrs (n: keymap: keymap != null))
|
||||
(mapAttrsToList (
|
||||
name: keymap: {
|
||||
inherit (keymap) key mode options;
|
||||
action =
|
||||
let
|
||||
cwd = optionalString (keymap.cwd != null) " cwd=${keymap.cwd}";
|
||||
keywords = optionalString (
|
||||
keymap.keywords != null && keymap.keywords != [ ]
|
||||
) " keywords=${concatStringsSep "," keymap.keywords}";
|
||||
in
|
||||
"<cmd>${keymap.action}${cwd}${keywords}<cr>";
|
||||
}
|
||||
))
|
||||
];
|
||||
};
|
||||
}
|
290
plugins/by-name/toggleterm/default.nix
Normal file
290
plugins/by-name/toggleterm/default.nix
Normal file
|
@ -0,0 +1,290 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "toggleterm";
|
||||
originalName = "toggleterm.nvim";
|
||||
package = "toggleterm-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO: introduced 2024-04-07, remove on 2024-06-07
|
||||
deprecateExtraOptions = true;
|
||||
optionsRenamedToSettings = [
|
||||
"size"
|
||||
"onCreate"
|
||||
"onOpen"
|
||||
"onClose"
|
||||
"onStdout"
|
||||
"onStderr"
|
||||
"onExit"
|
||||
"hideNumbers"
|
||||
"shadeFiletypes"
|
||||
"autochdir"
|
||||
"highlights"
|
||||
"shadeTerminals"
|
||||
"shadingFactor"
|
||||
"startInInsert"
|
||||
"insertMappings"
|
||||
"terminalMappings"
|
||||
"persistSize"
|
||||
"persistMode"
|
||||
"direction"
|
||||
"closeOnExit"
|
||||
"shell"
|
||||
"autoScroll"
|
||||
[
|
||||
"floatOpts"
|
||||
"border"
|
||||
]
|
||||
[
|
||||
"floatOpts"
|
||||
"width"
|
||||
]
|
||||
[
|
||||
"floatOpts"
|
||||
"height"
|
||||
]
|
||||
[
|
||||
"floatOpts"
|
||||
"winblend"
|
||||
]
|
||||
[
|
||||
"floatOpts"
|
||||
"zindex"
|
||||
]
|
||||
[
|
||||
"winbar"
|
||||
"enabled"
|
||||
]
|
||||
[
|
||||
"winbar"
|
||||
"nameFormatter"
|
||||
]
|
||||
];
|
||||
imports = [
|
||||
(mkRemovedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"toggleterm"
|
||||
"openMapping"
|
||||
]
|
||||
''
|
||||
Please use `plugins.toggleterm.settings.open_mapping` instead but beware, you have to provide the value in this form: `"[[<c-\>]]"`.
|
||||
''
|
||||
)
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
size = helpers.defaultNullOpts.mkStrLuaFnOr types.number 12 ''
|
||||
Size of the terminal.
|
||||
`size` can be a number or a function.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
size = 20
|
||||
```
|
||||
OR
|
||||
|
||||
```nix
|
||||
size = \'\'
|
||||
function(term)
|
||||
if term.direction == "horizontal" then
|
||||
return 15
|
||||
elseif term.direction == "vertical" then
|
||||
return vim.o.columns * 0.4
|
||||
end
|
||||
end
|
||||
\'\';
|
||||
```
|
||||
'';
|
||||
|
||||
open_mapping = helpers.mkNullOrLua ''
|
||||
Setting the `open_mapping` key to use for toggling the terminal(s) will set up mappings for
|
||||
normal mode.
|
||||
'';
|
||||
|
||||
on_create = helpers.mkNullOrLuaFn ''
|
||||
Function to run when the terminal is first created.
|
||||
|
||||
`fun(t: Terminal)`
|
||||
'';
|
||||
|
||||
on_open = helpers.mkNullOrLuaFn ''
|
||||
Function to run when the terminal opens.
|
||||
|
||||
`fun(t: Terminal)`
|
||||
'';
|
||||
|
||||
on_close = helpers.mkNullOrLuaFn ''
|
||||
Function to run when the terminal closes.
|
||||
|
||||
`fun(t: Terminal)`
|
||||
'';
|
||||
|
||||
on_stdout = helpers.mkNullOrLuaFn ''
|
||||
Callback for processing output on stdout.
|
||||
|
||||
`fun(t: Terminal, job: number, data: string[], name: string)`
|
||||
'';
|
||||
|
||||
on_stderr = helpers.mkNullOrLuaFn ''
|
||||
Callback for processing output on stderr.
|
||||
|
||||
`fun(t: Terminal, job: number, data: string[], name: string)`
|
||||
'';
|
||||
|
||||
on_exit = helpers.mkNullOrLuaFn ''
|
||||
Function to run when terminal process exits.
|
||||
|
||||
`fun(t: Terminal, job: number, exit_code: number, name: string)`
|
||||
'';
|
||||
|
||||
hide_numbers = helpers.defaultNullOpts.mkBool true ''
|
||||
Hide the number column in toggleterm buffers.
|
||||
'';
|
||||
|
||||
shade_filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Shade filetypes.
|
||||
'';
|
||||
|
||||
autochdir = helpers.defaultNullOpts.mkBool false ''
|
||||
When neovim changes it current directory the terminal will change it's own when next it's
|
||||
opened.
|
||||
'';
|
||||
|
||||
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight {
|
||||
NormalFloat.link = "Normal";
|
||||
FloatBorder.link = "Normal";
|
||||
StatusLine.gui = "NONE";
|
||||
StatusLineNC = {
|
||||
cterm = "italic";
|
||||
gui = "NONE";
|
||||
};
|
||||
} "Highlights which map a highlight group name to an attrs of it's values.";
|
||||
|
||||
shade_terminals = helpers.defaultNullOpts.mkBool true ''
|
||||
NOTE: This option takes priority over highlights specified so if you specify Normal
|
||||
highlights you should set this to `false`.
|
||||
'';
|
||||
|
||||
shading_factor = helpers.mkNullOrOption types.int ''
|
||||
The percentage by which to lighten terminal background.
|
||||
|
||||
default: -30 (gets multiplied by -3 if background is light).
|
||||
'';
|
||||
|
||||
start_in_insert = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to start toggleterm in insert mode.
|
||||
'';
|
||||
|
||||
insert_mappings = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether or not the open mapping applies in insert mode.
|
||||
'';
|
||||
|
||||
terminal_mappings = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether or not the open mapping applies in the opened terminals.
|
||||
'';
|
||||
|
||||
persist_size = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the terminal size should persist.
|
||||
'';
|
||||
|
||||
persist_mode = helpers.defaultNullOpts.mkBool true ''
|
||||
If set to true (default) the previous terminal mode will be remembered.
|
||||
'';
|
||||
|
||||
direction = helpers.defaultNullOpts.mkEnum [
|
||||
"vertical"
|
||||
"horizontal"
|
||||
"tab"
|
||||
"float"
|
||||
] "horizontal" "The direction the terminal should be opened in.";
|
||||
|
||||
close_on_exit = helpers.defaultNullOpts.mkBool true ''
|
||||
Close the terminal window when the process exits.
|
||||
'';
|
||||
|
||||
shell = helpers.defaultNullOpts.mkStr { __raw = "vim.o.shell"; } ''
|
||||
Change the default shell.
|
||||
'';
|
||||
|
||||
auto_scroll = helpers.defaultNullOpts.mkBool true ''
|
||||
Automatically scroll to the bottom on terminal output.
|
||||
'';
|
||||
|
||||
float_opts = {
|
||||
border = helpers.mkNullOrOption helpers.nixvimTypes.border ''
|
||||
`border` = "single" | "double" | "shadow" | "curved" | ... other options supported by
|
||||
`win open`.
|
||||
The border key is *almost* the same as 'nvim_open_win'.
|
||||
The 'curved' border is a custom border type not natively supported but implemented in this plugin.
|
||||
'';
|
||||
|
||||
width = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
|
||||
Width of the floating terminal. Like `size`, `width` can be a number or
|
||||
function which is passed the current terminal.
|
||||
'';
|
||||
|
||||
height = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
|
||||
Height of the floating terminal. Like `size`, `height` can be a number
|
||||
or function which is passed the current terminal.
|
||||
'';
|
||||
|
||||
row = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
|
||||
Start row of the floating terminal. Defaults to the center of the
|
||||
screen. Like `size`, `row` can be a number or function which is passed
|
||||
the current terminal.
|
||||
'';
|
||||
|
||||
col = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
|
||||
Start column of the floating terminal. Defaults to the center of the
|
||||
screen. Like `size`, `col` can be a number or function which is passed
|
||||
the current terminal.
|
||||
'';
|
||||
|
||||
winblend = helpers.defaultNullOpts.mkUnsignedInt 0 "";
|
||||
|
||||
zindex = helpers.mkNullOrOption types.ints.unsigned "";
|
||||
|
||||
title_pos = helpers.defaultNullOpts.mkStr "left" "";
|
||||
};
|
||||
|
||||
winbar = {
|
||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to enable winbar.
|
||||
'';
|
||||
|
||||
name_formatter =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(term)
|
||||
return term.name
|
||||
end
|
||||
''
|
||||
''
|
||||
`func(term: Terminal):string`
|
||||
|
||||
Example:
|
||||
```lua
|
||||
function(term)
|
||||
return fmt("%d:%s", term.id, term:_display_name())
|
||||
end
|
||||
```
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
open_mapping = "[[<c-\>]]";
|
||||
direction = "float";
|
||||
float_opts = {
|
||||
border = "curved";
|
||||
width = 130;
|
||||
height = 30;
|
||||
};
|
||||
};
|
||||
}
|
66
plugins/by-name/trim/default.nix
Normal file
66
plugins/by-name/trim/default.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin {
|
||||
name = "trim";
|
||||
originalName = "trim.nvim";
|
||||
package = "trim-nvim";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
settingsOptions = {
|
||||
ft_blocklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
|
||||
Filetypes to exclude.
|
||||
'';
|
||||
|
||||
patterns = mkOption {
|
||||
type = with helpers.nixvimTypes; listOf strLua;
|
||||
apply = map helpers.mkRaw;
|
||||
default = [ ];
|
||||
example = [ "[[%s/\(\n\n\)\n\+/\1/]]" ];
|
||||
description = ''
|
||||
Extra patterns to use for removing white spaces.
|
||||
|
||||
Plugin default: `[]`
|
||||
'';
|
||||
};
|
||||
|
||||
trim_on_write = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to automatically trim on write.
|
||||
'';
|
||||
|
||||
trim_trailing = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to trim trailing whitespaces.
|
||||
'';
|
||||
|
||||
trim_last_line = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to trim trailing blank lines at the end of the file.
|
||||
'';
|
||||
|
||||
trim_first_line = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to trim blank lines at the beginning of the file.
|
||||
'';
|
||||
|
||||
highlight = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to highlight trailing whitespaces.
|
||||
'';
|
||||
|
||||
highlight_bg = helpers.defaultNullOpts.mkStr "#ff0000" ''
|
||||
Which color to use for coloring whitespaces.
|
||||
'';
|
||||
|
||||
highlight_ctermbg = helpers.defaultNullOpts.mkStr "red" ''
|
||||
Which color to use for coloring whitespaces (cterm).
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
ft_blocklist = [ "markdown" ];
|
||||
patterns = [ "[[%s/\(\n\n\)\n\+/\1/]]" ];
|
||||
trim_on_write = false;
|
||||
highlight = true;
|
||||
};
|
||||
}
|
74
plugins/by-name/undotree/default.nix
Normal file
74
plugins/by-name/undotree/default.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
mkVimPlugin {
|
||||
name = "undotree";
|
||||
globalPrefix = "undotree_";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-22: remove 2024-04-22
|
||||
deprecateExtraConfig = true;
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"undotree"
|
||||
];
|
||||
in
|
||||
mapAttrsToList
|
||||
(
|
||||
old: new:
|
||||
mkRenamedOptionModule (basePluginPath ++ [ old ]) (
|
||||
basePluginPath
|
||||
++ [
|
||||
"settings"
|
||||
new
|
||||
]
|
||||
)
|
||||
)
|
||||
{
|
||||
windowLayout = "WindowLayout";
|
||||
shortIndicators = "ShortIndicators";
|
||||
windowWidth = "WindowWidth";
|
||||
diffHeight = "DiffHeight";
|
||||
autoOpenDiff = "AutoOpenDiff";
|
||||
focusOnToggle = "FocusOnToggle";
|
||||
treeNodeShape = "TreeNodeShape";
|
||||
diffCommand = "DiffCommand";
|
||||
relativeTimestamp = "RelativeTimestamp";
|
||||
highlightChangedText = "HighlightChangedText";
|
||||
highlightChangesWithSign = "HighlightChangesWithSign";
|
||||
highlightSyntaxAdd = "HighlightSyntaxAdd";
|
||||
highlightSyntaxChange = "HighlightSyntaxChange";
|
||||
highlightSyntaxDel = "HighlightSyntaxDel";
|
||||
showHelpLine = "ShowHelpLine";
|
||||
showCursorLine = "ShowCursorLine";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
WindowLayout = 4;
|
||||
ShortIndicators = false;
|
||||
DiffpanelHeight = 10;
|
||||
DiffAutoOpen = true;
|
||||
SetFocusWhenToggle = true;
|
||||
SplitWidth = 40;
|
||||
TreeNodeShape = "*";
|
||||
TreeVertShape = "|";
|
||||
TreeSplitShape = "/";
|
||||
TreeReturnShape = "\\";
|
||||
DiffCommand = "diff";
|
||||
RelativeTimestamp = true;
|
||||
HighlightChangedText = true;
|
||||
HighlightChangedWithSign = true;
|
||||
HighlightSyntaxAdd = "DiffAdd";
|
||||
HighlightSyntaxChange = "DiffChange";
|
||||
HighlightSyntaxDel = "DiffDelete";
|
||||
HelpLine = true;
|
||||
CursorLine = true;
|
||||
};
|
||||
}
|
61
plugins/by-name/vim-bbye/default.nix
Normal file
61
plugins/by-name/vim-bbye/default.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.vim-bbye;
|
||||
in
|
||||
{
|
||||
options.plugins.vim-bbye = {
|
||||
enable = mkEnableOption "vim-bbye";
|
||||
|
||||
package = lib.mkPackageOption pkgs "vim-bbye" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"vim-bbye"
|
||||
];
|
||||
};
|
||||
|
||||
keymapsSilent = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether vim-bbye keymaps should be silent.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
keymaps = {
|
||||
bdelete = helpers.mkNullOrOption types.str ''
|
||||
Keymap for deleting the current buffer.";
|
||||
'';
|
||||
|
||||
bwipeout = helpers.mkNullOrOption types.str ''
|
||||
Keymap for completely deleting the current buffer.";
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
keymaps =
|
||||
with cfg.keymaps;
|
||||
helpers.keymaps.mkKeymaps
|
||||
{
|
||||
mode = "n";
|
||||
options.silent = cfg.keymapsSilent;
|
||||
}
|
||||
(
|
||||
(optional (bdelete != null) {
|
||||
key = bdelete;
|
||||
action = ":Bdelete<CR>";
|
||||
})
|
||||
++ (optional (bwipeout != null) {
|
||||
key = bwipeout;
|
||||
action = ":Bwipeout<CR>";
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
8
plugins/by-name/vim-css-color/default.nix
Normal file
8
plugins/by-name/vim-css-color/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "vim-css-color";
|
||||
maintainers = [ helpers.maintainers.DanielLaing ];
|
||||
}
|
218
plugins/by-name/vim-matchup/default.nix
Normal file
218
plugins/by-name/vim-matchup/default.nix
Normal file
|
@ -0,0 +1,218 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.plugins.vim-matchup = {
|
||||
enable = mkEnableOption "vim-matchup";
|
||||
|
||||
package = lib.mkPackageOption pkgs "vim-matchup" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"vim-matchup"
|
||||
];
|
||||
};
|
||||
|
||||
treesitterIntegration = {
|
||||
enable = mkEnableOption "treesitter integration";
|
||||
disable =
|
||||
helpers.defaultNullOpts.mkListOf types.str [ ]
|
||||
"Languages for each to disable this module";
|
||||
|
||||
disableVirtualText = helpers.defaultNullOpts.mkBool false ''
|
||||
Do not use virtual text to highlight the virtual end of a block, for languages without
|
||||
explicit end markers (e.g., Python).
|
||||
'';
|
||||
includeMatchWords = helpers.defaultNullOpts.mkBool false ''
|
||||
Additionally include traditional vim regex matches for symbols. For example, highlights
|
||||
`/* */` comments in C++ which are not supported in tree-sitter matching
|
||||
'';
|
||||
};
|
||||
|
||||
matchParen = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Control matching parentheses";
|
||||
|
||||
fallback = helpers.defaultNullOpts.mkBool true ''
|
||||
If matchParen is not enabled fallback to the standard vim matchparen.
|
||||
'';
|
||||
|
||||
singleton = helpers.defaultNullOpts.mkBool false "Whether to highlight known words even if there is no match";
|
||||
|
||||
offscreen = helpers.defaultNullOpts.mkNullable (types.submodule {
|
||||
options = {
|
||||
method =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"status"
|
||||
"popup"
|
||||
"status_manual"
|
||||
]
|
||||
''
|
||||
'status': Replace the status-line for off-screen matches.
|
||||
|
||||
If a match is off of the screen, the line belonging to that match will be displayed
|
||||
syntax-highlighted in the status line along with the line number (if line numbers
|
||||
are enabled). If the match is above the screen border, an additional Δ symbol will
|
||||
be shown to indicate that the matching line is really above the cursor line.
|
||||
|
||||
'popup': Show off-screen matches in a popup (vim) or floating (neovim) window.
|
||||
|
||||
'status_manual': Compute the string which would be displayed in the status-line or
|
||||
popup, but do not display it. The function MatchupStatusOffscreen() can be used to
|
||||
get the text.
|
||||
'';
|
||||
scrolloff = helpers.defaultNullOpts.mkBool false ''
|
||||
When enabled, off-screen matches will not be shown in the statusline while the
|
||||
cursor is at the screen edge (respects the value of 'scrolloff').
|
||||
This is intended to prevent flickering while scrolling with j and k.
|
||||
'';
|
||||
};
|
||||
}) { method = "status"; } "Dictionary controlling the behavior with off-screen matches.";
|
||||
|
||||
stopline = helpers.defaultNullOpts.mkInt 400 ''
|
||||
The number of lines to search in either direction while highlighting matches.
|
||||
Set this conservatively since high values may cause performance issues.
|
||||
'';
|
||||
|
||||
timeout =
|
||||
helpers.defaultNullOpts.mkInt 300
|
||||
"Adjust timeouts in milliseconds for matchparen highlighting";
|
||||
|
||||
insertTimeout =
|
||||
helpers.defaultNullOpts.mkInt 60
|
||||
"Adjust timeouts in milliseconds for matchparen highlighting";
|
||||
|
||||
deferred = {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Deferred highlighting improves cursor movement performance (for example, when using hjkl)
|
||||
by delaying highlighting for a short time and waiting to see if the cursor continues
|
||||
moving
|
||||
'';
|
||||
|
||||
showDelay = helpers.defaultNullOpts.mkInt 50 ''
|
||||
Adjust delays in milliseconds for deferred highlighting
|
||||
'';
|
||||
|
||||
hideDelay = helpers.defaultNullOpts.mkInt 700 ''
|
||||
Adjust delays in milliseconds for deferred highlighting
|
||||
'';
|
||||
};
|
||||
|
||||
hiSurroundAlways = helpers.defaultNullOpts.mkBool false ''
|
||||
Highlight surrounding delimiters always as the cursor moves
|
||||
Note: this feature requires deferred highlighting to be supported and enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
motion = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Control motions";
|
||||
overrideNPercent = helpers.defaultNullOpts.mkInt 6 ''
|
||||
In vim, {count}% goes to the {count} percentage in the file. match-up overrides this
|
||||
motion for small {count} (by default, anything less than 7). To allow {count}% for {count}
|
||||
less than 12 set overrideNPercent to 11.
|
||||
|
||||
To disable this feature set it to 0.
|
||||
|
||||
To always enable this feature, use any value greater than 99
|
||||
'';
|
||||
cursorEnd = helpers.defaultNullOpts.mkBool true ''
|
||||
If enabled, cursor will land on the end of mid and close words while moving downwards
|
||||
(%/]%). While moving upwards (g%, [%) the cursor will land on the beginning.
|
||||
'';
|
||||
};
|
||||
|
||||
textObj = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Controls text objects";
|
||||
|
||||
linewiseOperators = helpers.defaultNullOpts.mkListOf types.str [
|
||||
"d"
|
||||
"y"
|
||||
] "Modify the set of operators which may operate line-wise";
|
||||
};
|
||||
|
||||
enableSurround = helpers.defaultNullOpts.mkBool false "To enable the delete surrounding (ds%) and change surrounding (cs%) maps";
|
||||
|
||||
enableTransmute = helpers.defaultNullOpts.mkBool false "To enable the experimental transmute module";
|
||||
|
||||
delimStopline = helpers.defaultNullOpts.mkInt 1500 ''
|
||||
To configure the number of lines to search in either direction while using motions and text
|
||||
objects. Does not apply to match highlighting (see matchParenStopline instead)
|
||||
'';
|
||||
|
||||
delimNoSkips =
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
0
|
||||
1
|
||||
2
|
||||
]
|
||||
''
|
||||
To disable matching within strings and comments:
|
||||
- 0: matching is enabled within strings and comments
|
||||
- 1: recognize symbols within comments
|
||||
- 2: don't recognize anything in comments
|
||||
'';
|
||||
};
|
||||
|
||||
# TODO introduced 2024-03-07: remove 2024-05-07
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"vim-matchup"
|
||||
"matchParen"
|
||||
"deffered"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"vim-matchup"
|
||||
"matchParen"
|
||||
"deferred"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.plugins.vim-matchup;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.treesitter.settings.matchup = mkIf cfg.treesitterIntegration.enable {
|
||||
inherit (cfg.treesitterIntegration) enable disable;
|
||||
disable_virtual_text = cfg.treesitterIntegration.disableVirtualText;
|
||||
include_match_words = cfg.treesitterIntegration.includeMatchWords;
|
||||
};
|
||||
|
||||
globals = {
|
||||
matchup_surround_enabled = cfg.enableSurround;
|
||||
matchup_transmute_enabled = cfg.enableTransmute;
|
||||
|
||||
matchup_delim_stopline = cfg.delimStopline;
|
||||
matchup_delim_noskips = cfg.delimNoSkips;
|
||||
|
||||
matchup_matchparen_enabled = cfg.matchParen.enable;
|
||||
matchup_matchparen_fallback = cfg.matchParen.fallback;
|
||||
matchup_matchparen_offscreen = cfg.matchParen.offscreen;
|
||||
matchup_matchparen_stopline = cfg.matchParen.stopline;
|
||||
matchup_matchparen_timeout = cfg.matchParen.timeout;
|
||||
matchup_matchparen_insert_timeout = cfg.matchParen.insertTimeout;
|
||||
matchup_matchparen_deferred = cfg.matchParen.deferred.enable;
|
||||
matchup_matchparen_deferred_show_delay = cfg.matchParen.deferred.showDelay;
|
||||
matchup_matchparen_deferred_hide_delay = cfg.matchParen.deferred.hideDelay;
|
||||
matchup_matchparen_hi_surround_always = cfg.matchParen.hiSurroundAlways;
|
||||
|
||||
matchup_motion_enabled = cfg.motion.enable;
|
||||
matchup_motion_override_Npercent = cfg.motion.overrideNPercent;
|
||||
matchup_motion_cursor_end = cfg.motion.cursorEnd;
|
||||
|
||||
matchup_text_obj_enabled = cfg.textObj.enable;
|
||||
matchup_text_obj_linewise_operators = cfg.textObj.linewiseOperators;
|
||||
};
|
||||
};
|
||||
}
|
13
plugins/by-name/wakatime/default.nix
Normal file
13
plugins/by-name/wakatime/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.vim-plugin.mkVimPlugin {
|
||||
name = "wakatime";
|
||||
originalName = "vim-wakatime";
|
||||
package = "vim-wakatime";
|
||||
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
}
|
17
plugins/by-name/web-devicons/default.nix
Normal file
17
plugins/by-name/web-devicons/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "web-devicons";
|
||||
originalName = "nvim-web-devicons";
|
||||
luaName = "nvim-web-devicons";
|
||||
package = "nvim-web-devicons";
|
||||
|
||||
maintainers = [ lib.maintainers.refaelsh ];
|
||||
|
||||
settingsExample = {
|
||||
color_icons = true;
|
||||
strict = true;
|
||||
};
|
||||
}
|
603
plugins/by-name/which-key/default.nix
Normal file
603
plugins/by-name/which-key/default.nix
Normal file
|
@ -0,0 +1,603 @@
|
|||
{
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.nixvim) defaultNullOpts mkRaw toLuaObject;
|
||||
types = lib.nixvim.nixvimTypes;
|
||||
|
||||
opt = options.plugins.which-key;
|
||||
|
||||
specExamples = [
|
||||
# Basic group with custom icon
|
||||
{
|
||||
__unkeyed-1 = "<leader>b";
|
||||
group = "Buffers";
|
||||
icon = " ";
|
||||
}
|
||||
# Non-default mode
|
||||
{
|
||||
__unkeyed = "<leader>c";
|
||||
mode = "v";
|
||||
group = "Codesnap";
|
||||
icon = " ";
|
||||
}
|
||||
# Group within group
|
||||
{
|
||||
__unkeyed-1 = "<leader>bs";
|
||||
group = "Sort";
|
||||
icon = " ";
|
||||
}
|
||||
# Nested mappings for inheritance
|
||||
{
|
||||
mode = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
__unkeyed-1 = [
|
||||
{
|
||||
__unkeyed-1 = "<leader>f";
|
||||
group = "Normal Visual Group";
|
||||
}
|
||||
{
|
||||
__unkeyed-1 = "<leader>f<tab>";
|
||||
group = "Normal Visual Group in Group";
|
||||
}
|
||||
];
|
||||
}
|
||||
# Proxy mapping
|
||||
{
|
||||
__unkeyed-1 = "<leader>w";
|
||||
proxy = "<C-w>";
|
||||
group = "windows";
|
||||
}
|
||||
# Create mapping
|
||||
{
|
||||
__unkeyed-1 = "<leader>cS";
|
||||
__unkeyed-2 = "<cmd>CodeSnapSave<CR>";
|
||||
mode = "v";
|
||||
desc = "Save";
|
||||
}
|
||||
# Function mapping
|
||||
{
|
||||
__unkeyed-1 = "<leader>db";
|
||||
__unkeyed-2.__raw = ''
|
||||
function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end
|
||||
'';
|
||||
mode = "n";
|
||||
desc = "Breakpoint toggle";
|
||||
silent = true;
|
||||
}
|
||||
];
|
||||
|
||||
in
|
||||
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||
name = "which-key";
|
||||
originalName = "which-key.nvim";
|
||||
package = "which-key-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
# TODO: introduced 2024-08-05: remove after 24.11
|
||||
optionsRenamedToSettings = [
|
||||
"hidden"
|
||||
"icons"
|
||||
"ignoreMissing"
|
||||
"keyLabels"
|
||||
"layout"
|
||||
"motions"
|
||||
"operators"
|
||||
[
|
||||
"plugins"
|
||||
"mark"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"registers"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"spelling"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"presets"
|
||||
"textObjects"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"presets"
|
||||
"operators"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"presets"
|
||||
"motions"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"presets"
|
||||
"windows"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"presets"
|
||||
"nav"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"presets"
|
||||
"z"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"presets"
|
||||
"g"
|
||||
]
|
||||
"popupMappings"
|
||||
"showHelp"
|
||||
"showKeys"
|
||||
"triggersBlackList"
|
||||
"triggersNoWait"
|
||||
];
|
||||
|
||||
imports =
|
||||
let
|
||||
basePluginPath = [
|
||||
"plugins"
|
||||
"which-key"
|
||||
];
|
||||
settingsPath = basePluginPath ++ [ "settings" ];
|
||||
in
|
||||
[
|
||||
(lib.mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"disable"
|
||||
"buftypes"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"disable"
|
||||
"bt"
|
||||
]
|
||||
)
|
||||
)
|
||||
(lib.mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"disable"
|
||||
"filetypes"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"disable"
|
||||
"ft"
|
||||
]
|
||||
)
|
||||
)
|
||||
(lib.mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"window"
|
||||
"winblend"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"win"
|
||||
"wo"
|
||||
"winblend"
|
||||
]
|
||||
)
|
||||
)
|
||||
(lib.mkRenamedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"window"
|
||||
"border"
|
||||
]
|
||||
)
|
||||
(
|
||||
settingsPath
|
||||
++ [
|
||||
"win"
|
||||
"border"
|
||||
]
|
||||
)
|
||||
)
|
||||
(lib.mkRemovedOptionModule (basePluginPath ++ [ "triggers" ]) ''
|
||||
Please use `plugins.which-key.settings.triggers` instead.
|
||||
|
||||
See the plugin documentation for more details about the new option signature:
|
||||
https://github.com/folke/which-key.nvim#-triggers
|
||||
'')
|
||||
(lib.mkRemovedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"window"
|
||||
"padding"
|
||||
]
|
||||
)
|
||||
''
|
||||
Please use `plugins.which-key.settings.win.padding` instead.
|
||||
|
||||
See the plugin documentation for more details about the new option:
|
||||
https://github.com/folke/which-key.nvim#%EF%B8%8F-configuration
|
||||
''
|
||||
)
|
||||
(lib.mkRemovedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"window"
|
||||
"margin"
|
||||
]
|
||||
)
|
||||
''
|
||||
Please use `plugins.which-key.settings.layout` instead.
|
||||
|
||||
See the plugin documentation for more details about the new options:
|
||||
https://github.com/folke/which-key.nvim#%EF%B8%8F-configuration
|
||||
''
|
||||
)
|
||||
(lib.mkRemovedOptionModule
|
||||
(
|
||||
basePluginPath
|
||||
++ [
|
||||
"window"
|
||||
"position"
|
||||
]
|
||||
)
|
||||
''
|
||||
Please use `plugins.which-key.settings.layout`, `plugins.which-key.settings.win.title_pos`, or `plugins.which-key.settings.win.footer_pos` instead.
|
||||
|
||||
See the plugin documentation for more details about the new options:
|
||||
https://github.com/folke/which-key.nvim#%EF%B8%8F-configuration
|
||||
''
|
||||
)
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
preset = defaultNullOpts.mkEnumFirstDefault [
|
||||
"classic"
|
||||
"modern"
|
||||
"helix"
|
||||
false
|
||||
] "Preset style for WhichKey. Set to false to disable.";
|
||||
|
||||
delay = defaultNullOpts.mkInt' {
|
||||
pluginDefault.__raw = ''
|
||||
function(ctx)
|
||||
return ctx.plugin and 0 or 200
|
||||
end
|
||||
'';
|
||||
description = "Delay before showing the popup. Can be a number or a function that returns a number.";
|
||||
};
|
||||
|
||||
filter = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault.__raw = ''
|
||||
function(mapping)
|
||||
return true
|
||||
end
|
||||
'';
|
||||
description = "Filter used to exclude mappings";
|
||||
};
|
||||
|
||||
spec = defaultNullOpts.mkListOf' {
|
||||
type = with types; attrsOf anything;
|
||||
pluginDefault = [ ];
|
||||
description = ''
|
||||
WhichKey automatically gets the descriptions of your keymaps from the desc attribute of the keymap.
|
||||
So for most use-cases, you don't need to do anything else.
|
||||
|
||||
However, the mapping spec is still useful to configure group descriptions and mappings that don't really exist as a regular keymap.
|
||||
|
||||
Please refer to the plugin's [documentation](https://github.com/folke/which-key.nvim?tab=readme-ov-file#%EF%B8%8F-mappings).
|
||||
'';
|
||||
example = specExamples;
|
||||
};
|
||||
|
||||
notify = defaultNullOpts.mkBool true "Show a warning when issues were detected with your mappings.";
|
||||
|
||||
triggers = defaultNullOpts.mkListOf (with types; attrsOf anything) [
|
||||
{
|
||||
__unkeyed-1 = "<auto>";
|
||||
mode = "nxsot";
|
||||
}
|
||||
] "Manually setup triggers";
|
||||
|
||||
defer = defaultNullOpts.mkLuaFn' {
|
||||
pluginDefault.__raw = ''
|
||||
function(ctx)
|
||||
return ctx.mode == "V" or ctx.mode == "<C-V>
|
||||
end'';
|
||||
description = ''
|
||||
Start hidden and wait for a key to be pressed before showing the popup.
|
||||
|
||||
Only used by enabled xo mapping modes.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins = {
|
||||
marks = defaultNullOpts.mkBool true ''
|
||||
Shows a list of your marks on `'` and `` ` ``.
|
||||
'';
|
||||
|
||||
registers = defaultNullOpts.mkBool true ''
|
||||
Shows your registers on `"` in NORMAL or `<C-r>` in INSERT mode.
|
||||
'';
|
||||
|
||||
spelling = {
|
||||
enabled = defaultNullOpts.mkBool true ''
|
||||
Enabling this will show WhichKey when pressing `z=` to select spelling suggestions.
|
||||
'';
|
||||
suggestions = defaultNullOpts.mkInt 20 ''
|
||||
How many suggestions should be shown in the list?
|
||||
'';
|
||||
};
|
||||
|
||||
presets = {
|
||||
operators = defaultNullOpts.mkBool true "Adds help for operators like `d`, `y`, ...";
|
||||
motions = defaultNullOpts.mkBool true "Adds help for motions.";
|
||||
text_objects = defaultNullOpts.mkBool true "Help for text objects triggered after entering an operator.";
|
||||
windows = defaultNullOpts.mkBool true "Default bindings on `<c-w>`.";
|
||||
nav = defaultNullOpts.mkBool true "Misc bindings to work with windows.";
|
||||
z = defaultNullOpts.mkBool true "Show WhichKey for folds, spelling and other bindings prefixed with `z`.";
|
||||
g = defaultNullOpts.mkBool true "Show WhichKey for bindings prefixed with `g`.";
|
||||
};
|
||||
};
|
||||
|
||||
win = {
|
||||
no_overlap = defaultNullOpts.mkBool true "Don't allow the popup to overlap with the cursor.";
|
||||
|
||||
border = defaultNullOpts.mkBorder "none" "which-key" ''
|
||||
Allows configuring the border of which-key.
|
||||
|
||||
Supports all available border types from `vim.api.keyset.win_config.border`.
|
||||
'';
|
||||
|
||||
padding = defaultNullOpts.mkNullable (types.listOfLen types.int 2) [
|
||||
1
|
||||
2
|
||||
] "Extra window padding, in the form `[top/bottom, right/left]`.";
|
||||
|
||||
title = defaultNullOpts.mkBool true "Whether to show the title.";
|
||||
|
||||
title_pos = defaultNullOpts.mkStr "center" "Position of the title.";
|
||||
|
||||
zindex = defaultNullOpts.mkUnsignedInt 1000 "Layer depth on the popup window.";
|
||||
|
||||
wo = {
|
||||
winblend = defaultNullOpts.mkNullableWithRaw (types.ints.between 0
|
||||
100
|
||||
) 0 "`0` for fully opaque and `100` for fully transparent.";
|
||||
};
|
||||
};
|
||||
|
||||
layout = {
|
||||
width = {
|
||||
min = defaultNullOpts.mkInt 20 "Minimum width.";
|
||||
max = defaultNullOpts.mkInt null "Maximum width.";
|
||||
};
|
||||
|
||||
spacing = defaultNullOpts.mkInt 3 "Spacing between columns.";
|
||||
};
|
||||
|
||||
keys = {
|
||||
scroll_up = defaultNullOpts.mkStr "<c-u>" "Binding to scroll up in the popup.";
|
||||
scroll_down = defaultNullOpts.mkStr "<c-d>" "Binding to scroll down in the popup.";
|
||||
};
|
||||
|
||||
sort =
|
||||
defaultNullOpts.mkListOf
|
||||
(types.enum [
|
||||
"local"
|
||||
"order"
|
||||
"group"
|
||||
"alphanum"
|
||||
"mod"
|
||||
"manual"
|
||||
"case"
|
||||
])
|
||||
[
|
||||
"local"
|
||||
"order"
|
||||
"group"
|
||||
"alphanum"
|
||||
"mod"
|
||||
]
|
||||
"Mappings are sorted using configured sorters and natural sort of the keys.";
|
||||
|
||||
expand = defaultNullOpts.mkInt 0 "Expand groups when <= n mappings.";
|
||||
|
||||
replace = {
|
||||
key = defaultNullOpts.mkListOf (types.either types.strLuaFn (with types; listOf str)) (mkRaw ''
|
||||
function(key)
|
||||
return require("which-key.view").format(key)
|
||||
end
|
||||
'') "Lua functions or list of strings to replace key left side key name with.";
|
||||
desc = defaultNullOpts.mkListOf (with types; listOf str) [
|
||||
[
|
||||
"<Plug>%(?(.*)%)?"
|
||||
"%1"
|
||||
]
|
||||
[
|
||||
"^%+"
|
||||
""
|
||||
]
|
||||
[
|
||||
"<[cC]md>"
|
||||
""
|
||||
]
|
||||
[
|
||||
"<[cC][rR]>"
|
||||
""
|
||||
]
|
||||
[
|
||||
"<[sS]ilent>"
|
||||
""
|
||||
]
|
||||
[
|
||||
"^lua%s+"
|
||||
""
|
||||
]
|
||||
[
|
||||
"^call%s+"
|
||||
""
|
||||
]
|
||||
[
|
||||
"^:%s*"
|
||||
""
|
||||
]
|
||||
] "Lua patterns to replace right side description references with.";
|
||||
};
|
||||
|
||||
icons = {
|
||||
breadcrumb = defaultNullOpts.mkStr "»" "Symbol used in the command line area that shows your active key combo.";
|
||||
separator = defaultNullOpts.mkStr "➜" "Symbol used between a key and its label.";
|
||||
group = defaultNullOpts.mkStr "+" "Symbol prepended to a group.";
|
||||
ellipsis = defaultNullOpts.mkStr "…" "Symbol used for overflow.";
|
||||
mappings = defaultNullOpts.mkBool true "Set to false to disable all mapping icons.";
|
||||
rules = defaultNullOpts.mkNullable (
|
||||
with types; either (listOf attrs) bool
|
||||
) [ ] "Icon rules. Set to false to disable all icons.";
|
||||
colors = defaultNullOpts.mkBool true ''
|
||||
Use the highlights from mini.icons.
|
||||
|
||||
When `false`, it will use `WhichKeyIcon` instead.
|
||||
'';
|
||||
|
||||
keys = defaultNullOpts.mkNullable types.attrs {
|
||||
Up = " ";
|
||||
Down = " ";
|
||||
Left = " ";
|
||||
Right = " ";
|
||||
C = " ";
|
||||
M = " ";
|
||||
D = " ";
|
||||
S = " ";
|
||||
CR = " ";
|
||||
Esc = " ";
|
||||
ScrollWheelDown = " ";
|
||||
ScrollWheelUp = " ";
|
||||
NL = " ";
|
||||
BS = "";
|
||||
Space = " ";
|
||||
Tab = " ";
|
||||
F1 = "";
|
||||
F2 = "";
|
||||
F3 = "";
|
||||
F4 = "";
|
||||
F5 = "";
|
||||
F6 = "";
|
||||
F7 = "";
|
||||
F8 = "";
|
||||
F9 = "";
|
||||
F10 = "";
|
||||
F11 = "";
|
||||
F12 = "";
|
||||
} "Icons used by key format.";
|
||||
};
|
||||
|
||||
show_help = defaultNullOpts.mkBool true "Show a help message in the command line for using WhichKey.";
|
||||
|
||||
show_keys = defaultNullOpts.mkBool true "Show the currently pressed key and its label as a message in the command line.";
|
||||
|
||||
disable = {
|
||||
bt = defaultNullOpts.mkListOf types.str [ ] "Buftypes to disable WhichKey.";
|
||||
ft = defaultNullOpts.mkListOf types.str [ ] "Filetypes to disable WhichKey.";
|
||||
};
|
||||
|
||||
debug = defaultNullOpts.mkBool false "Enable `wk.log` in the current directory.";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
preset = false;
|
||||
|
||||
delay = 200;
|
||||
|
||||
spec = specExamples;
|
||||
|
||||
replace = {
|
||||
desc = [
|
||||
[
|
||||
"<space>"
|
||||
"SPACE"
|
||||
]
|
||||
[
|
||||
"<leader>"
|
||||
"SPACE"
|
||||
]
|
||||
[
|
||||
"<[cC][rR]>"
|
||||
"RETURN"
|
||||
]
|
||||
[
|
||||
"<[tT][aA][bB]>"
|
||||
"TAB"
|
||||
]
|
||||
[
|
||||
"<[bB][sS]>"
|
||||
"BACKSPACE"
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
notify = false;
|
||||
|
||||
win = {
|
||||
border = "single";
|
||||
};
|
||||
|
||||
expand = 1;
|
||||
};
|
||||
|
||||
# TODO: introduced 2024-07-29: remove after 24.11
|
||||
extraOptions = {
|
||||
registrations = mkOption {
|
||||
type = with types; attrsOf anything;
|
||||
description = ''
|
||||
This option is deprecated, use `settings.spec` instead.
|
||||
|
||||
Note: the keymap format has changed in v3 of which-key.
|
||||
'';
|
||||
visible = false;
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: introduced 2024-07-29: remove after 24.11
|
||||
# NOTE: this may be upgraded to a mkRemoveOptionModule when which-key removes support
|
||||
extraConfig =
|
||||
cfg:
|
||||
lib.mkIf opt.registrations.isDefined {
|
||||
warnings = [
|
||||
''
|
||||
nixvim (plugins.which-key):
|
||||
The option definition `plugins.which-key.registrations' in ${showFiles opt.registrations.files} has been deprecated in which-key v3; please remove it.
|
||||
You should use `plugins.which-key.settings.spec' instead.
|
||||
|
||||
Note: the spec format has changed in which-key v3
|
||||
See: https://github.com/folke/which-key.nvim?tab=readme-ov-file#%EF%B8%8F-mappings
|
||||
''
|
||||
];
|
||||
|
||||
extraConfigLua = lib.optionalString opt.registrations.isDefined ''
|
||||
require("which-key").register(${toLuaObject cfg.registrations})
|
||||
'';
|
||||
};
|
||||
}
|
271
plugins/by-name/wilder/default.nix
Normal file
271
plugins/by-name/wilder/default.nix
Normal file
|
@ -0,0 +1,271 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.wilder;
|
||||
|
||||
mkKeyOption =
|
||||
default: desc:
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either str (submodule {
|
||||
options = {
|
||||
key = mkOption {
|
||||
type = str;
|
||||
description = desc;
|
||||
};
|
||||
|
||||
fallback = mkOption {
|
||||
type = either str (enum [ false ]);
|
||||
description = ''
|
||||
For a no-op, set <fallback> to "".
|
||||
|
||||
The fallback mappings can be disabled by setting `fallback` to 0.
|
||||
|
||||
Disabling the fallback mapping allows a `|<Cmd>|` mapping to be used which improves
|
||||
rendering performance slightly as the mappings to be called outside the sandbox
|
||||
(see `|:map-expression|`).
|
||||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
)
|
||||
default
|
||||
''
|
||||
${desc}
|
||||
|
||||
NOTE:
|
||||
A string or an attrs (with keys `key` and `fallback`) representing the mapping to bind to
|
||||
`|wilder#next()|`.
|
||||
If a string is provided, it is automatically converted to `{key = <KEY>; fallback = <KEY>;}`.
|
||||
|
||||
- `mapping` is the `|cmap|` used to bind to `|wilder#next()|`.
|
||||
- `fallback` is the mapping used if `|wilder#in_context()|` is false.
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"wilder-nvim"
|
||||
]
|
||||
[
|
||||
"plugins"
|
||||
"wilder"
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
options.plugins.wilder = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "wilder-nvim";
|
||||
|
||||
package = lib.mkPackageOption pkgs "wilder-nvim" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"wilder-nvim"
|
||||
];
|
||||
};
|
||||
|
||||
### Setup options ###
|
||||
enableCmdlineEnter = helpers.defaultNullOpts.mkBool true ''
|
||||
If true calls `wilder#enable_cmdline_enter()`.
|
||||
Creates a new `|CmdlineEnter|` autocmd to which will start wilder when the cmdline is
|
||||
entered.
|
||||
'';
|
||||
|
||||
modes =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(types.enum [
|
||||
"/"
|
||||
"?"
|
||||
":"
|
||||
])
|
||||
[
|
||||
"/"
|
||||
"?"
|
||||
]
|
||||
"List of modes that wilder will be active in.";
|
||||
|
||||
wildcharm =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (enum [ false ])) "&wildchar"
|
||||
''
|
||||
Key to set the 'wildcharm' option to.
|
||||
Can be set to v:false to skip the setting.
|
||||
'';
|
||||
|
||||
nextKey = mkKeyOption "<Tab>" ''
|
||||
A key to map to `wilder#next()` providing next suggestion.
|
||||
'';
|
||||
|
||||
prevKey = mkKeyOption "<S-Tab>" ''
|
||||
A key to map to `wilder#prev()` providing previous suggestion.
|
||||
'';
|
||||
|
||||
acceptKey = mkKeyOption "<Down>" ''
|
||||
Mapping to bind to `wilder#accept_completion()`.
|
||||
'';
|
||||
|
||||
rejectKey = mkKeyOption "<Up>" ''
|
||||
Mapping to bind to `wilder#reject_completion()`.
|
||||
'';
|
||||
|
||||
acceptCompletionAutoSelect = helpers.defaultNullOpts.mkBool true ''
|
||||
The `auto_select` option passed to `wilder#accept_completion()`, if mapped.
|
||||
'';
|
||||
|
||||
### Other options ###
|
||||
useCmdlinechanged = helpers.mkNullOrOption types.bool ''
|
||||
If true, wilder will refresh queries when the `|CmdlineChanged|` autocommand is triggered.
|
||||
Otherwise it will use a `|timer|` to check whether the cmdline has changed.
|
||||
Using a timer will be more resource intensive.
|
||||
|
||||
Default: `exists('##CmdlineChanged')`
|
||||
'';
|
||||
|
||||
interval = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
Interval of the `|timer|` used to check whether the cmdline has changed, in milliseconds.
|
||||
Only applicable if `useCmdlinechanged` is false.
|
||||
'';
|
||||
|
||||
beforeCursor = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, wilder will look only at the part of the cmdline before the cursor, and when
|
||||
selecting a completion, the entire cmdline will be replaced.
|
||||
Only applicable if `useCmdlinechanged` is false.
|
||||
'';
|
||||
|
||||
usePythonRemotePlugin = helpers.mkNullOrOption types.bool ''
|
||||
If true, uses the Python remote plugin.
|
||||
This option can be set to false to disable the Python remote plugin.
|
||||
|
||||
This option has to be set before setting the `pipeline` option and before wilder is first
|
||||
run.
|
||||
|
||||
Default: `has('python3') && (has('nvim') || exists('*yarp#py3'))`
|
||||
'';
|
||||
|
||||
numWorkers = helpers.defaultNullOpts.mkUnsignedInt 2 ''
|
||||
Number of workers for the Python 3 `|remote-plugin|`.
|
||||
Has to be set at startup, before wilder is first run.
|
||||
Setting the option after the first run has no effect.
|
||||
'';
|
||||
|
||||
pipeline = helpers.mkNullOrOption (with helpers.nixvimTypes; listOf strLua) ''
|
||||
Sets the pipeline to use to get completions.
|
||||
See `|wilder-pipeline|`.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
[
|
||||
\'\'
|
||||
wilder.branch(
|
||||
wilder.cmdline_pipeline({
|
||||
language = 'python',
|
||||
fuzzy = 1,
|
||||
}),
|
||||
wilder.python_search_pipeline({
|
||||
pattern = wilder.python_fuzzy_pattern(),
|
||||
sorter = wilder.python_difflib_sorter(),
|
||||
engine = 're',
|
||||
})
|
||||
)
|
||||
\'\'
|
||||
]
|
||||
```
|
||||
'';
|
||||
|
||||
renderer = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
Sets the renderer to used to display the completions.
|
||||
See `|wilder-renderer|`.
|
||||
|
||||
Example:
|
||||
```lua
|
||||
\'\'
|
||||
wilder.wildmenu_renderer({
|
||||
-- highlighter applies highlighting to the candidates
|
||||
highlighter = wilder.basic_highlighter(),
|
||||
})
|
||||
\'\'
|
||||
```
|
||||
'';
|
||||
|
||||
preHook = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
A function which takes a `ctx`.
|
||||
This function is called when wilder starts, or when wilder becomes unhidden.
|
||||
See `|wilder-hidden|`.
|
||||
|
||||
`ctx` contains no keys.
|
||||
'';
|
||||
|
||||
postHook = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
||||
A function which takes a `ctx`.
|
||||
This function is called when wilder stops, or when wilder becomes hidden.
|
||||
See `|wilder-hidden|`.
|
||||
|
||||
`ctx` contains no keys.
|
||||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
let
|
||||
processKeyOpt =
|
||||
key:
|
||||
helpers.ifNonNull' key (
|
||||
if isString key then
|
||||
key
|
||||
else
|
||||
[
|
||||
key.key
|
||||
key.fallback
|
||||
]
|
||||
);
|
||||
in
|
||||
{
|
||||
enable_cmdline_enter = enableCmdlineEnter;
|
||||
inherit modes;
|
||||
inherit wildcharm;
|
||||
next_key = processKeyOpt nextKey;
|
||||
previous_key = processKeyOpt prevKey;
|
||||
accept_key = processKeyOpt acceptKey;
|
||||
reject_key = processKeyOpt rejectKey;
|
||||
accept_completion_auto_select = acceptCompletionAutoSelect;
|
||||
};
|
||||
|
||||
options =
|
||||
with cfg;
|
||||
{
|
||||
use_cmdlinechanged = useCmdlinechanged;
|
||||
inherit interval;
|
||||
before_cursor = beforeCursor;
|
||||
use_python_remote_plugin = usePythonRemotePlugin;
|
||||
num_workers = numWorkers;
|
||||
pipeline = helpers.ifNonNull' pipeline (map helpers.mkRaw pipeline);
|
||||
inherit renderer;
|
||||
pre_hook = preHook;
|
||||
post_hook = postHook;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
wilder = require("wilder")
|
||||
wilder.setup(${helpers.toLuaObject setupOptions})
|
||||
|
||||
local __wilderOptions = ${helpers.toLuaObject options}
|
||||
for key, value in pairs(__wilderOptions) do
|
||||
wilder.set_option(key, value)
|
||||
end
|
||||
'';
|
||||
};
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue