mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
Merge remote-tracking branch 'origin/main' into v0.8
This commit is contained in:
commit
e1ad7f4fb9
49 changed files with 1338 additions and 727 deletions
|
@ -5,11 +5,12 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.attrsets) optionalAttrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||
inherit (lib.lists) map optional elem;
|
||||
inherit (lib.lists) map optional optionals elem;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs removeAttrs;
|
||||
|
||||
cfg = config.vim.autocomplete.blink-cmp;
|
||||
cmpCfg = config.vim.autocomplete.nvim-cmp;
|
||||
|
@ -55,7 +56,7 @@ in {
|
|||
after =
|
||||
# lua
|
||||
''
|
||||
${optionalString config.vim.lazy.enable
|
||||
${optionalString (config.vim.lazy.enable && cmpCfg.enable)
|
||||
(concatStringsSep "\n" (map
|
||||
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
|
||||
cmpCfg.sourcePlugins))}
|
||||
|
@ -66,7 +67,10 @@ in {
|
|||
autocomplete = {
|
||||
enableSharedCmpSources = true;
|
||||
blink-cmp.setupOpts = {
|
||||
sources = {
|
||||
sources = let
|
||||
# We do not want nvim-cmp compat sources overriding built-in blink sources
|
||||
filteredCmpSources = removeAttrs cmpCfg.sources blinkBuiltins;
|
||||
in {
|
||||
default =
|
||||
[
|
||||
"lsp"
|
||||
|
@ -74,14 +78,16 @@ in {
|
|||
"snippets"
|
||||
"buffer"
|
||||
]
|
||||
++ (attrNames cmpCfg.sources)
|
||||
++ optionals cmpCfg.enable (attrNames filteredCmpSources)
|
||||
++ (attrNames enabledBlinkSources);
|
||||
providers =
|
||||
mapAttrs (name: _: {
|
||||
inherit name;
|
||||
module = "blink.compat.source";
|
||||
})
|
||||
cmpCfg.sources
|
||||
optionalAttrs cmpCfg.enable (
|
||||
mapAttrs (name: _: {
|
||||
inherit name;
|
||||
module = "blink.compat.source";
|
||||
})
|
||||
filteredCmpSources
|
||||
)
|
||||
// (mapAttrs (name: definition: {
|
||||
inherit name;
|
||||
inherit (definition) module;
|
||||
|
|
|
@ -3,46 +3,47 @@
|
|||
inherit (lib.types) listOf attrs bool enum str oneOf int;
|
||||
in {
|
||||
options.vim.dashboard.startify = {
|
||||
enable = mkEnableOption "dashboard via vim-startify";
|
||||
enable = mkEnableOption "fancy start screen for Vim [vim-startify]";
|
||||
|
||||
bookmarks = mkOption {
|
||||
default = [];
|
||||
description = ''List of book marks to display on start page'';
|
||||
type = listOf attrs;
|
||||
default = [];
|
||||
example = {"c" = "~/.vimrc";};
|
||||
description = "List of book marks to display on start page";
|
||||
};
|
||||
|
||||
changeToDir = mkOption {
|
||||
default = true;
|
||||
description = "Should vim change to the directory of the file you open";
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether Vim should change to the directory of the file you open";
|
||||
};
|
||||
|
||||
changeToVCRoot = mkOption {
|
||||
default = false;
|
||||
description = "Should vim change to the version control root when opening a file";
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether Vim should change to the version control root when opening a file";
|
||||
};
|
||||
|
||||
changeDirCmd = mkOption {
|
||||
default = "lcd";
|
||||
description = "Command to change the current window with. Can be cd, lcd or tcd";
|
||||
type = enum ["cd" "lcd" "tcd"];
|
||||
default = "lcd";
|
||||
description = "Command to change the current window with.";
|
||||
};
|
||||
|
||||
customHeader = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Text to place in the header";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
customFooter = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Text to place in the footer";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
lists = mkOption {
|
||||
type = listOf attrs;
|
||||
default = [
|
||||
{
|
||||
type = "files";
|
||||
|
@ -66,121 +67,136 @@ in {
|
|||
}
|
||||
];
|
||||
description = "Specify the lists and in what order they are displayed on startify.";
|
||||
type = listOf attrs;
|
||||
};
|
||||
|
||||
skipList = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of regex patterns to exclude from MRU lists";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
updateOldFiles = mkOption {
|
||||
type = bool;
|
||||
|
||||
default = false;
|
||||
description = "Set if you want startify to always update and not just when neovim closes";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionAutoload = mkOption {
|
||||
default = false;
|
||||
description = "Make startify auto load Session.vim files from the current directory";
|
||||
type = bool;
|
||||
|
||||
default = false;
|
||||
description = "Make vim-startify auto load Session.vim files from the current directory";
|
||||
};
|
||||
|
||||
commands = mkOption {
|
||||
type = listOf (oneOf [str attrs (listOf str)]);
|
||||
default = [];
|
||||
description = "Commands that are presented to the user on startify page";
|
||||
type = listOf (oneOf [str attrs (listOf str)]);
|
||||
};
|
||||
|
||||
filesNumber = mkOption {
|
||||
type = int;
|
||||
default = 10;
|
||||
description = "How many files to list";
|
||||
type = int;
|
||||
};
|
||||
|
||||
customIndices = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Specify a list of default characters to use instead of numbers";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
disableOnStartup = mkOption {
|
||||
default = false;
|
||||
description = "Prevent startify from opening on startup but can be called with :Startify";
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether vim-startify should be disabled on startup.
|
||||
|
||||
This will prevent startify from opening on startup, but it can still
|
||||
be called with `:Startify`
|
||||
'';
|
||||
};
|
||||
|
||||
unsafe = mkOption {
|
||||
default = false;
|
||||
description = "Turns on unsafe mode for Startify. Stops resolving links, checking files are readable and filtering bookmark list";
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to turn on unsafe mode for Startify.
|
||||
|
||||
While enabld, vim-startify will stops resolving links, checking files
|
||||
are readable and filtering bookmark list
|
||||
'';
|
||||
};
|
||||
|
||||
paddingLeft = mkOption {
|
||||
type = int;
|
||||
default = 3;
|
||||
description = "Number of spaces used for left padding.";
|
||||
type = int;
|
||||
};
|
||||
|
||||
useEnv = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Show environment variables in path if name is shorter than value";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionBeforeSave = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Commands to run before saving a session";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionPersistence = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Persist session before leaving vim or switching session";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionDeleteBuffers = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Delete all buffers when loading or closing a session";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
sessionDir = mkOption {
|
||||
type = str;
|
||||
default = "~/.vim/session";
|
||||
description = "Directory to save and load sessions from";
|
||||
type = str;
|
||||
};
|
||||
|
||||
skipListServer = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of vim servers to not load startify for";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionRemoveLines = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "Patterns to remove from session files";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionSavevars = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of variables to save into a session file.";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionSavecmds = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
description = "List of commands to run when loading a session.";
|
||||
type = listOf str;
|
||||
};
|
||||
|
||||
sessionSort = mkOption {
|
||||
default = false;
|
||||
description = "Set if you want items sorted by date rather than alphabetically";
|
||||
type = bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
While true, sessions will be sorted by date rather than alphabetically.
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
in {
|
||||
imports = [
|
||||
./gitsigns
|
||||
./hunk-nvim
|
||||
./vim-fugitive
|
||||
./git-conflict
|
||||
./gitlinker-nvim
|
||||
|
@ -14,7 +15,9 @@ in {
|
|||
git integration suite.
|
||||
|
||||
Enabling this option will enable the following plugins:
|
||||
|
||||
* gitsigns
|
||||
* hunk-nvim
|
||||
* vim-fugitive
|
||||
* git-conflict
|
||||
* gitlinker-nvim
|
||||
|
|
27
modules/plugins/git/hunk-nvim/config.nix
Normal file
27
modules/plugins/git/hunk-nvim/config.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.git.hunk-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [
|
||||
# dependencies
|
||||
"nui-nvim" # ui library
|
||||
"nvim-web-devicons" # glyphs
|
||||
];
|
||||
|
||||
lazy.plugins = {
|
||||
"hunk-nvim" = {
|
||||
package = "hunk-nvim";
|
||||
setupModule = "hunk";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/git/hunk-nvim/default.nix
Normal file
6
modules/plugins/git/hunk-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./hunk-nvim.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
13
modules/plugins/git/hunk-nvim/hunk-nvim.nix
Normal file
13
modules/plugins/git/hunk-nvim/hunk-nvim.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.git.hunk-nvim = {
|
||||
enable = mkEnableOption "tool for splitting diffs in Neovim [hunk-nvim]" // {default = config.vim.git.enable;};
|
||||
setupOpts = mkPluginSetupOption "hunk-nvim" {};
|
||||
};
|
||||
}
|
|
@ -15,13 +15,6 @@
|
|||
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.
|
||||
'')
|
||||
];
|
||||
vim = {
|
||||
startPlugins = ["otter-nvim"];
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ in {
|
|||
type = listOf package;
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
regex
|
||||
kdl
|
||||
];
|
||||
|
@ -33,6 +33,7 @@ in {
|
|||
description = ''
|
||||
List of treesitter grammars to install. For grammars to be installed properly,
|
||||
you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`.
|
||||
You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars.
|
||||
|
||||
For languages already supported by nvf, you may use
|
||||
{option}`vim.language.<lang>.treesitter` options, which will automatically add
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.ui.colorful-menu-nvim = {
|
||||
enable = mkEnableOption "treesitter highlighted completion menus [colorful-menu.nvim]";
|
||||
setupOpts = mkPluginSetupOption "colorful-menu-nvim" {};
|
||||
};
|
||||
}
|
20
modules/plugins/ui/colorful-menu-nvim/config.nix
Normal file
20
modules/plugins/ui/colorful-menu-nvim/config.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.ui.colorful-menu-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["colorful-menu-nvim"];
|
||||
pluginRC.colorful-menu-nvim = entryAnywhere ''
|
||||
require("colorful-menu").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/ui/colorful-menu-nvim/default.nix
Normal file
6
modules/plugins/ui/colorful-menu-nvim/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./colorful-menu-nvim.nix
|
||||
];
|
||||
}
|
|
@ -1,14 +1,15 @@
|
|||
{
|
||||
imports = [
|
||||
./noice
|
||||
./modes
|
||||
./nvim-ufo
|
||||
./notifications
|
||||
./smartcolumn
|
||||
./colorizer
|
||||
./illuminate
|
||||
./breadcrumbs
|
||||
./borders
|
||||
./breadcrumbs
|
||||
./colorful-menu-nvim
|
||||
./colorizer
|
||||
./fastaction
|
||||
./illuminate
|
||||
./modes
|
||||
./noice
|
||||
./notifications
|
||||
./nvim-ufo
|
||||
./smartcolumn
|
||||
];
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
./multicursors
|
||||
./new-file-template
|
||||
./nix-develop
|
||||
./nvim-biscuits
|
||||
./oil-nvim
|
||||
./outline
|
||||
./preview
|
||||
|
@ -27,5 +28,6 @@
|
|||
./wakatime
|
||||
./yanky-nvim
|
||||
./yazi-nvim
|
||||
./undotree
|
||||
];
|
||||
}
|
||||
|
|
20
modules/plugins/utility/nvim-biscuits/config.nix
Normal file
20
modules/plugins/utility/nvim-biscuits/config.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
cfg = config.vim.utility.nvim-biscuits;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-biscuits"];
|
||||
|
||||
pluginRC.nvim-biscuits = entryAnywhere ''
|
||||
require('nvim-biscuits').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/nvim-biscuits/default.nix
Normal file
6
modules/plugins/utility/nvim-biscuits/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nvim-biscuits.nix
|
||||
];
|
||||
}
|
10
modules/plugins/utility/nvim-biscuits/nvim-biscuits.nix
Normal file
10
modules/plugins/utility/nvim-biscuits/nvim-biscuits.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.utility.nvim-biscuits = {
|
||||
enable = mkEnableOption "a Neovim port of Assorted Biscuits [nvim-biscuits]";
|
||||
|
||||
setupOpts = mkPluginSetupOption "nvim-biscuits" {};
|
||||
};
|
||||
}
|
22
modules/plugins/utility/undotree/config.nix
Normal file
22
modules/plugins/utility/undotree/config.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
|
||||
cfg = config.vim.utility.undotree;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.lazy.plugins.undotree = {
|
||||
package = "undotree";
|
||||
cmd = [
|
||||
"UndotreeToggle"
|
||||
"UndotreeShow"
|
||||
"UndotreeHide"
|
||||
"UndotreePersistUndo"
|
||||
"UndotreeFocus"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/utility/undotree/default.nix
Normal file
6
modules/plugins/utility/undotree/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./undotree.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
7
modules/plugins/utility/undotree/undotree.nix
Normal file
7
modules/plugins/utility/undotree/undotree.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in {
|
||||
options.vim.utility.undotree = {
|
||||
enable = mkEnableOption "undo history visualizer for Vim [undotree]";
|
||||
};
|
||||
}
|
|
@ -33,32 +33,33 @@ in {
|
|||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
# absolute path, as a string - impure
|
||||
# Absolute path, as a string. This is the impure option.
|
||||
"$HOME/.config/nvim-extra"
|
||||
|
||||
# relative path, as a path - pure
|
||||
# Relative path inside your configuration. If your config
|
||||
# is version controlled, then this is pure and reproducible.
|
||||
./nvim
|
||||
|
||||
# source type path - pure and reproducible
|
||||
(builtins.source {
|
||||
path = ./runtime;
|
||||
name = "nvim-runtime";
|
||||
# Source type path. This pure and reproducible.
|
||||
# See `:doc builtins.path` inside a Nix repl for more options.
|
||||
(builtins.path {
|
||||
path = ./runtime; # this must be a relative path
|
||||
name = "nvim-runtime"; # name is arbitrary
|
||||
})
|
||||
]
|
||||
'';
|
||||
|
||||
description = ''
|
||||
Additional runtime paths that will be appended to the
|
||||
active runtimepath of the Neovim. This can be used to
|
||||
add additional lookup paths for configs, plugins, spell
|
||||
languages and other things you would generally place in
|
||||
your {file}`$HOME/.config/nvim`.
|
||||
Additional runtime paths that will be appended to the active
|
||||
runtimepath of the Neovim. This can be used to add additional
|
||||
lookup paths for configs, plugins, spell languages and other
|
||||
things you would generally place in your {file}`$HOME/.config/nvim`.
|
||||
|
||||
This is meant as a declarative alternative to throwing
|
||||
files into {file}`~/.config/nvim` and having the Neovim
|
||||
wrapper pick them up. For more details on
|
||||
`vim.o.runtimepath`, and what paths to use; please see
|
||||
[the official documentation](https://neovim.io/doc/user/options.html#'runtimepath')
|
||||
This is meant as a declarative alternative to throwing files into
|
||||
{file}`~/.config/nvim` and having the Neovim wrapper pick them up.
|
||||
|
||||
For more details on `vim.o.runtimepath`, and what paths to use, please see
|
||||
[the official documentation](https://neovim.io/doc/user/options.html#'runtimepath').
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -67,13 +68,13 @@ in {
|
|||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
# absolute path, as a string - impure
|
||||
# Absolute path, as a string - impure
|
||||
"$HOME/.config/nvim/my-lua-file.lua"
|
||||
|
||||
# relative path, as a path - pure
|
||||
# Relative path, as a path - pure
|
||||
./nvim/my-lua-file.lua
|
||||
|
||||
# source type path - pure and reproducible
|
||||
# Source type path - pure and reproducible
|
||||
(builtins.path {
|
||||
path = ./nvim/my-lua-file.lua;
|
||||
name = "my-lua-file";
|
||||
|
@ -82,9 +83,10 @@ in {
|
|||
'';
|
||||
|
||||
description = ''
|
||||
Additional lua files that will be sourced by Neovim.
|
||||
Takes both absolute and relative paths, all of which
|
||||
will be called via the `luafile` command in Neovim.
|
||||
Additional Lua files that will be sourced by Neovim.
|
||||
|
||||
Takes both absolute and relative paths, all of which will be called
|
||||
via the `luafile` command in Neovim.
|
||||
|
||||
See [lua-commands](https://neovim.io/doc/user/lua.html#lua-commands)
|
||||
on the Neovim documentation for more details.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue