mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-12 08:25:30 +00:00
Merge branch 'main' into rust-missing-lsp-opts
This commit is contained in:
commit
6f8ed6f10e
42 changed files with 1421 additions and 527 deletions
|
|
@ -2,7 +2,7 @@
|
|||
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||
inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
|
||||
|
|
@ -37,12 +37,6 @@ in {
|
|||
description = "Default list of sources to enable for completion.";
|
||||
};
|
||||
|
||||
cmdline = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = [];
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
|
||||
providers = mkOption {
|
||||
type = attrsOf providerType;
|
||||
default = {};
|
||||
|
|
@ -63,6 +57,14 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
cmdline = {
|
||||
sources = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = [];
|
||||
description = "List of sources to enable for cmdline. Null means use default source list.";
|
||||
};
|
||||
};
|
||||
|
||||
completion = {
|
||||
documentation = {
|
||||
auto_show = mkBool true "Show documentation whenever an item is selected";
|
||||
|
|
@ -116,5 +118,66 @@ in {
|
|||
scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" "<C-d>";
|
||||
scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" "<C-f>";
|
||||
};
|
||||
|
||||
sourcePlugins = let
|
||||
sourcePluginType = submodule {
|
||||
options = {
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
description = ''
|
||||
`blink-cmp` source plugin package.
|
||||
'';
|
||||
};
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.<name>.module`.
|
||||
|
||||
Should be present in the source's documentation.
|
||||
'';
|
||||
};
|
||||
enable = mkEnableOption "this source";
|
||||
};
|
||||
};
|
||||
in
|
||||
mkOption {
|
||||
type = submodule {
|
||||
freeformType = attrsOf sourcePluginType;
|
||||
options = let
|
||||
defaultSourcePluginOption = name: package: module: {
|
||||
package = mkOption {
|
||||
type = pluginType;
|
||||
default = package;
|
||||
description = ''
|
||||
`blink-cmp` ${name} source plugin package.
|
||||
'';
|
||||
};
|
||||
module = mkOption {
|
||||
type = str;
|
||||
default = module;
|
||||
description = ''
|
||||
Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.${name}.module`.
|
||||
'';
|
||||
};
|
||||
enable = mkEnableOption "${name} source";
|
||||
};
|
||||
in {
|
||||
# emoji completion after :
|
||||
emoji = defaultSourcePluginOption "emoji" "blink-emoji-nvim" "blink-emoji";
|
||||
# spelling suggestions as completions
|
||||
spell = defaultSourcePluginOption "spell" "blink-cmp-spell" "blink-cmp-spell";
|
||||
# words from nearby files
|
||||
ripgrep = defaultSourcePluginOption "ripgrep" "blink-ripgrep-nvim" "blink-ripgrep";
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
`blink.cmp` sources.
|
||||
|
||||
Attribute names must be source names used in {option}`vim.autocomplete.blink-cmp.setupOpts.sources.default`.
|
||||
'';
|
||||
};
|
||||
|
||||
friendly-snippets.enable = mkEnableOption "friendly-snippets for blink to source from automatically";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.attrsets) attrValues filterAttrs;
|
||||
inherit (lib.lists) map optional;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||
|
||||
|
|
@ -19,9 +21,12 @@
|
|||
else if (plugin ? pname && (tryEval plugin.pname).success)
|
||||
then plugin.pname
|
||||
else plugin.name;
|
||||
|
||||
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
||||
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["blink-compat"];
|
||||
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||
lazy.plugins = {
|
||||
blink-cmp = {
|
||||
package = "blink-cmp";
|
||||
|
|
@ -32,12 +37,14 @@ in {
|
|||
#
|
||||
# event = ["InsertEnter" "CmdlineEnter"];
|
||||
|
||||
after = ''
|
||||
${optionalString config.vim.lazy.enable
|
||||
(concatStringsSep "\n" (map
|
||||
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
||||
cmpCfg.sourcePlugins))}
|
||||
'';
|
||||
after =
|
||||
# lua
|
||||
''
|
||||
${optionalString config.vim.lazy.enable
|
||||
(concatStringsSep "\n" (map
|
||||
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
||||
cmpCfg.sourcePlugins))}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -45,13 +52,26 @@ in {
|
|||
enableSharedCmpSources = true;
|
||||
blink-cmp.setupOpts = {
|
||||
sources = {
|
||||
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources);
|
||||
default =
|
||||
[
|
||||
"lsp"
|
||||
"path"
|
||||
"snippets"
|
||||
"buffer"
|
||||
]
|
||||
++ (attrNames cmpCfg.sources)
|
||||
++ (attrNames enabledBlinkSources);
|
||||
providers =
|
||||
mapAttrs (name: _: {
|
||||
inherit name;
|
||||
module = "blink.compat.source";
|
||||
})
|
||||
cmpCfg.sources;
|
||||
cmpCfg.sources
|
||||
// (mapAttrs (name: definition: {
|
||||
inherit name;
|
||||
inherit (definition) module;
|
||||
})
|
||||
enabledBlinkSources);
|
||||
};
|
||||
snippets = mkIf config.vim.snippets.luasnip.enable {
|
||||
preset = "luasnip";
|
||||
|
|
@ -67,16 +87,18 @@ in {
|
|||
${mappings.next} = [
|
||||
"select_next"
|
||||
"snippet_forward"
|
||||
(mkLuaInline ''
|
||||
function(cmp)
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
(mkLuaInline
|
||||
# lua
|
||||
''
|
||||
function(cmp)
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
|
||||
if has_words_before then
|
||||
return cmp.show()
|
||||
if has_words_before then
|
||||
return cmp.show()
|
||||
end
|
||||
end
|
||||
end
|
||||
'')
|
||||
'')
|
||||
"fallback"
|
||||
];
|
||||
${mappings.previous} = [
|
||||
|
|
|
|||
22
modules/plugins/hydra/config.nix
Normal file
22
modules/plugins/hydra/config.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.vim.hydra;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [];
|
||||
lazy.plugins.hydra = {
|
||||
package = "hydra.nvim";
|
||||
setupModule = "hydra";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
event = ["DeferredUIEnter"];
|
||||
cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/hydra/default.nix
Normal file
6
modules/plugins/hydra/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./hydra.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
7
modules/plugins/hydra/hydra.nix
Normal file
7
modules/plugins/hydra/hydra.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.hydra = {
|
||||
enable = mkEnableOption "utility for creating custom submodes and menus [nvimtools/hydra.nvim]";
|
||||
};
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ in {
|
|||
./nu.nix
|
||||
./odin.nix
|
||||
./wgsl.nix
|
||||
./yaml.nix
|
||||
./ruby.nix
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -121,8 +121,6 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
nixpkgs-fmt = null; # removed
|
||||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
||||
|
|
@ -219,7 +217,6 @@ in {
|
|||
${concatStringsSep ", " (attrNames formats)}
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
assertion = cfg.lsp.server != "rnix";
|
||||
message = ''
|
||||
|
|
|
|||
72
modules/plugins/languages/yaml.nix
Normal file
72
modules/plugins/languages/yaml.nix
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.yaml;
|
||||
|
||||
defaultServer = "yaml-language-server";
|
||||
servers = {
|
||||
yaml-language-server = {
|
||||
package = pkgs.nodePackages.yaml-language-server;
|
||||
lspConfig = ''
|
||||
lspconfig.yamlls.setup {
|
||||
capabilities = capabilities;
|
||||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/yaml-language-server", "--stdio"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.yaml = {
|
||||
enable = mkEnableOption "YAML language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "YAML treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
package = mkGrammarOption pkgs "yaml";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
description = "YAML LSP server to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
description = "YAML LSP server package";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.yaml-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
@ -57,8 +57,8 @@ in {
|
|||
};
|
||||
|
||||
mappings = {
|
||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
|
||||
viewToggle = mkMappingOption "Open or close the docs view panel" "<leader>lvt";
|
||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,12 @@
|
|||
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
||||
assertions = [
|
||||
{
|
||||
assertion = !config.vim.utility.ccc.enable;
|
||||
message = ''
|
||||
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
|
||||
'';
|
||||
}
|
||||
warnings = [
|
||||
# TODO: remove warning when we update to nvim 0.11
|
||||
(mkIf config.vim.utility.ccc.enable ''
|
||||
ccc and otter occasionally have small conflicts that will disappear with nvim 0.11.
|
||||
In the meantime, otter handles it by throwing a warning, but both plugins will work.
|
||||
'')
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["otter-nvim"];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.types) nullOr str bool;
|
||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.strings) isString;
|
||||
inherit (lib.types) nullOr str bool int enum listOf either;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
|
||||
in {
|
||||
imports = let
|
||||
renameSetupOpt = oldPath: newPath:
|
||||
|
|
@ -50,68 +54,100 @@ in {
|
|||
usePicker = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether or not we should use dressing.nvim to build a session picker UI";
|
||||
description = ''
|
||||
Whether we should use `dressing.nvim` to build a session picker UI
|
||||
'';
|
||||
};
|
||||
|
||||
setupOpts = {
|
||||
setupOpts = mkPluginSetupOption "which-key" {
|
||||
path_replacer = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "__";
|
||||
description = "The character to which the path separator will be replaced for session files";
|
||||
description = ''
|
||||
The character to which the path separator will be replaced for session files
|
||||
'';
|
||||
};
|
||||
|
||||
colon_replacer = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "++";
|
||||
description = "The character to which the colon symbol will be replaced for session files";
|
||||
description = ''
|
||||
The character to which the colon symbol will be replaced for session files
|
||||
'';
|
||||
};
|
||||
|
||||
autoload_mode = mkOption {
|
||||
type = types.enum ["Disabled" "CurrentDir" "LastSession"];
|
||||
type = either (enum ["Disabled" "CurrentDir" "LastSession"]) luaInline;
|
||||
# Variable 'sm' is defined in the pluginRC of nvim-session-manager. The
|
||||
# definition is as follows: `local sm = require('session_manager.config')`
|
||||
apply = val:
|
||||
if isString val
|
||||
then mkLuaInline "sm.AutoloadMode.${val}"
|
||||
else val;
|
||||
default = "LastSession";
|
||||
description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession";
|
||||
description = ''
|
||||
Define what to do when Neovim is started without arguments.
|
||||
|
||||
Takes either one of `"Disabled"`, `"CurrentDir"`, `"LastSession` in which case the value
|
||||
will be inserted into `sm.AutoloadMode.<value>`, or an inline Lua value.
|
||||
'';
|
||||
};
|
||||
|
||||
max_path_length = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
type = nullOr int;
|
||||
default = 80;
|
||||
description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all";
|
||||
description = ''
|
||||
Shorten the display path if length exceeds this threshold.
|
||||
|
||||
Use `0` if don't want to shorten the path at all
|
||||
'';
|
||||
};
|
||||
|
||||
autosave_last_session = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Automatically save last session on exit and on session switch";
|
||||
description = ''
|
||||
Automatically save last session on exit and on session switch
|
||||
'';
|
||||
};
|
||||
|
||||
autosave_ignore_not_normal = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed";
|
||||
description = ''
|
||||
Plugin will not save a session when no buffers are opened, or all of them are
|
||||
not writable or listed
|
||||
'';
|
||||
};
|
||||
|
||||
autosave_ignore_dirs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "A list of directories where the session will not be autosaved";
|
||||
};
|
||||
|
||||
autosave_ignore_filetypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = listOf str;
|
||||
default = ["gitcommit"];
|
||||
description = "All buffers of these file types will be closed before the session is saved";
|
||||
description = ''
|
||||
All buffers of these file types will be closed before the session is saved
|
||||
'';
|
||||
};
|
||||
|
||||
autosave_ignore_buftypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "All buffers of these buffer types will be closed before the session is saved";
|
||||
description = ''
|
||||
All buffers of these buffer types will be closed before the session is saved
|
||||
'';
|
||||
};
|
||||
|
||||
autosave_only_in_session = mkOption {
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Always autosaves session. If true, only autosaves after a session is active";
|
||||
description = ''
|
||||
Always autosaves session. If `true`, only autosaves after a session is active
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,17 @@
|
|||
"codedark"
|
||||
"dracula"
|
||||
"everforest"
|
||||
"github_dark"
|
||||
"github_light"
|
||||
"github_dark_dimmed"
|
||||
"github_dark_default"
|
||||
"github_light_default"
|
||||
"github_dark_high_contrast"
|
||||
"github_light_high_contrast"
|
||||
"github_dark_colorblind"
|
||||
"github_light_colorblind"
|
||||
"github_dark_tritanopia"
|
||||
"github_light_tritanopia"
|
||||
"gruvbox"
|
||||
"gruvbox_dark"
|
||||
"gruvbox_light"
|
||||
|
|
|
|||
|
|
@ -195,4 +195,20 @@ in {
|
|||
vim.cmd.colorscheme("nord")
|
||||
'';
|
||||
};
|
||||
github = {
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
...
|
||||
}: ''
|
||||
require('github-theme').setup({
|
||||
options = {
|
||||
transparent = ${boolToString transparent},
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd[[colorscheme github_${style}]]
|
||||
'';
|
||||
styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,22 +4,20 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.ui.illuminate;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["vim-illuminate"];
|
||||
vim = {
|
||||
startPlugins = ["vim-illuminate"];
|
||||
|
||||
vim.pluginRC.vim-illuminate = entryAnywhere ''
|
||||
require('illuminate').configure({
|
||||
filetypes_denylist = {
|
||||
'dirvish',
|
||||
'fugitive',
|
||||
'NvimTree',
|
||||
'TelescopePrompt',
|
||||
},
|
||||
})
|
||||
'';
|
||||
# vim-illuminate does not have a setup function. It is instead called 'configure'
|
||||
# and does what you expect from a setup function. Wild.
|
||||
pluginRC.vim-illuminate = entryAnywhere ''
|
||||
require('illuminate').configure(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) listOf str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.ui.illuminate = {
|
||||
enable = mkEnableOption "automatically highlight other uses of the word under the cursor [vim-illuminate]";
|
||||
enable = mkEnableOption ''
|
||||
automatically highlight other uses of the word under the cursor [vim-illuminate]
|
||||
'';
|
||||
|
||||
setupOpts = mkPluginSetupOption "vim-illuminate" {
|
||||
filetypes_denylist = mkOption {
|
||||
type = listOf str;
|
||||
default = ["dirvish" "fugitive" "NvimTree" "TelescopePrompt"];
|
||||
description = "Filetypes to not illuminate, this overrides `filetypes_allowlist`";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,24 @@
|
|||
./binds
|
||||
./ccc
|
||||
./diffview
|
||||
./direnv
|
||||
./fzf-lua
|
||||
./gestures
|
||||
./harpoon
|
||||
./icon-picker
|
||||
./images
|
||||
./leetcode-nvim
|
||||
./mkdir
|
||||
./motion
|
||||
./multicursors
|
||||
./new-file-template
|
||||
./nix-develop
|
||||
./outline
|
||||
./preview
|
||||
./surround
|
||||
./telescope
|
||||
./wakatime
|
||||
./yanky-nvim
|
||||
./leetcode-nvim
|
||||
./yazi-nvim
|
||||
];
|
||||
}
|
||||
|
|
|
|||
13
modules/plugins/utility/direnv/config.nix
Normal file
13
modules/plugins/utility/direnv/config.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.utility.direnv;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["direnv-vim"];
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/direnv/default.nix
Normal file
6
modules/plugins/utility/direnv/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./direnv.nix
|
||||
];
|
||||
}
|
||||
5
modules/plugins/utility/direnv/direnv.nix
Normal file
5
modules/plugins/utility/direnv/direnv.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.direnv.enable = mkEnableOption "syncing nvim shell environment with direnv's using `direnv.vim`";
|
||||
}
|
||||
41
modules/plugins/utility/harpoon/config.nix
Normal file
41
modules/plugins/utility/harpoon/config.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) pushDownDefault mkKeymap;
|
||||
|
||||
cfg = config.vim.navigation.harpoon;
|
||||
|
||||
keys = cfg.mappings;
|
||||
inherit (options.vim.navigation.harpoon) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["plenary-nvim"];
|
||||
|
||||
lazy.plugins.harpoon = {
|
||||
package = "harpoon";
|
||||
setupModule = "harpoon";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
cmd = ["Harpoon"];
|
||||
|
||||
keys = [
|
||||
(mkKeymap "n" keys.markFile "<Cmd>lua require('harpoon'):list():add()<CR>" {desc = mappings.markFile.description;})
|
||||
(mkKeymap "n" keys.listMarks "<Cmd>lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<CR>" {desc = mappings.listMarks.description;})
|
||||
(mkKeymap "n" keys.file1 "<Cmd>lua require('harpoon'):list():select(1)<CR>" {desc = mappings.file1.description;})
|
||||
(mkKeymap "n" keys.file2 "<Cmd>lua require('harpoon'):list():select(2)<CR>" {desc = mappings.file2.description;})
|
||||
(mkKeymap "n" keys.file3 "<Cmd>lua require('harpoon'):list():select(3)<CR>" {desc = mappings.file3.description;})
|
||||
(mkKeymap "n" keys.file4 "<Cmd>lua require('harpoon'):list():select(4)<CR>" {desc = mappings.file4.description;})
|
||||
];
|
||||
};
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>a" = "Harpoon Mark";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/harpoon/default.nix
Normal file
6
modules/plugins/utility/harpoon/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./harpoon.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
53
modules/plugins/utility/harpoon/harpoon.nix
Normal file
53
modules/plugins/utility/harpoon/harpoon.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
in {
|
||||
options.vim.navigation.harpoon = {
|
||||
mappings = {
|
||||
markFile = mkMappingOption "Mark file [Harpoon]" "<leader>a";
|
||||
listMarks = mkMappingOption "List marked files [Harpoon]" "<C-e>";
|
||||
file1 = mkMappingOption "Go to marked file 1 [Harpoon]" "<C-j>";
|
||||
file2 = mkMappingOption "Go to marked file 2 [Harpoon]" "<C-k>";
|
||||
file3 = mkMappingOption "Go to marked file 3 [Harpoon]" "<C-l>";
|
||||
file4 = mkMappingOption "Go to marked file 4 [Harpoon]" "<C-;>";
|
||||
};
|
||||
|
||||
enable = mkEnableOption "Quick bookmarks on keybinds [Harpoon]";
|
||||
|
||||
setupOpts = mkPluginSetupOption "Harpoon" {
|
||||
defaults = {
|
||||
save_on_toggle = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Any time the ui menu is closed then we will save the
|
||||
state back to the backing list, not to the fs
|
||||
'';
|
||||
};
|
||||
sync_on_ui_close = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Any time the ui menu is closed then the state of the
|
||||
list will be sync'd back to the fs
|
||||
'';
|
||||
};
|
||||
key = mkOption {
|
||||
type = luaInline;
|
||||
default = mkLuaInline ''
|
||||
function()
|
||||
return vim.loop.cwd()
|
||||
end
|
||||
'';
|
||||
description = ''
|
||||
How the out list key is looked up. This can be useful
|
||||
when using worktrees and using git remote instead of file path
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
12
modules/plugins/utility/mkdir/config.nix
Normal file
12
modules/plugins/utility/mkdir/config.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.vim.utility.mkdir;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["mkdir-nvim"];
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/mkdir/default.nix
Normal file
6
modules/plugins/utility/mkdir/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./mkdir.nix
|
||||
];
|
||||
}
|
||||
7
modules/plugins/utility/mkdir/mkdir.nix
Normal file
7
modules/plugins/utility/mkdir/mkdir.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.mkdir.enable = mkEnableOption ''
|
||||
parent directory creation when editing a nested path that does not exist using `mkdir.nvim`
|
||||
'';
|
||||
}
|
||||
36
modules/plugins/utility/multicursors/config.nix
Normal file
36
modules/plugins/utility/multicursors/config.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.vim.utility.multicursors;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["hydra-nvim"];
|
||||
lazy.plugins."multicursors-nvim" = {
|
||||
package = "multicursors-nvim";
|
||||
setupModule = "multicursors";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
event = ["DeferredUIEnter"];
|
||||
cmd = ["MCstart" "MCvisual" "MCclear" "MCpattern" "MCvisualPattern" "MCunderCursor"];
|
||||
keys = [
|
||||
{
|
||||
mode = ["v" "n"];
|
||||
key = "<leader>mcs";
|
||||
action = ":MCstart<cr>";
|
||||
desc = "Create a selection for selected text or word under the cursor [multicursors.nvim]";
|
||||
}
|
||||
{
|
||||
mode = ["v" "n"];
|
||||
key = "<leader>mcp";
|
||||
action = ":MCpattern<cr>";
|
||||
desc = "Create a selection for pattern entered [multicursors.nvim]";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/multicursors/default.nix
Normal file
6
modules/plugins/utility/multicursors/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./multicursors.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
138
modules/plugins/utility/multicursors/multicursors.nix
Normal file
138
modules/plugins/utility/multicursors/multicursors.nix
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf nullOr bool int str submodule;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
|
||||
hintConfig = {
|
||||
options = {
|
||||
float_opts = mkOption {
|
||||
description = "The options for the floating hint window";
|
||||
type = submodule {
|
||||
options = {
|
||||
border = mkOption {
|
||||
type = str;
|
||||
default = "none";
|
||||
description = "The border style for the hint window";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = str;
|
||||
default = "bottom";
|
||||
description = "The position of the hint window";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
generateHints = {
|
||||
options = {
|
||||
normal = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Generate hints for the normal mode";
|
||||
};
|
||||
|
||||
insert = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Generate hints for the insert mode";
|
||||
};
|
||||
|
||||
extend = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Generate hints for the extend mode";
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
description = "The configuration for generating hints for multicursors.nvim";
|
||||
type = submodule {
|
||||
options = {
|
||||
column_count = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = "The number of columns to use for the hint window";
|
||||
};
|
||||
|
||||
max_hint_length = mkOption {
|
||||
type = int;
|
||||
default = 25;
|
||||
description = "The maximum length of the hint";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
default = {
|
||||
column_count = null;
|
||||
max_hint_length = 25;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.utility.multicursors = {
|
||||
enable = mkEnableOption "vscode like multiple cursors [multicursor.nvim]";
|
||||
|
||||
setupOpts = mkPluginSetupOption "multicursors" {
|
||||
DEBUG_MODE = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Enable debug mode.";
|
||||
};
|
||||
|
||||
create_commands = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Create Multicursor user commands";
|
||||
};
|
||||
|
||||
updatetime = mkOption {
|
||||
type = int;
|
||||
default = 50;
|
||||
description = "The time in milliseconds to wait before updating the cursor in insert mode";
|
||||
};
|
||||
|
||||
nowait = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Don't wait for the cursor to move before updating the cursor";
|
||||
};
|
||||
|
||||
mode_keys = mkOption {
|
||||
type = attrsOf str;
|
||||
default = {
|
||||
insert = "i";
|
||||
append = "a";
|
||||
change = "c";
|
||||
extend = "e";
|
||||
};
|
||||
description = "The keys to use for each mode";
|
||||
};
|
||||
|
||||
hint_config = mkOption {
|
||||
type = submodule hintConfig;
|
||||
default = {
|
||||
float_opts.border = "none";
|
||||
position = "bottom";
|
||||
};
|
||||
description = "The configuration for the hint window";
|
||||
};
|
||||
|
||||
generate_hints = mkOption {
|
||||
type = submodule generateHints;
|
||||
default = {
|
||||
normal = true;
|
||||
insert = true;
|
||||
extend = true;
|
||||
config = {
|
||||
column_count = null;
|
||||
max_hint_length = 25;
|
||||
};
|
||||
};
|
||||
description = "The configuration for generating hints";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
12
modules/plugins/utility/nix-develop/config.nix
Normal file
12
modules/plugins/utility/nix-develop/config.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.vim.utility.nix-develop;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["nix-develop-nvim"];
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/nix-develop/default.nix
Normal file
6
modules/plugins/utility/nix-develop/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nix-develop.nix
|
||||
];
|
||||
}
|
||||
5
modules/plugins/utility/nix-develop/nix-develop.nix
Normal file
5
modules/plugins/utility/nix-develop/nix-develop.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.nix-develop.enable = mkEnableOption "in-neovim `nix develop`, `nix shell`, and more using `nix-develop.nvim`";
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
cfg = config.vim.utility.yanky-nvim;
|
||||
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
|
||||
usingShada = cfg.setupOpts.ring.storage == "shada";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
|
|
@ -28,5 +29,15 @@ in {
|
|||
require("yanky").setup(${toLuaObject cfg.setupOpts});
|
||||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = usingShada && ((config.vim.options.shada or "") == "");
|
||||
message = ''
|
||||
Yanky.nvim is configured to use 'shada' for the storage backend, but shada is disabled
|
||||
in 'vim.options'. Please re-enable shada, or switch to a different backend.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.yanky-nvim = {
|
||||
enable = mkEnableOption ''
|
||||
improved Yank and Put functionalities for Neovim [yanky-nvim]
|
||||
'';
|
||||
|
||||
setupOpts = {
|
||||
setupOpts = mkPluginSetupOption "yanky-nvim" {
|
||||
ring.storage = mkOption {
|
||||
type = enum ["shada" "sqlite" "memory"];
|
||||
default = "shada";
|
||||
|
|
@ -15,11 +16,11 @@ in {
|
|||
description = ''
|
||||
storage mode for ring values.
|
||||
|
||||
- shada: this will save pesistantly using Neovim ShaDa feature.
|
||||
- **shada**: this will save pesistantly using Neovim ShaDa feature.
|
||||
This means that history will be persisted between each session of Neovim.
|
||||
- memory: each Neovim instance will have his own history and it will be
|
||||
- **memory**: each Neovim instance will have his own history and it will be
|
||||
lost between sessions.
|
||||
- sqlite: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
||||
- **sqlite**: more reliable than `shada`, requires `sqlite.lua` as a dependency.
|
||||
nvf will add this dependency to `PATH` automatically.
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
33
modules/plugins/utility/yazi-nvim/config.nix
Normal file
33
modules/plugins/utility/yazi-nvim/config.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
options,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
|
||||
cfg = config.vim.utility.yazi-nvim;
|
||||
keys = cfg.mappings;
|
||||
|
||||
inherit (options.vim.utility.yazi-nvim) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["snacks-nvim"];
|
||||
lazy.plugins."yazi.nvim" = {
|
||||
package = pkgs.vimPlugins.yazi-nvim;
|
||||
setupModule = "yazi";
|
||||
inherit (cfg) setupOpts;
|
||||
event = ["BufAdd" "VimEnter"];
|
||||
|
||||
keys = [
|
||||
(mkKeymap "n" keys.openYazi "<cmd>Yazi<CR>" {desc = mappings.openYazi.description;})
|
||||
(mkKeymap "n" keys.openYaziDir "<cmd>Yazi cwd<CR>" {desc = mappings.openYaziDir.description;})
|
||||
(mkKeymap "n" keys.yaziToggle "<cmd>Yazi toggle<CR>" {desc = mappings.yaziToggle.description;})
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/plugins/utility/yazi-nvim/default.nix
Normal file
6
modules/plugins/utility/yazi-nvim/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./yazi-nvim.nix
|
||||
];
|
||||
}
|
||||
26
modules/plugins/utility/yazi-nvim/yazi-nvim.nix
Normal file
26
modules/plugins/utility/yazi-nvim/yazi-nvim.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.utility.yazi-nvim = {
|
||||
enable = mkEnableOption ''
|
||||
companion plugin for the yazi terminal file manager [yazi-nvim]
|
||||
'';
|
||||
|
||||
mappings = {
|
||||
openYazi = mkMappingOption "Open yazi at the current file [yazi.nvim]" "<leader>-";
|
||||
openYaziDir = mkMappingOption "Open the file manager in nvim's working directory [yazi.nvim]" "<leader>cw";
|
||||
yaziToggle = mkMappingOption "Resume the last yazi session [yazi.nvim]" "<c-up>";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "yazi-nvim" {
|
||||
open_for_directories = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to open Yazi instead of netrw";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue