Merge branch 'main' into telescope-ext

This commit is contained in:
raf 2025-03-27 09:51:45 +00:00 committed by GitHub
commit 062ae94787
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
92 changed files with 2970 additions and 1102 deletions

View file

@ -3,18 +3,25 @@
./binds
./ccc
./diffview
./direnv
./fzf-lua
./gestures
./harpoon
./icon-picker
./images
./leetcode-nvim
./mkdir
./motion
./multicursors
./new-file-template
./nix-develop
./outline
./preview
./snacks-nvim
./surround
./telescope
./wakatime
./yanky-nvim
./leetcode-nvim
./yazi-nvim
];
}

View 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"];
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./direnv.nix
];
}

View 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`";
}

View 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";
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./harpoon.nix
./config.nix
];
}

View 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
'';
};
};
};
};
}

View 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"];
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./mkdir.nix
];
}

View 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`
'';
}

View 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]";
}
];
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./multicursors.nix
./config.nix
];
}

View 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";
};
};
};
}

View 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"];
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./nix-develop.nix
];
}

View 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`";
}

View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.utility.snacks-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["snacks-nvim"];
pluginRC.snacks-nvim = entryAnywhere ''
require("snacks").setup(${toLuaObject cfg.setupOpts});
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./snacks-nvim.nix
];
}

View file

@ -0,0 +1,12 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.utility.snacks-nvim = {
enable = mkEnableOption ''
collection of QoL plugins for Neovim [snacks-nvim]
'';
setupOpts = mkPluginSetupOption "snacks-nvim" {};
};
}

View file

@ -14,10 +14,11 @@ in {
vim = {
lazy.plugins.nvim-surround = {
package = "nvim-surround";
setupModule = "nvim-surround";
inherit (cfg) setupOpts;
event = ["BufReadPre" "BufNewFile"];
keys = [
(mkLznKey "i" cfg.setupOpts.keymaps.insert)
(mkLznKey "i" cfg.setupOpts.keymaps.insert_line)

View file

@ -37,9 +37,13 @@ in {
type = bool;
default = false;
description = ''
nvim-surround: add/change/delete surrounding delimiter pairs with ease.
Note that the default mappings deviate from upstream to avoid conflicts
with nvim-leap.
Whether to enable nvim-surround, Neovim plugin to add/change/delete
surrounding delimiter pairs with ease.
::: {.note}
The default mappings deviate from upstream to avoid conflicts with nvim-leap.
You may change those in your configuration if you do not use nvim-leap
:::
'';
};
setupOpts = mkPluginSetupOption "nvim-surround" {
@ -61,7 +65,9 @@ in {
useVendoredKeybindings = mkOption {
type = bool;
default = true;
description = "Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap";
description = ''
Use alternative set of keybindings that avoids conflicts with other popular plugins, e.g. nvim-leap
'';
};
};
}

View file

@ -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.
'';
}
];
};
}

View file

@ -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.
'';
};

View 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;})
];
};
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./yazi-nvim.nix
];
}

View 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";
};
};
};
}