mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-16 23:35:13 +00:00
Compare commits
No commits in common. "230d216cb35051fe5f3aed59200b012551d16af1" and "2b2eddcdb68c39fe8acf950aa7ad77f55a1fd7e3" have entirely different histories.
230d216cb3
...
2b2eddcdb6
45 changed files with 741 additions and 1445 deletions
|
|
@ -14,7 +14,7 @@ indent_style = space
|
|||
indent_size = 2
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{js,json,nix,yml,yaml,toml}]
|
||||
[*.{js,json,nix,yml,yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
tab_width = 2
|
||||
|
|
|
|||
2
.github/README.md
vendored
2
.github/README.md
vendored
|
|
@ -237,7 +237,7 @@ customizability of plugin inputs, which is one of our primary features.
|
|||
an imperative path (e.g., `~/.config/nvim`) for my Neovim configuration instead
|
||||
of a configuration generated from Nix?
|
||||
|
||||
**A**: Yes! Add `"~/.config/nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
|
||||
**A**: Yes! Add `"~/.config.nvim"` to `vim.additionalRuntimePaths = [ ... ]` and
|
||||
any plugins you want to load to `vim.startPlugins`. This will load your
|
||||
configuration from `~/.config/nvim`. You may still use `vim.*` to modify
|
||||
Neovim's behaviour with Nix.
|
||||
|
|
|
|||
11
.github/typos.toml
vendored
11
.github/typos.toml
vendored
|
|
@ -1,10 +1,5 @@
|
|||
|
||||
files.extend-exclude = ["npins/sources.json"]
|
||||
default.extend-ignore-words-re = [
|
||||
"(?i)(noice)",
|
||||
"befores",
|
||||
"annote",
|
||||
"viw",
|
||||
"BA", # somehow "BANanaD3V" is valid, but BA is not...
|
||||
default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote", "viw"]
|
||||
files.extend-exclude = [
|
||||
"npins/sources.json"
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@
|
|||
## Breaking changes
|
||||
|
||||
- `git-conflict` keybinds are now prefixed with `<leader>` to avoid conflicting
|
||||
with builtins.
|
||||
|
||||
- `alpha` is now configured with nix, default config removed.
|
||||
with builtins
|
||||
|
||||
[NotAShelf](https://github.com/notashelf):
|
||||
|
||||
[typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim
|
||||
[render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim
|
||||
[yanky.nvim]: https://github.com/gbprod/yanky.nvim
|
||||
[yazi.nvim]: https://github.com/mikavilpas/yazi.nvim
|
||||
|
||||
- Add [typst-preview.nvim] under
|
||||
`languages.typst.extensions.typst-preview-nvim`.
|
||||
|
|
@ -20,7 +17,7 @@
|
|||
- Add a search widget to the options page in the nvf manual.
|
||||
|
||||
- Add [render-markdown.nvim] under
|
||||
`languages.markdown.extensions.render-markdown-nvim`.
|
||||
`languages.markdown.extensions.render-markdown-nvim`
|
||||
|
||||
- Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table
|
||||
in gitsigns configuration.
|
||||
|
|
@ -49,19 +46,6 @@
|
|||
|
||||
- Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`.
|
||||
|
||||
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
|
||||
backend while shada is disabled in Neovim options.
|
||||
|
||||
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||
|
||||
- Add [](#opt-vim.autocmds) and [](#opt-vim.augroups) to allow declaring
|
||||
autocommands via Nix.
|
||||
|
||||
- Fix plugin `setupOpts` for yanky.nvim and assert if shada is configured as a
|
||||
backend while shada is disabled in Neovim options.
|
||||
|
||||
- Add [yazi.nvim] as a companion plugin for Yazi, the terminal file manager.
|
||||
|
||||
[amadaluzia](https://github.com/amadaluzia):
|
||||
|
||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||
|
|
@ -72,7 +56,7 @@
|
|||
|
||||
[blink.cmp]: https://github.com/saghen/blink.cmp
|
||||
|
||||
- Add [blink.cmp] support.
|
||||
- Add [blink.cmp] support
|
||||
|
||||
[diniamo](https://github.com/diniamo):
|
||||
|
||||
|
|
@ -86,8 +70,8 @@
|
|||
[aerial.nvim]: (https://github.com/stevearc/aerial.nvim)
|
||||
[nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo)
|
||||
|
||||
- Add [aerial.nvim].
|
||||
- Add [nvim-ufo].
|
||||
- Add [aerial.nvim]
|
||||
- Add [nvim-ufo]
|
||||
|
||||
[LilleAila](https://github.com/LilleAila):
|
||||
|
||||
|
|
@ -170,7 +154,8 @@
|
|||
Inspiration from `vim.languages.clang.dap` implementation.
|
||||
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
|
||||
|
||||
[nezia1](https://github.com/nezia1):
|
||||
|
||||
[nezia1](https://github.com/nezia1)
|
||||
|
||||
- Add support for [nixd](https://github.com/nix-community/nixd) language server.
|
||||
|
||||
|
|
@ -180,64 +165,20 @@
|
|||
available plugins, under `vim.utility.multicursors`.
|
||||
- Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for
|
||||
`multicursors.nvim` and lazy loads by default.
|
||||
|
||||
[folospior](https://github.com/folospior):
|
||||
[folospior](https://github.com/folospior)
|
||||
|
||||
- Fix plugin name for lsp/lspkind.
|
||||
|
||||
- Move `vim-illuminate` to `setupOpts format`
|
||||
|
||||
[iynaix](https://github.com/iynaix):
|
||||
[iynaix](https://github.com/iynaix)
|
||||
|
||||
- Add lsp options support for [nixd](https://github.com/nix-community/nixd)
|
||||
language server.
|
||||
|
||||
[Mr-Helpful](https://github.com/Mr-Helpful):
|
||||
[Mr-Helpful](https://github.com/Mr-Helpful)
|
||||
|
||||
- Corrects pin names used for nvim themes.
|
||||
- Corrects pin names used for nvim themes
|
||||
|
||||
[Libadoxon](https://github.com/Libadoxon):
|
||||
[Libadoxon](https://github.com/Libadoxon)
|
||||
|
||||
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for
|
||||
resolving git conflicts.
|
||||
- Add formatters for go: [gofmt](https://go.dev/blog/gofmt),
|
||||
[golines](https://github.com/segmentio/golines) and
|
||||
[gofumpt](https://github.com/mvdan/gofumpt).
|
||||
|
||||
[UltraGhostie](https://github.com/UltraGhostie)
|
||||
|
||||
- Add [harpoon](https://github.com/ThePrimeagen/harpoon) plugin for navigation
|
||||
|
||||
[MaxMur](https://github.com/TheMaxMur):
|
||||
|
||||
- Add YAML support under `vim.languages.yaml`.
|
||||
|
||||
[alfarel](https://github.com/alfarelcynthesis):
|
||||
|
||||
- Add missing `yazi.nvim` dependency (`snacks.nvim`).
|
||||
|
||||
- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic
|
||||
creation of parent directories when editing a nested file.
|
||||
- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for
|
||||
in-neovim `nix develop`, `nix shell` and more.
|
||||
- Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic
|
||||
syncing of nvim shell environment with direnv's.
|
||||
- Add [blink.cmp] source options and some default-disabled sources.
|
||||
- Add [blink.cmp] option to add
|
||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||
blink.cmp can source snippets from it.
|
||||
|
||||
[TheColorman](https://github.com/TheColorman):
|
||||
|
||||
- Fix plugin `setupOpts` for `neovim-session-manager` having an invalid value
|
||||
for `autoload_mode`.
|
||||
|
||||
[esdevries](https://github.com/esdevries):
|
||||
|
||||
[projekt0n/github-nvim-theme]: https://github.com/projekt0n/github-nvim-theme
|
||||
|
||||
- Add `github-nvim-theme` theme from [projekt0n/github-nvim-theme].
|
||||
|
||||
[BANanaD3V](https://github.com/BANanaD3V):
|
||||
|
||||
- `alpha` is now configured with nix.
|
||||
- Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for resolving git conflicts
|
||||
- Add formatters for go: [gofmt](https://go.dev/blog/gofmt), [golines](https://github.com/segmentio/golines) and [gofumpt](https://github.com/mvdan/gofumpt)
|
||||
|
|
|
|||
26
flake.lock
generated
26
flake.lock
generated
|
|
@ -5,11 +5,11 @@
|
|||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738453229,
|
||||
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
||||
"lastModified": 1733312601,
|
||||
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
||||
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -38,11 +38,11 @@
|
|||
},
|
||||
"mnw": {
|
||||
"locked": {
|
||||
"lastModified": 1738852285,
|
||||
"narHash": "sha256-8Y1uyE6gGHxdU0Vcx2CMg/dAmDSxJw19aAl3TKbbo54=",
|
||||
"lastModified": 1735150973,
|
||||
"narHash": "sha256-OJhcCAoaMMXeD6o4qI/hxBCNELJp4dN8D5LJZc8w8XA=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "mnw",
|
||||
"rev": "6ae73dc9cb72cea17bcc2e3d4670825f483e80e8",
|
||||
"rev": "40cd0b006cc48dffd0f8698ad7f54cf1d56779a6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -77,11 +77,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1740303746,
|
||||
"narHash": "sha256-XcdiWLEhjJkMxDLKQJ0CCivmYYCvA5MDxu9pMybM5kM=",
|
||||
"lastModified": 1737370608,
|
||||
"narHash": "sha256-hFA6SmioeqvGW/XvZa9bxniAeulksCOcj3kokdNT/YE=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2d068ae5c6516b2d04562de50a58c682540de9bf",
|
||||
"rev": "300081d0cc72df578b02d914df941b8ec62240e6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -93,14 +93,14 @@
|
|||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1738452942,
|
||||
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
|
||||
"lastModified": 1733096140,
|
||||
"narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
|
||||
}
|
||||
},
|
||||
"nmd": {
|
||||
|
|
|
|||
|
|
@ -1,185 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.lists) filter;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.types) nullOr submodule listOf str bool;
|
||||
inherit (lib.nvim.types) luaInline;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
autocommandType = submodule {
|
||||
options = {
|
||||
enable =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable this autocommand";
|
||||
};
|
||||
|
||||
event = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
example = ["BufRead" "BufWritePre"];
|
||||
description = "The event(s) that trigger the autocommand.";
|
||||
};
|
||||
|
||||
pattern = mkOption {
|
||||
type = nullOr (listOf str);
|
||||
default = null;
|
||||
example = ["*.lua" "*.vim"];
|
||||
description = "The file pattern(s) that determine when the autocommand applies).";
|
||||
};
|
||||
|
||||
callback = mkOption {
|
||||
type = nullOr luaInline;
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
mkLuaInline '''
|
||||
function()
|
||||
print("Saving a Lua file...")
|
||||
end
|
||||
''''
|
||||
'';
|
||||
description = "The file pattern(s) that determine when the autocommand applies.";
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Vim command string instead of a Lua function.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "MyAutoCmdGroup";
|
||||
description = "An optional autocommand group to manage related autocommands.";
|
||||
};
|
||||
|
||||
desc = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "Notify when saving a Lua file";
|
||||
description = "A description for the autocommand.";
|
||||
};
|
||||
|
||||
once = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether autocommand run only once.";
|
||||
};
|
||||
|
||||
nested = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to allow nested autocommands to trigger.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
autogroupType = submodule {
|
||||
options = {
|
||||
enable =
|
||||
mkEnableOption ""
|
||||
// {
|
||||
default = true;
|
||||
description = "Whether to enable this autogroup";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = str;
|
||||
example = "MyAutoCmdGroup";
|
||||
description = "The name of the autocommand group.";
|
||||
};
|
||||
|
||||
clear = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to clear existing autocommands in this group before defining new ones.
|
||||
This helps avoid duplicate autocommands.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.vim;
|
||||
in {
|
||||
options.vim = {
|
||||
augroups = mkOption {
|
||||
type = listOf autogroupType;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of Neovim autogroups, which are used to organize and manage related
|
||||
autocommands together. Groups allow multiple autocommands to be cleared
|
||||
or redefined collectively, preventing duplicate definitions.
|
||||
|
||||
Each autogroup consists of a name, a boolean indicating whether to clear
|
||||
existing autocommands, and a list of associated autocommands.
|
||||
'';
|
||||
};
|
||||
|
||||
autocmds = mkOption {
|
||||
type = listOf autocommandType;
|
||||
default = [];
|
||||
description = ''
|
||||
A list of Neovim autocommands to be registered.
|
||||
|
||||
Each entry defines an autocommand, specifying events, patterns, optional
|
||||
callbacks, commands, groups, and execution settings.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
vim = let
|
||||
enabledAutocommands = filter (cmd: cmd.enable) cfg.autocmds;
|
||||
enabledAutogroups = filter (au: au.enable) cfg.augroups;
|
||||
in {
|
||||
luaConfigRC = {
|
||||
augroups = entryAfter ["pluginConfigs"] (optionalString (enabledAutogroups != []) ''
|
||||
local nvf_autogroups = {}
|
||||
for _, group in ipairs(${toLuaObject enabledAutogroups}) do
|
||||
if group.name then
|
||||
nvf_autogroups[group.name] = { clear = group.clear }
|
||||
end
|
||||
end
|
||||
|
||||
for group_name, options in pairs(nvf_autogroups) do
|
||||
vim.api.nvim_create_augroup(group_name, options)
|
||||
end
|
||||
'');
|
||||
|
||||
autocmds = entryAfter ["pluginConfigs"] (optionalString (enabledAutocommands != []) ''
|
||||
local nvf_autocommands = ${toLuaObject enabledAutocommands}
|
||||
for _, autocmd in ipairs(nvf_autocommands) do
|
||||
vim.api.nvim_create_autocmd(
|
||||
autocmd.event,
|
||||
{
|
||||
group = autocmd.group,
|
||||
pattern = autocmd.pattern,
|
||||
buffer = autocmd.buffer,
|
||||
desc = autocmd.desc,
|
||||
callback = autocmd.callback,
|
||||
command = autocmd.command,
|
||||
once = autocmd.once,
|
||||
nested = autocmd.nested
|
||||
}
|
||||
)
|
||||
end
|
||||
'');
|
||||
};
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = builtins.all (cmd: (cmd.command == null || cmd.callback == null)) cfg.autocmds;
|
||||
message = "An autocommand cannot have both 'command' and 'callback' defined at the same time.";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./autocmds.nix
|
||||
./basic.nix
|
||||
./debug.nix
|
||||
./highlight.nix
|
||||
|
|
|
|||
|
|
@ -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 pluginType;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
|
||||
|
|
@ -37,6 +37,12 @@ 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 = {};
|
||||
|
|
@ -57,14 +63,6 @@ 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";
|
||||
|
|
@ -118,66 +116,5 @@ 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,8 +6,6 @@
|
|||
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;
|
||||
|
||||
|
|
@ -21,12 +19,9 @@
|
|||
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"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||
startPlugins = ["blink-compat"];
|
||||
lazy.plugins = {
|
||||
blink-cmp = {
|
||||
package = "blink-cmp";
|
||||
|
|
@ -37,14 +32,12 @@ in {
|
|||
#
|
||||
# event = ["InsertEnter" "CmdlineEnter"];
|
||||
|
||||
after =
|
||||
# lua
|
||||
''
|
||||
${optionalString config.vim.lazy.enable
|
||||
(concatStringsSep "\n" (map
|
||||
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
||||
cmpCfg.sourcePlugins))}
|
||||
'';
|
||||
after = ''
|
||||
${optionalString config.vim.lazy.enable
|
||||
(concatStringsSep "\n" (map
|
||||
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
||||
cmpCfg.sourcePlugins))}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -52,26 +45,13 @@ in {
|
|||
enableSharedCmpSources = true;
|
||||
blink-cmp.setupOpts = {
|
||||
sources = {
|
||||
default =
|
||||
[
|
||||
"lsp"
|
||||
"path"
|
||||
"snippets"
|
||||
"buffer"
|
||||
]
|
||||
++ (attrNames cmpCfg.sources)
|
||||
++ (attrNames enabledBlinkSources);
|
||||
default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources);
|
||||
providers =
|
||||
mapAttrs (name: _: {
|
||||
inherit name;
|
||||
module = "blink.compat.source";
|
||||
})
|
||||
cmpCfg.sources
|
||||
// (mapAttrs (name: definition: {
|
||||
inherit name;
|
||||
inherit (definition) module;
|
||||
})
|
||||
enabledBlinkSources);
|
||||
cmpCfg.sources;
|
||||
};
|
||||
snippets = mkIf config.vim.snippets.luasnip.enable {
|
||||
preset = "luasnip";
|
||||
|
|
@ -87,18 +67,16 @@ in {
|
|||
${mappings.next} = [
|
||||
"select_next"
|
||||
"snippet_forward"
|
||||
(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
|
||||
(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
|
||||
|
||||
if has_words_before then
|
||||
return cmp.show()
|
||||
end
|
||||
if has_words_before then
|
||||
return cmp.show()
|
||||
end
|
||||
'')
|
||||
end
|
||||
'')
|
||||
"fallback"
|
||||
];
|
||||
${mappings.previous} = [
|
||||
|
|
|
|||
|
|
@ -1,23 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) listOf attrsOf anything nullOr enum;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.dashboard.alpha = {
|
||||
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.nvim]";
|
||||
theme = mkOption {
|
||||
type = nullOr (enum ["dashboard" "startify" "theta"]);
|
||||
default = "dashboard";
|
||||
description = "Alpha default theme to use";
|
||||
};
|
||||
layout = mkOption {
|
||||
type = listOf (attrsOf anything);
|
||||
default = [];
|
||||
description = "Alpha dashboard layout";
|
||||
};
|
||||
opts = mkOption {
|
||||
type = attrsOf anything;
|
||||
default = {};
|
||||
description = "Optional global options";
|
||||
};
|
||||
enable = mkEnableOption "fast and fully programmable greeter for neovim [alpha.mvim]";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,8 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.dashboard.alpha;
|
||||
themeDefined = cfg.theme != null;
|
||||
layoutDefined = cfg.layout != [];
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = [
|
||||
|
|
@ -17,30 +14,207 @@ in {
|
|||
"nvim-web-devicons"
|
||||
];
|
||||
|
||||
vim.pluginRC.alpha = let
|
||||
setupOpts =
|
||||
if themeDefined
|
||||
then lib.generators.mkLuaInline "require'alpha.themes.${cfg.theme}'.config"
|
||||
else {
|
||||
inherit (cfg) layout opts;
|
||||
};
|
||||
in ''
|
||||
require('alpha').setup(${toLuaObject setupOpts})
|
||||
'';
|
||||
# the entire credit for this dashboard configuration to https://github.com/Rishabh672003
|
||||
# honestly, excellent work
|
||||
vim.pluginRC.alpha = entryAnywhere ''
|
||||
local alpha = require("alpha")
|
||||
local plenary_path = require("plenary.path")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
local cdir = vim.fn.getcwd()
|
||||
local if_nil = vim.F.if_nil
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = themeDefined || layoutDefined;
|
||||
message = ''
|
||||
One of 'theme' or 'layout' should be defined in Alpha configuration.
|
||||
'';
|
||||
local nvim_web_devicons = {
|
||||
enabled = true,
|
||||
highlight = true,
|
||||
}
|
||||
{
|
||||
assertion = !(themeDefined && layoutDefined);
|
||||
message = ''
|
||||
'theme' and 'layout' cannot be defined at the same time.
|
||||
'';
|
||||
|
||||
local function get_extension(fn)
|
||||
local match = fn:match("^.+(%..+)$")
|
||||
local ext = ""
|
||||
if match ~= nil then
|
||||
ext = match:sub(2)
|
||||
end
|
||||
return ext
|
||||
end
|
||||
|
||||
local function icon(fn)
|
||||
local nwd = require("nvim-web-devicons")
|
||||
local ext = get_extension(fn)
|
||||
return nwd.get_icon(fn, ext, { default = true })
|
||||
end
|
||||
|
||||
local function file_button(fn, sc, short_fn)
|
||||
short_fn = short_fn or fn
|
||||
local ico_txt
|
||||
local fb_hl = {}
|
||||
|
||||
if nvim_web_devicons.enabled then
|
||||
local ico, hl = icon(fn)
|
||||
local hl_option_type = type(nvim_web_devicons.highlight)
|
||||
if hl_option_type == "boolean" then
|
||||
if hl and nvim_web_devicons.highlight then
|
||||
table.insert(fb_hl, { hl, 0, 3 })
|
||||
end
|
||||
end
|
||||
if hl_option_type == "string" then
|
||||
table.insert(fb_hl, { nvim_web_devicons.highlight, 0, 3 })
|
||||
end
|
||||
ico_txt = ico .. " "
|
||||
else
|
||||
ico_txt = ""
|
||||
end
|
||||
local file_button_el = dashboard.button(sc, ico_txt .. short_fn, "<cmd>e " .. fn .. " <CR>")
|
||||
local fn_start = short_fn:match(".*[/\\]")
|
||||
if fn_start ~= nil then
|
||||
table.insert(fb_hl, { "Comment", #ico_txt - 2, #fn_start + #ico_txt })
|
||||
end
|
||||
file_button_el.opts.hl = fb_hl
|
||||
return file_button_el
|
||||
end
|
||||
|
||||
local default_mru_ignore = { "gitcommit" }
|
||||
|
||||
local mru_opts = {
|
||||
ignore = function(path, ext)
|
||||
return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext))
|
||||
end,
|
||||
}
|
||||
];
|
||||
|
||||
--- @param start number
|
||||
--- @param cwd string optional
|
||||
--- @param items_number number optional number of items to generate, default = 10
|
||||
local function mru(start, cwd, items_number, opts)
|
||||
opts = opts or mru_opts
|
||||
items_number = if_nil(items_number, 15)
|
||||
|
||||
local oldfiles = {}
|
||||
for _, v in pairs(vim.v.oldfiles) do
|
||||
if #oldfiles == items_number then
|
||||
break
|
||||
end
|
||||
local cwd_cond
|
||||
if not cwd then
|
||||
cwd_cond = true
|
||||
else
|
||||
cwd_cond = vim.startswith(v, cwd)
|
||||
end
|
||||
local ignore = (opts.ignore and opts.ignore(v, get_extension(v))) or false
|
||||
if (vim.fn.filereadable(v) == 1) and cwd_cond and not ignore then
|
||||
oldfiles[#oldfiles + 1] = v
|
||||
end
|
||||
end
|
||||
local target_width = 35
|
||||
|
||||
local tbl = {}
|
||||
for i, fn in ipairs(oldfiles) do
|
||||
local short_fn
|
||||
if cwd then
|
||||
short_fn = vim.fn.fnamemodify(fn, ":.")
|
||||
else
|
||||
short_fn = vim.fn.fnamemodify(fn, ":~")
|
||||
end
|
||||
|
||||
if #short_fn > target_width then
|
||||
short_fn = plenary_path.new(short_fn):shorten(1, { -2, -1 })
|
||||
if #short_fn > target_width then
|
||||
short_fn = plenary_path.new(short_fn):shorten(1, { -1 })
|
||||
end
|
||||
end
|
||||
|
||||
local shortcut = tostring(i + start - 1)
|
||||
|
||||
local file_button_el = file_button(fn, shortcut, short_fn)
|
||||
tbl[i] = file_button_el
|
||||
end
|
||||
return {
|
||||
type = "group",
|
||||
val = tbl,
|
||||
opts = {},
|
||||
}
|
||||
end
|
||||
|
||||
local default_header = {
|
||||
type = "text",
|
||||
val = {
|
||||
|
||||
[[███ ██ ███████ ██████ ██ ██ ██ ███ ███]],
|
||||
[[████ ██ ██ ██ ██ ██ ██ ██ ████ ████]],
|
||||
[[██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ████ ██]],
|
||||
[[██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██]],
|
||||
[[██ ████ ███████ ██████ ████ ██ ██ ██]],
|
||||
|
||||
-- [[ __ ]],
|
||||
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
|
||||
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
|
||||
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
|
||||
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
|
||||
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
|
||||
},
|
||||
opts = {
|
||||
position = "center",
|
||||
hl = "Type",
|
||||
-- wrap = "overflow";
|
||||
},
|
||||
}
|
||||
|
||||
local section_mru = {
|
||||
type = "group",
|
||||
val = {
|
||||
{
|
||||
type = "text",
|
||||
val = "Recent files",
|
||||
opts = {
|
||||
hl = "SpecialComment",
|
||||
shrink_margin = false,
|
||||
position = "center",
|
||||
},
|
||||
},
|
||||
{ type = "padding", val = 1 },
|
||||
{
|
||||
type = "group",
|
||||
val = function()
|
||||
return { mru(0, cdir) }
|
||||
end,
|
||||
opts = { shrink_margin = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local buttons = {
|
||||
type = "group",
|
||||
val = {
|
||||
{ type = "text", val = "Quick links", opts = { hl = "SpecialComment", position = "center" } },
|
||||
{ type = "padding", val = 1 },
|
||||
-- TODO: buttons should be added based on whether or not the relevant plugin is available
|
||||
dashboard.button("e", " New file", "<cmd>ene<CR>"), -- available all the time
|
||||
dashboard.button("SPC F", " Find file"), -- telescope
|
||||
dashboard.button("SPC ff", " Live grep"), -- telescope
|
||||
dashboard.button("SPC p", " Projects"), -- any project
|
||||
dashboard.button("q", " Quit", "<cmd>qa<CR>"), -- available all the time
|
||||
},
|
||||
position = "center",
|
||||
}
|
||||
|
||||
local config = {
|
||||
layout = {
|
||||
{ type = "padding", val = 2 },
|
||||
default_header,
|
||||
{ type = "padding", val = 2 },
|
||||
section_mru,
|
||||
{ type = "padding", val = 2 },
|
||||
buttons,
|
||||
},
|
||||
opts = {
|
||||
margin = 5,
|
||||
setup = function()
|
||||
vim.cmd([[
|
||||
autocmd alpha_temp DirChanged * lua require('alpha').redraw()
|
||||
]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
alpha.setup(config)
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ in {
|
|||
./typst.nix
|
||||
./vala.nix
|
||||
./wgsl.nix
|
||||
./yaml.nix
|
||||
./zig.nix
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
nixpkgs-fmt = null; # removed
|
||||
};
|
||||
|
||||
defaultDiagnosticsProvider = ["statix" "deadnix"];
|
||||
|
|
@ -217,6 +219,7 @@ in {
|
|||
${concatStringsSep ", " (attrNames formats)}
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
assertion = cfg.lsp.server != "rnix";
|
||||
message = ''
|
||||
|
|
|
|||
|
|
@ -62,15 +62,6 @@ in {
|
|||
description = "Options to pass to rust analyzer";
|
||||
type = str;
|
||||
default = "";
|
||||
example = ''
|
||||
['rust-analyzer'] = {
|
||||
cargo = {allFeature = true},
|
||||
checkOnSave = true,
|
||||
procMacro = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -151,9 +142,6 @@ in {
|
|||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/rust-analyzer"}''
|
||||
},
|
||||
default_settings = {
|
||||
${cfg.lsp.opts}
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
local opts = { noremap=true, silent=true, buffer = bufnr }
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ in (
|
|||
'';
|
||||
synctex = mkBool true "Whether to generate SyncTeX data";
|
||||
untrustedInput = mkBool false ''
|
||||
Whether to disable all known-insecure features if the input is untrusted
|
||||
Whether to diable all known-insecure features if the input is untrusted
|
||||
'';
|
||||
|
||||
# -- Options --
|
||||
|
|
@ -143,7 +143,7 @@ in (
|
|||
description = "Enable/disable colorful log output";
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
extraOptions = {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = ''
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ in {
|
|||
flavor = mkOption {
|
||||
type = enum [
|
||||
"plaintex"
|
||||
"context"
|
||||
"contex"
|
||||
"tex"
|
||||
];
|
||||
default = "plaintex";
|
||||
|
|
|
|||
|
|
@ -5,15 +5,7 @@
|
|||
}: let
|
||||
defaultPdfViewerName = "okular";
|
||||
|
||||
inherit
|
||||
(builtins)
|
||||
filter
|
||||
isAttrs
|
||||
hasAttr
|
||||
attrNames
|
||||
length
|
||||
elemAt
|
||||
;
|
||||
inherit (builtins) filter isAttrs hasAttr attrNames length elemAt;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) str package listOf;
|
||||
|
|
@ -32,9 +24,13 @@
|
|||
pdfViewerNamesList ? (
|
||||
filter (
|
||||
x: let
|
||||
y = viewerCfg."${x}";
|
||||
y = viewerCfg.${x};
|
||||
in (
|
||||
isAttrs y && hasAttr "enable" y && hasAttr "package" y && hasAttr "executable" y && hasAttr "args" y
|
||||
isAttrs y
|
||||
&& hasAttr "enable" y
|
||||
&& hasAttr "package" y
|
||||
&& hasAttr "executable" y
|
||||
&& hasAttr "args" y
|
||||
)
|
||||
) (attrNames viewerCfg)
|
||||
),
|
||||
|
|
@ -44,7 +40,7 @@
|
|||
currentPdfViewerName = elemAt pdfViewerNamesList index;
|
||||
|
||||
# Get the current pdf viewer object
|
||||
currentPdfViewer = viewerCfg."${currentPdfViewerName}";
|
||||
currentPdfViewer = viewerCfg.${currentPdfViewerName};
|
||||
|
||||
# Get the index that will be used for the next iteration
|
||||
nextIndex = index + 1;
|
||||
|
|
@ -81,7 +77,7 @@
|
|||
};
|
||||
in (getEnabledPdfViewersInfo {});
|
||||
|
||||
enabledPdfViewerCfg = viewerCfg."${enabledPdfViewersInfo.enabledViewerName}";
|
||||
enabledPdfViewerCfg = viewerCfg.${enabledPdfViewersInfo.enabledViewerName};
|
||||
in {
|
||||
imports = [
|
||||
./custom.nix
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
{
|
||||
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" "<leader>lvt";
|
||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
|
||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,13 @@
|
|||
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
|
||||
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.
|
||||
'')
|
||||
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
|
||||
'';
|
||||
}
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["otter-nvim"];
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
{lib, ...}: let
|
||||
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;
|
||||
inherit (lib.types) nullOr str bool;
|
||||
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
|
||||
in {
|
||||
imports = let
|
||||
renameSetupOpt = oldPath: newPath:
|
||||
|
|
@ -54,100 +50,68 @@ in {
|
|||
usePicker = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether we should use `dressing.nvim` to build a session picker UI
|
||||
'';
|
||||
description = "Whether or not we should use dressing.nvim to build a session picker UI";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "which-key" {
|
||||
setupOpts = {
|
||||
path_replacer = mkOption {
|
||||
type = str;
|
||||
type = types.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 = str;
|
||||
type = types.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 = 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;
|
||||
type = types.enum ["Disabled" "CurrentDir" "LastSession"];
|
||||
default = "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.
|
||||
'';
|
||||
description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession";
|
||||
};
|
||||
|
||||
max_path_length = mkOption {
|
||||
type = nullOr int;
|
||||
type = types.nullOr types.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 = bool;
|
||||
type = types.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 = bool;
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Plugin will not save a session when no buffers are opened, or all of them are
|
||||
not writable or listed
|
||||
'';
|
||||
description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed";
|
||||
};
|
||||
|
||||
autosave_ignore_dirs = mkOption {
|
||||
type = listOf str;
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "A list of directories where the session will not be autosaved";
|
||||
};
|
||||
|
||||
autosave_ignore_filetypes = mkOption {
|
||||
type = listOf str;
|
||||
type = types.listOf types.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 = listOf str;
|
||||
type = types.listOf types.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 = bool;
|
||||
type = types.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,17 +21,6 @@
|
|||
"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,20 +195,4 @@ 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,20 +4,22 @@
|
|||
...
|
||||
}: 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-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})
|
||||
'';
|
||||
};
|
||||
vim.pluginRC.vim-illuminate = entryAnywhere ''
|
||||
require('illuminate').configure({
|
||||
filetypes_denylist = {
|
||||
'dirvish',
|
||||
'fugitive',
|
||||
'NvimTree',
|
||||
'TelescopePrompt',
|
||||
},
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) listOf str;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.ui.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`";
|
||||
};
|
||||
};
|
||||
enable = mkEnableOption "automatically highlight other uses of the word under the cursor [vim-illuminate]";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,24 +3,19 @@
|
|||
./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
|
||||
./yazi-nvim
|
||||
./leetcode-nvim
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.utility.direnv;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["direnv-vim"];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./direnv.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.direnv.enable = mkEnableOption "syncing nvim shell environment with direnv's using `direnv.vim`";
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./harpoon.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
{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
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.vim.utility.mkdir;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["mkdir-nvim"];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./mkdir.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{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`
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.vim.utility.nix-develop;
|
||||
in {
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["nix-develop-nvim"];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nix-develop.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{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,7 +11,6 @@
|
|||
|
||||
cfg = config.vim.utility.yanky-nvim;
|
||||
usingSqlite = cfg.setupOpts.ring.storage == "sqlite";
|
||||
usingShada = cfg.setupOpts.ring.storage == "shada";
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
|
|
@ -29,15 +28,5 @@ 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,14 +1,13 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
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 = mkPluginSetupOption "yanky-nvim" {
|
||||
setupOpts = {
|
||||
ring.storage = mkOption {
|
||||
type = enum ["shada" "sqlite" "memory"];
|
||||
default = "shada";
|
||||
|
|
@ -16,11 +15,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.
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
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;})
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./yazi-nvim.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
{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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -172,14 +172,7 @@
|
|||
description = "Lazy-load on colorscheme.";
|
||||
};
|
||||
|
||||
lazy = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Force enable/disable lazy-loading. `null` means only lazy-load if
|
||||
a valid lazy-load condition is set e.g. `cmd`, `ft`, `keys` etc.
|
||||
'';
|
||||
};
|
||||
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
|
||||
|
||||
priority = mkOption {
|
||||
type = nullOr int;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue