From a07e113f3a3cc572e1ccfddae44b37003290158d Mon Sep 17 00:00:00 2001
From: Charlie Root
Date: Tue, 12 Nov 2024 10:39:31 +0100
Subject: [PATCH 01/88] theme/supported-themes.nix: fix themes
Make all themes work by adding `...` to every theme attrset.
---
modules/plugins/theme/supported-themes.nix | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix
index ca539b1d..e185eb0d 100644
--- a/modules/plugins/theme/supported-themes.nix
+++ b/modules/plugins/theme/supported-themes.nix
@@ -93,6 +93,7 @@ in {
setup = {
style ? "dark",
transparent ? false,
+ ...
}: let
style' =
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
@@ -117,6 +118,7 @@ in {
setup = {
style ? "dark",
transparent ? false,
+ ...
}: ''
-- Gruvbox theme
require("gruvbox").setup({
@@ -152,6 +154,7 @@ in {
setup = {
style ? "main",
transparent ? false,
+ ...
}: ''
require("rose-pine").setup({
dark_variant = "${style}", -- main, moon, or dawn
From 947cf90878155f2b37f458188d28f9af9a4eb906 Mon Sep 17 00:00:00 2001
From: diniamo
Date: Tue, 12 Nov 2024 22:34:13 +0100
Subject: [PATCH 02/88] flake: provide dev package
---
flake.nix | 16 ++--------------
flake/develop.nix | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 14 deletions(-)
create mode 100644 flake/develop.nix
diff --git a/flake.nix b/flake.nix
index 875fa432..4e417e7f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -21,6 +21,7 @@
./flake/legacyPackages.nix
./flake/overlays.nix
./flake/packages.nix
+ ./flake/develop.nix
];
flake = {
@@ -56,20 +57,7 @@
};
};
- perSystem = {
- self',
- config,
- pkgs,
- ...
- }: {
- devShells = {
- default = self'.devShells.lsp;
- nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
- lsp = pkgs.mkShell {
- packages = with pkgs; [nil statix deadnix alejandra];
- };
- };
-
+ perSystem = {pkgs, ...}: {
# Provide the default formatter. `nix fmt` in project root
# will format available files with the correct formatter.
# P.S: Please do not format with nixfmt! It messes with many
diff --git a/flake/develop.nix b/flake/develop.nix
new file mode 100644
index 00000000..7b645288
--- /dev/null
+++ b/flake/develop.nix
@@ -0,0 +1,30 @@
+{lib, ...}: {
+ perSystem = {
+ pkgs,
+ config,
+ self',
+ ...
+ }: {
+ devShells = {
+ default = self'.devShells.lsp;
+ nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];};
+ lsp = pkgs.mkShellNoCC {
+ packages = with pkgs; [nil statix deadnix alejandra];
+ };
+ };
+
+ # This package exists to make development easier by providing the place and
+ # boilerplate to build a test nvf configuration. Feel free to use this for
+ # testing, but make sure to discard the changes before creating a pull
+ # request.
+ packages.dev = let
+ configuration = {};
+
+ customNeovim = lib.nvim.neovimConfiguration {
+ inherit pkgs;
+ modules = [configuration];
+ };
+ in
+ customNeovim.neovim;
+ };
+}
From e39d469da9fc6ba845c0956c446572561a0da2d4 Mon Sep 17 00:00:00 2001
From: diniamo
Date: Tue, 12 Nov 2024 22:35:03 +0100
Subject: [PATCH 03/88] nvim-cmp: allow passing null to format
Not adding special cases to where it's used shouldn't break anything.
---
modules/plugins/completion/nvim-cmp/nvim-cmp.nix | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/plugins/completion/nvim-cmp/nvim-cmp.nix b/modules/plugins/completion/nvim-cmp/nvim-cmp.nix
index d63ed732..06282b6e 100644
--- a/modules/plugins/completion/nvim-cmp/nvim-cmp.nix
+++ b/modules/plugins/completion/nvim-cmp/nvim-cmp.nix
@@ -72,7 +72,7 @@ in {
};
format = mkOption {
- type = luaInline;
+ type = nullOr luaInline;
default = mkLuaInline ''
function(entry, vim_item)
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]
From 1df720f86c8c9be1e47b4cebd4da49369c7e4f83 Mon Sep 17 00:00:00 2001
From: diniamo
Date: Tue, 12 Nov 2024 22:35:09 +0100
Subject: [PATCH 04/88] nvim-cmp: use border style
---
.../plugins/completion/nvim-cmp/config.nix | 22 ++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/modules/plugins/completion/nvim-cmp/config.nix b/modules/plugins/completion/nvim-cmp/config.nix
index b50d7266..6835807e 100644
--- a/modules/plugins/completion/nvim-cmp/config.nix
+++ b/modules/plugins/completion/nvim-cmp/config.nix
@@ -3,13 +3,26 @@
config,
...
}: let
- inherit (lib.modules) mkIf mkMerge;
+ inherit (lib.modules) mkIf mkMerge mkDefault;
inherit (lib.strings) optionalString;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.attrsets) mapListToAttrs;
inherit (builtins) attrNames typeOf tryEval concatStringsSep;
+ borders = config.vim.ui.borders.plugins.nvim-cmp;
+ # From https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/config/window.lua
+ # This way users can still override the options
+ windowOpts = {
+ border = borders.style;
+ winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
+ zindex = 1001;
+ scrolloff = 0;
+ col_offset = 0;
+ side_padding = 1;
+ scrollbar = true;
+ };
+
cfg = config.vim.autocomplete.nvim-cmp;
luasnipEnable = config.vim.snippets.luasnip.enable;
getPluginName = plugin:
@@ -81,10 +94,9 @@ in {
setupOpts = {
sources = map (s: {name = s;}) (attrNames cfg.sources);
- # TODO: try to get nvim-cmp to follow global border style
- window = mkIf config.vim.ui.borders.enable {
- completion = mkLuaInline "cmp.config.window.bordered()";
- documentation = mkLuaInline "cmp.config.window.bordered()";
+ window = mkIf borders.enable {
+ completion = mkDefault windowOpts;
+ documentation = mkDefault windowOpts;
};
formatting.format = cfg.format;
From 7a5c75b8652caa4a61700b6d2dcc641fdfed8ba1 Mon Sep 17 00:00:00 2001
From: diniamo
Date: Wed, 13 Nov 2024 18:41:32 +0100
Subject: [PATCH 05/88] nvim-cmp: fix use of mkDefault for borders
---
modules/plugins/completion/nvim-cmp/config.nix | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/modules/plugins/completion/nvim-cmp/config.nix b/modules/plugins/completion/nvim-cmp/config.nix
index 6835807e..cfd3e53a 100644
--- a/modules/plugins/completion/nvim-cmp/config.nix
+++ b/modules/plugins/completion/nvim-cmp/config.nix
@@ -3,7 +3,7 @@
config,
...
}: let
- inherit (lib.modules) mkIf mkMerge mkDefault;
+ inherit (lib.modules) mkIf mkMerge;
inherit (lib.strings) optionalString;
inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) toLuaObject;
@@ -11,17 +11,6 @@
inherit (builtins) attrNames typeOf tryEval concatStringsSep;
borders = config.vim.ui.borders.plugins.nvim-cmp;
- # From https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/config/window.lua
- # This way users can still override the options
- windowOpts = {
- border = borders.style;
- winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
- zindex = 1001;
- scrolloff = 0;
- col_offset = 0;
- side_padding = 1;
- scrollbar = true;
- };
cfg = config.vim.autocomplete.nvim-cmp;
luasnipEnable = config.vim.snippets.luasnip.enable;
@@ -95,8 +84,8 @@ in {
sources = map (s: {name = s;}) (attrNames cfg.sources);
window = mkIf borders.enable {
- completion = mkDefault windowOpts;
- documentation = mkDefault windowOpts;
+ completion.border = borders.style;
+ documentation.border = borders.style;
};
formatting.format = cfg.format;
From 2aad0fb838eb047788d6367da392845602ff5a4e Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Sun, 10 Nov 2024 23:57:00 +0100
Subject: [PATCH 06/88] lazy: remove defaults for keys
---
modules/wrapper/lazy/lazy.nix | 1 -
1 file changed, 1 deletion(-)
diff --git a/modules/wrapper/lazy/lazy.nix b/modules/wrapper/lazy/lazy.nix
index 2bbda27c..c51b3f36 100644
--- a/modules/wrapper/lazy/lazy.nix
+++ b/modules/wrapper/lazy/lazy.nix
@@ -36,7 +36,6 @@
mode = mkOption {
description = "Modes to bind in";
type = either str (listOf str);
- default = ["n" "x" "s" "o"];
};
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding to a map.";
From 0b0bbfd3480d0582d4ce8f8fac470e8e63ec8234 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Mon, 11 Nov 2024 00:44:13 +0100
Subject: [PATCH 07/88] lazy: add missing load() wrapper
---
modules/wrapper/lazy/config.nix | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix
index 01deeb0f..5d4a9267 100644
--- a/modules/wrapper/lazy/config.nix
+++ b/modules/wrapper/lazy/config.nix
@@ -50,6 +50,16 @@
end
'';
+ load =
+ if spec.load != null
+ then
+ mkLuaInline ''
+ funcion()
+ ${spec.load}
+ end
+ ''
+ else null;
+
keys =
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
From 22cfec78db7c96760db0af9e1dd7777b556329b6 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Mon, 11 Nov 2024 00:45:36 +0100
Subject: [PATCH 08/88] lazy: re-order options for consistency
---
modules/wrapper/lazy/lazy.nix | 89 +++++++++++++++++------------------
1 file changed, 44 insertions(+), 45 deletions(-)
diff --git a/modules/wrapper/lazy/lazy.nix b/modules/wrapper/lazy/lazy.nix
index c51b3f36..a34b556b 100644
--- a/modules/wrapper/lazy/lazy.nix
+++ b/modules/wrapper/lazy/lazy.nix
@@ -22,20 +22,20 @@
'';
desc = mkOption {
- description = "Description of the key map";
type = nullOr str;
default = null;
+ description = "Description of the key map";
};
ft = mkOption {
- description = "TBD";
type = nullOr (listOf str);
default = null;
+ description = "TBD";
};
mode = mkOption {
- description = "Modes to bind in";
type = either str (listOf str);
+ description = "Modes to bind in";
};
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding to a map.";
@@ -47,6 +47,21 @@
};
};
+ lznEvent = submodule {
+ options = {
+ event = mkOption {
+ type = nullOr (either str (listOf str));
+ example = "BufEnter";
+ description = "Exact event name";
+ };
+ pattern = mkOption {
+ type = nullOr (either str (listOf str));
+ example = "BufEnter *.lua";
+ description = "Event pattern";
+ };
+ };
+ };
+
lznPluginType = submodule {
options = {
package = mkOption {
@@ -56,84 +71,67 @@
setupModule = mkOption {
type = nullOr str;
- description = "Lua module to run setup function on.";
default = null;
+ description = "Lua module to run setup function on.";
};
setupOpts = mkOption {
type = attrsOf anything;
- description = "Options to pass to the setup function";
default = {};
+ description = "Options to pass to the setup function";
};
# lz.n options
enabled = mkOption {
type = nullOr (either bool str);
- description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
default = null;
+ description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
};
beforeAll = mkOption {
type = nullOr lines;
- description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
default = null;
+ description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
};
before = mkOption {
type = nullOr lines;
- description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
default = null;
+ description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
};
after = mkOption {
type = nullOr lines;
+ default = null;
description = ''
Lua code to run after plugin is loaded. This will be wrapped in a function.
If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`.
'';
- default = null;
};
event = mkOption {
- description = "Lazy-load on event";
+ type = nullOr (oneOf [str (listOf str) lznEvent]);
default = null;
- type = let
- event = submodule {
- options = {
- event = mkOption {
- type = nullOr (either str (listOf str));
- description = "Exact event name";
- example = "BufEnter";
- };
- pattern = mkOption {
- type = nullOr (either str (listOf str));
- description = "Event pattern";
- example = "BufEnter *.lua";
- };
- };
- };
- in
- nullOr (oneOf [str (listOf str) event]);
+ description = "Lazy-load on event";
};
cmd = mkOption {
- description = "Lazy-load on command";
- default = null;
type = nullOr (either str (listOf str));
+ default = null;
+ description = "Lazy-load on command";
};
ft = mkOption {
- description = "Lazy-load on filetype";
- default = null;
type = nullOr (either str (listOf str));
+ default = null;
+ description = "Lazy-load on filetype";
};
keys = mkOption {
- description = "Lazy-load on key mapping";
- default = null;
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
+ default = null;
example = ''
keys = [
{
@@ -151,20 +149,21 @@
}
]
'';
+ description = "Lazy-load on key mapping";
};
colorscheme = mkOption {
- description = "Lazy-load on colorscheme.";
type = nullOr (either str (listOf str));
default = null;
+ description = "Lazy-load on colorscheme.";
};
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
priority = mkOption {
type = nullOr int;
- description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
default = null;
+ description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
};
load = mkOption {
@@ -182,20 +181,14 @@ in {
options.vim.lazy = {
enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;};
loader = mkOption {
- description = "Lazy loader to use";
type = enum ["lz.n"];
default = "lz.n";
+ description = "Lazy loader to use";
};
plugins = mkOption {
- default = {};
type = attrsOf lznPluginType;
- description = ''
- Plugins to lazy load.
-
- The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
- function this should be either the `package.pname` or `package.name`.
- '';
+ default = {};
example = ''
{
toggleterm-nvim = {
@@ -213,15 +206,21 @@ in {
};
}
'';
+ description = ''
+ Plugins to lazy load.
+
+ The attribute key is used as the plugin name: for the default `vim.g.lz_n.load`
+ function this should be either the `package.pname` or `package.name`.
+ '';
};
enableLznAutoRequire = mkOption {
+ type = bool;
+ default = true;
description = ''
Enable lzn-auto-require. Since builtin plugins rely on this, only turn
off for debugging.
'';
- type = bool;
- default = true;
};
builtLazyConfig = mkOption {
From a79827f1f339e2fdef5aefd021722ec50afec557 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Mon, 11 Nov 2024 00:45:56 +0100
Subject: [PATCH 09/88] lazy: add key.mode example
---
modules/wrapper/lazy/lazy.nix | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules/wrapper/lazy/lazy.nix b/modules/wrapper/lazy/lazy.nix
index a34b556b..56ec0022 100644
--- a/modules/wrapper/lazy/lazy.nix
+++ b/modules/wrapper/lazy/lazy.nix
@@ -35,6 +35,7 @@
mode = mkOption {
type = either str (listOf str);
+ example = ["n" "x" "o"];
description = "Modes to bind in";
};
From 2df52f6ec47a8a33ff9324e1aea54cc260e46067 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Mon, 11 Nov 2024 00:46:12 +0100
Subject: [PATCH 10/88] lazy: remove unused imports
---
modules/wrapper/lazy/config.nix | 1 -
1 file changed, 1 deletion(-)
diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix
index 5d4a9267..36c18a9e 100644
--- a/modules/wrapper/lazy/config.nix
+++ b/modules/wrapper/lazy/config.nix
@@ -9,7 +9,6 @@
inherit (lib.generators) mkLuaInline;
inherit (lib.strings) optionalString;
inherit (lib.nvim.lua) toLuaObject;
- inherit (lib.nvim.dag) entryBefore entryAfter;
cfg = config.vim.lazy;
toLuaLznKeySpec = keySpec:
From 8099b9c821728901eea75234ed7f223df97fec82 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Mon, 11 Nov 2024 01:06:09 +0100
Subject: [PATCH 11/88] lib/binds: update lzn bind functions
---
lib/binds.nix | 8 ++--
modules/plugins/debugger/nvim-dap/config.nix | 2 +-
modules/plugins/lsp/trouble/config.nix | 12 +++---
.../plugins/terminal/toggleterm/config.nix | 1 +
modules/plugins/utility/telescope/config.nix | 38 +++++++++----------
5 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/lib/binds.nix b/lib/binds.nix
index 298cd30a..22bca735 100644
--- a/lib/binds.nix
+++ b/lib/binds.nix
@@ -79,14 +79,14 @@
expr = true;
};
- mkSetLznBinding = binding: action: {
- inherit action;
+ mkSetLznBinding = mode: binding: action: {
+ inherit action mode;
key = binding.value;
desc = binding.description;
};
- mkSetLuaLznBinding = binding: action: {
- inherit action;
+ mkSetLuaLznBinding = mode: binding: action: {
+ inherit action mode;
key = binding.value;
lua = true;
desc = binding.description;
diff --git a/modules/plugins/debugger/nvim-dap/config.nix b/modules/plugins/debugger/nvim-dap/config.nix
index 7e9e8f76..b99fb3d3 100644
--- a/modules/plugins/debugger/nvim-dap/config.nix
+++ b/modules/plugins/debugger/nvim-dap/config.nix
@@ -60,7 +60,7 @@ in {
inherit (cfg.ui) setupOpts;
keys = [
- (mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
+ (mkSetLuaLznBinding "n" mappings.toggleDapUI "function() require('dapui').toggle() end")
];
};
diff --git a/modules/plugins/lsp/trouble/config.nix b/modules/plugins/lsp/trouble/config.nix
index cae0c7ad..9bbc71c3 100644
--- a/modules/plugins/lsp/trouble/config.nix
+++ b/modules/plugins/lsp/trouble/config.nix
@@ -21,12 +21,12 @@ in {
cmd = "Trouble";
keys = [
- (mkSetLznBinding mappings.toggle "TroubleToggle")
- (mkSetLznBinding mappings.workspaceDiagnostics "TroubleToggle workspace_diagnostics")
- (mkSetLznBinding mappings.documentDiagnostics "TroubleToggle document_diagnostics")
- (mkSetLznBinding mappings.lspReferences "TroubleToggle lsp_references")
- (mkSetLznBinding mappings.quickfix "TroubleToggle quickfix")
- (mkSetLznBinding mappings.locList "TroubleToggle loclist")
+ (mkSetLznBinding "n" mappings.toggle "TroubleToggle")
+ (mkSetLznBinding "n" mappings.workspaceDiagnostics "TroubleToggle workspace_diagnostics")
+ (mkSetLznBinding "n" mappings.documentDiagnostics "TroubleToggle document_diagnostics")
+ (mkSetLznBinding "n" mappings.lspReferences "TroubleToggle lsp_references")
+ (mkSetLznBinding "n" mappings.quickfix "TroubleToggle quickfix")
+ (mkSetLznBinding "n" mappings.locList "TroubleToggle loclist")
];
};
diff --git a/modules/plugins/terminal/toggleterm/config.nix b/modules/plugins/terminal/toggleterm/config.nix
index f0ebd726..d3a71fbd 100644
--- a/modules/plugins/terminal/toggleterm/config.nix
+++ b/modules/plugins/terminal/toggleterm/config.nix
@@ -22,6 +22,7 @@ in {
[(mkLznBinding ["n"] cfg.mappings.open "execute v:count . \"ToggleTerm\"" "Toggle terminal")]
++ optional cfg.lazygit.enable {
key = cfg.lazygit.mappings.open;
+ mode = "n";
desc = lazygitMapDesc;
};
diff --git a/modules/plugins/utility/telescope/config.nix b/modules/plugins/utility/telescope/config.nix
index 61436279..d5881fae 100644
--- a/modules/plugins/utility/telescope/config.nix
+++ b/modules/plugins/utility/telescope/config.nix
@@ -34,36 +34,36 @@ in {
keys =
[
- (mkSetLznBinding mappings.findFiles " Telescope find_files")
- (mkSetLznBinding mappings.liveGrep " Telescope live_grep")
- (mkSetLznBinding mappings.buffers " Telescope buffers")
- (mkSetLznBinding mappings.helpTags " Telescope help_tags")
- (mkSetLznBinding mappings.open " Telescope")
+ (mkSetLznBinding "n" mappings.findFiles " Telescope find_files")
+ (mkSetLznBinding "n" mappings.liveGrep " Telescope live_grep")
+ (mkSetLznBinding "n" mappings.buffers " Telescope buffers")
+ (mkSetLznBinding "n" mappings.helpTags " Telescope help_tags")
+ (mkSetLznBinding "n" mappings.open " Telescope")
- (mkSetLznBinding mappings.gitCommits " Telescope git_commits")
- (mkSetLznBinding mappings.gitBufferCommits " Telescope git_bcommits")
- (mkSetLznBinding mappings.gitBranches " Telescope git_branches")
- (mkSetLznBinding mappings.gitStatus " Telescope git_status")
- (mkSetLznBinding mappings.gitStash " Telescope git_stash")
+ (mkSetLznBinding "n" mappings.gitCommits " Telescope git_commits")
+ (mkSetLznBinding "n" mappings.gitBufferCommits " Telescope git_bcommits")
+ (mkSetLznBinding "n" mappings.gitBranches " Telescope git_branches")
+ (mkSetLznBinding "n" mappings.gitStatus " Telescope git_status")
+ (mkSetLznBinding "n" mappings.gitStash " Telescope git_stash")
]
++ (optionals config.vim.lsp.enable [
- (mkSetLznBinding mappings.lspDocumentSymbols " Telescope lsp_document_symbols")
- (mkSetLznBinding mappings.lspWorkspaceSymbols " Telescope lsp_workspace_symbols")
+ (mkSetLznBinding "n" mappings.lspDocumentSymbols " Telescope lsp_document_symbols")
+ (mkSetLznBinding "n" mappings.lspWorkspaceSymbols " Telescope lsp_workspace_symbols")
- (mkSetLznBinding mappings.lspReferences " Telescope lsp_references")
- (mkSetLznBinding mappings.lspImplementations " Telescope lsp_implementations")
- (mkSetLznBinding mappings.lspDefinitions " Telescope lsp_definitions")
- (mkSetLznBinding mappings.lspTypeDefinitions " Telescope lsp_type_definitions")
- (mkSetLznBinding mappings.diagnostics " Telescope diagnostics")
+ (mkSetLznBinding "n" mappings.lspReferences " Telescope lsp_references")
+ (mkSetLznBinding "n" mappings.lspImplementations " Telescope lsp_implementations")
+ (mkSetLznBinding "n" mappings.lspDefinitions " Telescope lsp_definitions")
+ (mkSetLznBinding "n" mappings.lspTypeDefinitions " Telescope lsp_type_definitions")
+ (mkSetLznBinding "n" mappings.diagnostics " Telescope diagnostics")
])
++ (
optionals config.vim.treesitter.enable [
- (mkSetLznBinding mappings.treesitter " Telescope treesitter")
+ (mkSetLznBinding "n" mappings.treesitter " Telescope treesitter")
]
)
++ (
optionals config.vim.projects.project-nvim.enable [
- (mkSetLznBinding mappings.findProjects "")
+ (mkSetLznBinding "n" mappings.findProjects "")
]
);
};
From 2bce0d957b9f3b89539be58aaed8492be2d09060 Mon Sep 17 00:00:00 2001
From: diniamo <55629891+diniamo@users.noreply.github.com>
Date: Fri, 15 Nov 2024 08:17:54 +0100
Subject: [PATCH 12/88] telescope: add missing mappings, cleanup (#469)
---
modules/plugins/utility/telescope/config.nix | 39 ++++++++++----------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/modules/plugins/utility/telescope/config.nix b/modules/plugins/utility/telescope/config.nix
index d5881fae..c94fe901 100644
--- a/modules/plugins/utility/telescope/config.nix
+++ b/modules/plugins/utility/telescope/config.nix
@@ -34,36 +34,37 @@ in {
keys =
[
- (mkSetLznBinding "n" mappings.findFiles " Telescope find_files")
- (mkSetLznBinding "n" mappings.liveGrep " Telescope live_grep")
- (mkSetLznBinding "n" mappings.buffers " Telescope buffers")
- (mkSetLznBinding "n" mappings.helpTags " Telescope help_tags")
- (mkSetLznBinding "n" mappings.open " Telescope")
+ (mkSetLznBinding "n" mappings.findFiles "Telescope find_files")
+ (mkSetLznBinding "n" mappings.liveGrep "Telescope live_grep")
+ (mkSetLznBinding "n" mappings.buffers "Telescope buffers")
+ (mkSetLznBinding "n" mappings.helpTags "Telescope help_tags")
+ (mkSetLznBinding "n" mappings.open "Telescope")
+ (mkSetLznBinding "n" mappings.resume "Telescope resume")
- (mkSetLznBinding "n" mappings.gitCommits " Telescope git_commits")
- (mkSetLznBinding "n" mappings.gitBufferCommits " Telescope git_bcommits")
- (mkSetLznBinding "n" mappings.gitBranches " Telescope git_branches")
- (mkSetLznBinding "n" mappings.gitStatus " Telescope git_status")
- (mkSetLznBinding "n" mappings.gitStash " Telescope git_stash")
+ (mkSetLznBinding "n" mappings.gitCommits "Telescope git_commits")
+ (mkSetLznBinding "n" mappings.gitBufferCommits "Telescope git_bcommits")
+ (mkSetLznBinding "n" mappings.gitBranches "Telescope git_branches")
+ (mkSetLznBinding "n" mappings.gitStatus "Telescope git_status")
+ (mkSetLznBinding "n" mappings.gitStash "Telescope git_stash")
]
++ (optionals config.vim.lsp.enable [
- (mkSetLznBinding "n" mappings.lspDocumentSymbols " Telescope lsp_document_symbols")
- (mkSetLznBinding "n" mappings.lspWorkspaceSymbols " Telescope lsp_workspace_symbols")
+ (mkSetLznBinding "n" mappings.lspDocumentSymbols "Telescope lsp_document_symbols")
+ (mkSetLznBinding "n" mappings.lspWorkspaceSymbols "Telescope lsp_workspace_symbols")
- (mkSetLznBinding "n" mappings.lspReferences " Telescope lsp_references")
- (mkSetLznBinding "n" mappings.lspImplementations " Telescope lsp_implementations")
- (mkSetLznBinding "n" mappings.lspDefinitions " Telescope lsp_definitions")
- (mkSetLznBinding "n" mappings.lspTypeDefinitions " Telescope lsp_type_definitions")
- (mkSetLznBinding "n" mappings.diagnostics " Telescope diagnostics")
+ (mkSetLznBinding "n" mappings.lspReferences "Telescope lsp_references")
+ (mkSetLznBinding "n" mappings.lspImplementations "Telescope lsp_implementations")
+ (mkSetLznBinding "n" mappings.lspDefinitions "Telescope lsp_definitions")
+ (mkSetLznBinding "n" mappings.lspTypeDefinitions "Telescope lsp_type_definitions")
+ (mkSetLznBinding "n" mappings.diagnostics "Telescope diagnostics")
])
++ (
optionals config.vim.treesitter.enable [
- (mkSetLznBinding "n" mappings.treesitter " Telescope treesitter")
+ (mkSetLznBinding "n" mappings.treesitter "Telescope treesitter")
]
)
++ (
optionals config.vim.projects.project-nvim.enable [
- (mkSetLznBinding "n" mappings.findProjects "")
+ (mkSetLznBinding "n" mappings.findProjects "Telescope projects")
]
);
};
From c99afe12c33d9f514828fc7fe90e013be6387dae Mon Sep 17 00:00:00 2001
From: diniamo
Date: Sun, 10 Nov 2024 19:52:12 +0100
Subject: [PATCH 13/88] trouble: fix binds
---
modules/extra/deprecations.nix | 5 +++++
modules/plugins/lsp/trouble/config.nix | 15 +++++++--------
modules/plugins/lsp/trouble/trouble.nix | 2 +-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/modules/extra/deprecations.nix b/modules/extra/deprecations.nix
index 5a30ef5e..a4ac56a3 100644
--- a/modules/extra/deprecations.nix
+++ b/modules/extra/deprecations.nix
@@ -54,5 +54,10 @@ in {
Nvf now uses $NVIM_APP_NAME so there is no longer the problem of
(accidental) leaking of user configuration.
'')
+
+ (mkRemovedOptionModule ["vim" "lsp" "trouble" "mappings" "toggle"] ''
+ With Trouble having so many different modes, and breaking changes
+ upstream, it no longer makes sense, nor works, to toggle only Trouble.
+ '')
];
}
diff --git a/modules/plugins/lsp/trouble/config.nix b/modules/plugins/lsp/trouble/config.nix
index 9bbc71c3..b64a9151 100644
--- a/modules/plugins/lsp/trouble/config.nix
+++ b/modules/plugins/lsp/trouble/config.nix
@@ -21,19 +21,18 @@ in {
cmd = "Trouble";
keys = [
- (mkSetLznBinding "n" mappings.toggle "TroubleToggle")
- (mkSetLznBinding "n" mappings.workspaceDiagnostics "TroubleToggle workspace_diagnostics")
- (mkSetLznBinding "n" mappings.documentDiagnostics "TroubleToggle document_diagnostics")
- (mkSetLznBinding "n" mappings.lspReferences "TroubleToggle lsp_references")
- (mkSetLznBinding "n" mappings.quickfix "TroubleToggle quickfix")
- (mkSetLznBinding "n" mappings.locList "TroubleToggle loclist")
+ (mkSetLznBinding "n" mappings.workspaceDiagnostics "Trouble toggle diagnostics")
+ (mkSetLznBinding "n" mappings.documentDiagnostics "Trouble toggle diagnostics filter.buf=0")
+ (mkSetLznBinding "n" mappings.lspReferences "Trouble toggle lsp_references")
+ (mkSetLznBinding "n" mappings.quickfix "Trouble toggle quickfix")
+ (mkSetLznBinding "n" mappings.locList "Trouble toggle loclist")
+ (mkSetLznBinding "n" mappings.symbols "Trouble toggle symbols")
];
};
binds.whichKey.register = pushDownDefault {
- "l" = "Trouble";
"x" = "+Trouble";
- "lw" = "Workspace";
+ "lw" = "+Workspace";
};
};
};
diff --git a/modules/plugins/lsp/trouble/trouble.nix b/modules/plugins/lsp/trouble/trouble.nix
index 04bd5068..5fa5a3df 100644
--- a/modules/plugins/lsp/trouble/trouble.nix
+++ b/modules/plugins/lsp/trouble/trouble.nix
@@ -10,12 +10,12 @@ in {
setupOpts = mkPluginSetupOption "Trouble" {};
mappings = {
- toggle = mkMappingOption "Toggle trouble [trouble]" "xx";
workspaceDiagnostics = mkMappingOption "Workspace diagnostics [trouble]" "lwd";
documentDiagnostics = mkMappingOption "Document diagnostics [trouble]" "ld";
lspReferences = mkMappingOption "LSP References [trouble]" "lr";
quickfix = mkMappingOption "QuickFix [trouble]" "xq";
locList = mkMappingOption "LOCList [trouble]" "xl";
+ symbols = mkMappingOption "Symbols [trouble]" "xs";
};
};
};
From 250b503ef5d2769a91f8166edec9ebe1d8f7b815 Mon Sep 17 00:00:00 2001
From: diniamo
Date: Sun, 17 Nov 2024 17:00:29 +0100
Subject: [PATCH 14/88] flake: update mnw
---
flake.lock | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/flake.lock b/flake.lock
index 36d59db4..d9e6b477 100644
--- a/flake.lock
+++ b/flake.lock
@@ -38,11 +38,11 @@
},
"mnw": {
"locked": {
- "lastModified": 1731182209,
- "narHash": "sha256-yftvwv8bHEKjmSKREdkGLWTDhf7vA2Ssvl/XMpykigg=",
+ "lastModified": 1731821965,
+ "narHash": "sha256-QiGi/HBQRnIRGY4gQPuH7T3hr7NznOpEO7qNpF5ldmE=",
"owner": "Gerg-L",
"repo": "mnw",
- "rev": "0a5e50286ca9f1b70eb4fa29ce84304cad657700",
+ "rev": "5fe5c41975ed0af55f55dc37cd28ba906a5d015e",
"type": "github"
},
"original": {
From b6785f8218bf8a9813881de421ef468b512d9cea Mon Sep 17 00:00:00 2001
From: Soliprem
Date: Mon, 18 Nov 2024 09:49:20 +0100
Subject: [PATCH 15/88] typst: added single file support for tinymist
---
modules/plugins/languages/typst.nix | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules/plugins/languages/typst.nix b/modules/plugins/languages/typst.nix
index c2ba7102..45b6a70f 100644
--- a/modules/plugins/languages/typst.nix
+++ b/modules/plugins/languages/typst.nix
@@ -35,6 +35,7 @@
lspConfig = ''
lspconfig.tinymist.setup {
capabilities = capabilities,
+ single_file_support = true,
on_attach = default_on_attach,
cmd = ${
if isList cfg.lsp.package
From 1d2d4cd088153bb672eef1e2f9e56194529bc767 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Fri, 8 Nov 2024 17:55:18 +0100
Subject: [PATCH 16/88] lazy: wrap beforeAll in lua function
---
modules/wrapper/lazy/config.nix | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix
index 36c18a9e..9675e030 100644
--- a/modules/wrapper/lazy/config.nix
+++ b/modules/wrapper/lazy/config.nix
@@ -25,6 +25,15 @@
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
// {
"@1" = name;
+ beforeAll =
+ if spec.beforeAll != null
+ then
+ mkLuaInline ''
+ function()
+ ${spec.beforeAll}
+ end
+ ''
+ else null;
before =
if spec.before != null
then
From 68392ae50498bce5d9d069278021bbefd8067858 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Fri, 8 Nov 2024 17:55:52 +0100
Subject: [PATCH 17/88] neo-tree: add hijack netrw
---
modules/plugins/filetree/neo-tree/config.nix | 22 +++++++++++++++++++
.../plugins/filetree/neo-tree/neo-tree.nix | 10 ++++++++-
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/modules/plugins/filetree/neo-tree/config.nix b/modules/plugins/filetree/neo-tree/config.nix
index 208fe29a..0afd2bec 100644
--- a/modules/plugins/filetree/neo-tree/config.nix
+++ b/modules/plugins/filetree/neo-tree/config.nix
@@ -4,6 +4,7 @@
...
}: let
inherit (lib.modules) mkIf;
+ inherit (lib.strings) optionalString;
cfg = config.vim.filetree.neo-tree;
in {
@@ -21,7 +22,28 @@ in {
setupModule = "neo-tree";
inherit (cfg) setupOpts;
+ beforeAll =
+ optionalString (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled")
+ # from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
+ ''
+ vim.api.nvim_create_autocmd("BufEnter", {
+ group = vim.api.nvim_create_augroup("load_neo_tree", {}),
+ desc = "Loads neo-tree when openning a directory",
+ callback = function(args)
+ local stats = vim.uv.fs_stat(args.file)
+
+ if not stats or stats.type ~= "directory" then
+ return
+ end
+
+ require("lz.n").trigger_load("neo-tree-nvim")
+
+ return true
+ end,
+ })
+ '';
cmd = ["Neotree"];
+ event = [];
};
visuals.nvim-web-devicons.enable = true;
diff --git a/modules/plugins/filetree/neo-tree/neo-tree.nix b/modules/plugins/filetree/neo-tree/neo-tree.nix
index b1ec2601..29199d4b 100644
--- a/modules/plugins/filetree/neo-tree/neo-tree.nix
+++ b/modules/plugins/filetree/neo-tree/neo-tree.nix
@@ -1,5 +1,5 @@
{lib, ...}: let
- inherit (lib.types) bool str int submodule enum either listOf;
+ inherit (lib.types) bool str enum either listOf;
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
@@ -150,6 +150,14 @@ in {
A list of filetypes that should not be replaced when opening a file
'';
};
+
+ filesystem = {
+ hijack_netrw_behavior = mkOption {
+ type = enum ["disabled" "open_default" "open_current"];
+ default = "open_default";
+ description = "Hijack Netrw behavior";
+ };
+ };
};
};
}
From 9c979a4a84d0a846b384a8634aa7aafec21571ba Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Fri, 8 Nov 2024 18:22:13 +0100
Subject: [PATCH 18/88] nvim-tree: hijack netrw
---
modules/plugins/filetree/nvimtree/config.nix | 121 +++++++++++--------
1 file changed, 70 insertions(+), 51 deletions(-)
diff --git a/modules/plugins/filetree/nvimtree/config.nix b/modules/plugins/filetree/nvimtree/config.nix
index 30cc680b..a7f782f2 100644
--- a/modules/plugins/filetree/nvimtree/config.nix
+++ b/modules/plugins/filetree/nvimtree/config.nix
@@ -24,6 +24,7 @@ in {
package = "nvim-tree-lua";
setupModule = "nvim-tree";
inherit (cfg) setupOpts;
+
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
keys = [
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle" mappings.toggle.description)
@@ -31,58 +32,76 @@ in {
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile" mappings.findFile.description)
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus" mappings.focus.description)
];
+
+ beforeAll = ''
+ ${
+ optionalString cfg.setupOpts.disable_netrw ''
+ -- disable netrew completely
+ vim.g.loaded_netrw = 1
+ vim.g.loaded_netrwPlugin = 1
+ ''
+ }
+
+ ${optionalString (cfg.setupOpts.hijack_netrw && !cfg.openOnSetup) ''
+ vim.api.nvim_create_autocmd("BufEnter", {
+ group = vim.api.nvim_create_augroup("load_nvim_tree", {}),
+ desc = "Loads nvim-tree when openning a directory",
+ callback = function(args)
+ local stats = vim.uv.fs_stat(args.file)
+
+ if not stats or stats.type ~= "directory" then
+ return
+ end
+
+ require("lz.n").trigger_load("nvim-tree-lua")
+
+ return true
+ end,
+ })
+ ''}
+
+ ${
+ optionalString cfg.openOnSetup ''
+ ${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
+ -- autostart behaviour
+ -- Open on startup has been deprecated
+ -- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
+
+ -- use a nix eval to dynamically insert the open on startup function
+ local function open_nvim_tree(data)
+ local IGNORED_FT = {
+ "markdown",
+ }
+
+ -- buffer is a real file on the disk
+ local real_file = vim.fn.filereadable(data.file) == 1
+
+ -- buffer is a [No Name]
+ local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
+
+ -- &ft
+ local filetype = vim.bo[data.buf].ft
+
+ -- only files please
+ if not real_file and not no_name then
+ return
+ end
+
+ -- skip ignored filetypes
+ if vim.tbl_contains(IGNORED_FT, filetype) then
+ return
+ end
+
+ -- open the tree but don't focus it
+ require("nvim-tree.api").tree.toggle({ focus = false })
+ end
+
+ -- function to automatically open the tree on VimEnter
+ vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
+ ''
+ }
+ '';
};
-
- pluginRC.nvimtreelua = entryAnywhere ''
- ${
- optionalString cfg.setupOpts.disable_netrw ''
- -- disable netrew completely
- vim.g.loaded_netrw = 1
- vim.g.loaded_netrwPlugin = 1
- ''
- }
-
- ${
- optionalString cfg.openOnSetup ''
- ${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
- -- autostart behaviour
- -- Open on startup has been deprecated
- -- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
-
- -- use a nix eval to dynamically insert the open on startup function
- local function open_nvim_tree(data)
- local IGNORED_FT = {
- "markdown",
- }
-
- -- buffer is a real file on the disk
- local real_file = vim.fn.filereadable(data.file) == 1
-
- -- buffer is a [No Name]
- local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
-
- -- &ft
- local filetype = vim.bo[data.buf].ft
-
- -- only files please
- if not real_file and not no_name then
- return
- end
-
- -- skip ignored filetypes
- if vim.tbl_contains(IGNORED_FT, filetype) then
- return
- end
-
- -- open the tree but don't focus it
- require("nvim-tree.api").tree.toggle({ focus = false })
- end
-
- -- function to automatically open the tree on VimEnter
- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
- ''
- }
- '';
};
};
}
From d459fd16cee9597224fda6afa2221b46e9c8614b Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Tue, 19 Nov 2024 01:17:09 +0100
Subject: [PATCH 19/88] neo-tree: move beforeAll to pluginRC
---
modules/plugins/filetree/neo-tree/config.nix | 43 ++++++++++----------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/modules/plugins/filetree/neo-tree/config.nix b/modules/plugins/filetree/neo-tree/config.nix
index 0afd2bec..d2a114f3 100644
--- a/modules/plugins/filetree/neo-tree/config.nix
+++ b/modules/plugins/filetree/neo-tree/config.nix
@@ -4,7 +4,7 @@
...
}: let
inherit (lib.modules) mkIf;
- inherit (lib.strings) optionalString;
+ inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.filetree.neo-tree;
in {
@@ -22,31 +22,30 @@ in {
setupModule = "neo-tree";
inherit (cfg) setupOpts;
- beforeAll =
- optionalString (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled")
- # from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
- ''
- vim.api.nvim_create_autocmd("BufEnter", {
- group = vim.api.nvim_create_augroup("load_neo_tree", {}),
- desc = "Loads neo-tree when openning a directory",
- callback = function(args)
- local stats = vim.uv.fs_stat(args.file)
-
- if not stats or stats.type ~= "directory" then
- return
- end
-
- require("lz.n").trigger_load("neo-tree-nvim")
-
- return true
- end,
- })
- '';
cmd = ["Neotree"];
- event = [];
};
visuals.nvim-web-devicons.enable = true;
+ # from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
+ pluginRC.neo-tree =
+ mkIf (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled" && config.vim.lazy.enable)
+ (entryAnywhere ''
+ vim.api.nvim_create_autocmd("BufEnter", {
+ group = vim.api.nvim_create_augroup("load_neo_tree", {}),
+ desc = "Loads neo-tree when openning a directory",
+ callback = function(args)
+ local stats = vim.uv.fs_stat(args.file)
+
+ if not stats or stats.type ~= "directory" then
+ return
+ end
+
+ require("lz.n").trigger_load("neo-tree-nvim")
+
+ return true
+ end,
+ })
+ '');
};
};
}
From dee78a393b581bcc07c8f9a553a13450665aeb56 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Tue, 19 Nov 2024 01:18:52 +0100
Subject: [PATCH 20/88] nvimtree: move beforeAll to pluginRC
---
modules/plugins/filetree/nvimtree/config.nix | 130 +++++++++----------
1 file changed, 65 insertions(+), 65 deletions(-)
diff --git a/modules/plugins/filetree/nvimtree/config.nix b/modules/plugins/filetree/nvimtree/config.nix
index a7f782f2..40df74b2 100644
--- a/modules/plugins/filetree/nvimtree/config.nix
+++ b/modules/plugins/filetree/nvimtree/config.nix
@@ -32,76 +32,76 @@ in {
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile" mappings.findFile.description)
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus" mappings.focus.description)
];
+ };
- beforeAll = ''
- ${
- optionalString cfg.setupOpts.disable_netrw ''
- -- disable netrew completely
- vim.g.loaded_netrw = 1
- vim.g.loaded_netrwPlugin = 1
- ''
- }
+ pluginRC.nvim-tree = entryAnywhere ''
+ ${
+ optionalString cfg.setupOpts.disable_netrw ''
+ -- disable netrew completely
+ vim.g.loaded_netrw = 1
+ vim.g.loaded_netrwPlugin = 1
+ ''
+ }
- ${optionalString (cfg.setupOpts.hijack_netrw && !cfg.openOnSetup) ''
- vim.api.nvim_create_autocmd("BufEnter", {
- group = vim.api.nvim_create_augroup("load_nvim_tree", {}),
- desc = "Loads nvim-tree when openning a directory",
- callback = function(args)
- local stats = vim.uv.fs_stat(args.file)
+ ${optionalString (config.vim.lazy.enable && cfg.setupOpts.hijack_netrw && !cfg.openOnSetup) ''
+ vim.api.nvim_create_autocmd("BufEnter", {
+ group = vim.api.nvim_create_augroup("load_nvim_tree", {}),
+ desc = "Loads nvim-tree when openning a directory",
+ callback = function(args)
+ local stats = vim.uv.fs_stat(args.file)
- if not stats or stats.type ~= "directory" then
- return
- end
-
- require("lz.n").trigger_load("nvim-tree-lua")
-
- return true
- end,
- })
- ''}
-
- ${
- optionalString cfg.openOnSetup ''
- ${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
- -- autostart behaviour
- -- Open on startup has been deprecated
- -- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
-
- -- use a nix eval to dynamically insert the open on startup function
- local function open_nvim_tree(data)
- local IGNORED_FT = {
- "markdown",
- }
-
- -- buffer is a real file on the disk
- local real_file = vim.fn.filereadable(data.file) == 1
-
- -- buffer is a [No Name]
- local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
-
- -- &ft
- local filetype = vim.bo[data.buf].ft
-
- -- only files please
- if not real_file and not no_name then
- return
- end
-
- -- skip ignored filetypes
- if vim.tbl_contains(IGNORED_FT, filetype) then
- return
- end
-
- -- open the tree but don't focus it
- require("nvim-tree.api").tree.toggle({ focus = false })
+ if not stats or stats.type ~= "directory" then
+ return
end
- -- function to automatically open the tree on VimEnter
- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
- ''
- }
- '';
- };
+ require("lz.n").trigger_load("nvim-tree-lua")
+
+ return true
+ end,
+ })
+ ''}
+
+ ${
+ optionalString cfg.openOnSetup ''
+ ${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
+ -- autostart behaviour
+ -- Open on startup has been deprecated
+ -- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
+
+ -- use a nix eval to dynamically insert the open on startup function
+ local function open_nvim_tree(data)
+ local IGNORED_FT = {
+ "markdown",
+ }
+
+ -- buffer is a real file on the disk
+ local real_file = vim.fn.filereadable(data.file) == 1
+
+ -- buffer is a [No Name]
+ local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
+
+ -- &ft
+ local filetype = vim.bo[data.buf].ft
+
+ -- only files please
+ if not real_file and not no_name then
+ return
+ end
+
+ -- skip ignored filetypes
+ if vim.tbl_contains(IGNORED_FT, filetype) then
+ return
+ end
+
+ -- open the tree but don't focus it
+ require("nvim-tree.api").tree.toggle({ focus = false })
+ end
+
+ -- function to automatically open the tree on VimEnter
+ vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
+ ''
+ }
+ '';
};
};
}
From e143f4699c89f7e98a8a006728f15a149a0baa69 Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Thu, 21 Nov 2024 22:49:11 +0100
Subject: [PATCH 21/88] configuration: switch default file-tree to neo-tree
---
configuration.nix | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configuration.nix b/configuration.nix
index cc39d3ff..01a99524 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -112,7 +112,7 @@ isMaximal: {
snippets.luasnip.enable = true;
filetree = {
- nvimTree = {
+ neo-tree = {
enable = true;
};
};
From 8c95b996c7828b0c3c1acea2b01486505fba68bb Mon Sep 17 00:00:00 2001
From: Ching Pei Yang
Date: Sat, 23 Nov 2024 20:21:31 +0100
Subject: [PATCH 22/88] copilot: fix wrong keybind descriptions
---
modules/plugins/assistant/copilot/config.nix | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/plugins/assistant/copilot/config.nix b/modules/plugins/assistant/copilot/config.nix
index 9f92d14a..37da046f 100644
--- a/modules/plugins/assistant/copilot/config.nix
+++ b/modules/plugins/assistant/copilot/config.nix
@@ -40,13 +40,13 @@ in {
cmd = ["Copilot" "CopilotAuth" "CopilotDetach" "CopilotPanel" "CopilotStop"];
keys = [
(mkLuaKeymap ["n"] cfg.mappings.panel.accept (wrapPanelBinding ''require("copilot.panel").accept'' cfg.mappings.panel.accept) "[copilot] Accept suggestion" {})
- (mkLuaKeymap ["n"] cfg.mappings.panel.jumpNext (wrapPanelBinding "require(\"copilot.panel\").jump_next" cfg.mappings.panel.jumpNext) "[copilot] Accept suggestion" {})
- (mkLuaKeymap ["n"] cfg.mappings.panel.jumpPrev (wrapPanelBinding "require(\"copilot.panel\").jump_prev" cfg.mappings.panel.jumpPrev) "[copilot] Accept suggestion" {})
- (mkLuaKeymap ["n"] cfg.mappings.panel.refresh (wrapPanelBinding "require(\"copilot.panel\").refresh" cfg.mappings.panel.refresh) "[copilot] Accept suggestion" {})
+ (mkLuaKeymap ["n"] cfg.mappings.panel.jumpNext (wrapPanelBinding "require(\"copilot.panel\").jump_next" cfg.mappings.panel.jumpNext) "[copilot] Next panel suggestion" {})
+ (mkLuaKeymap ["n"] cfg.mappings.panel.jumpPrev (wrapPanelBinding "require(\"copilot.panel\").jump_prev" cfg.mappings.panel.jumpPrev) "[copilot] Previous panel suggestion" {})
+ (mkLuaKeymap ["n"] cfg.mappings.panel.refresh (wrapPanelBinding "require(\"copilot.panel\").refresh" cfg.mappings.panel.refresh) "[copilot] Refresh suggestion" {})
(mkLuaKeymap ["n"] cfg.mappings.panel.open (wrapPanelBinding ''
function() require("copilot.panel").open({ position = "${cfg.setupOpts.panel.layout.position}", ratio = ${toString cfg.setupOpts.panel.layout.ratio}, }) end
''
- cfg.mappings.panel.open) "[copilot] Accept suggestion" {})
+ cfg.mappings.panel.open) "[copilot] Open Panel" {})
(mkLuaKeymap ["i"] cfg.mappings.suggestion.accept "function() require('copilot.suggestion').accept() end" "[copilot] Accept suggestion" {})
(mkLuaKeymap ["i"] cfg.mappings.suggestion.acceptLine "function() require('copilot.suggestion').accept_line() end" "[copilot] Accept suggestion (line)" {})
From 6645abb6e87d88d126125f267c9c22bdb7ee166a Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Mon, 4 Nov 2024 17:00:28 +0300
Subject: [PATCH 23/88] flake: improve deprecation messages for old
`neovim-flake` modules'
---
flake.nix | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/flake.nix b/flake.nix
index 4e417e7f..1123432e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -31,29 +31,25 @@
};
homeManagerModules = {
+ nvf = import ./flake/modules/home-manager.nix self.packages lib;
+ default = self.homeManagerModules.nvf;
neovim-flake =
lib.warn ''
- homeManagerModules.neovim-flake has been deprecated.
- Plese use the homeManagerModules.nvf instead
+ 'homeManagerModules.neovim-flake' has been deprecated, and will be removed
+ in a future release. Please use 'homeManagerModules.nvf' instead.
''
self.homeManagerModules.nvf;
-
- nvf = import ./flake/modules/home-manager.nix self.packages lib;
-
- default = self.homeManagerModules.nvf;
};
nixosModules = {
+ nvf = import ./flake/modules/nixos.nix self.packages lib;
+ default = self.nixosModules.nvf;
neovim-flake =
lib.warn ''
- nixosModules.neovim-flake has been deprecated.
- Please use the nixosModules.nvf instead
+ 'nixosModules.neovim-flake' has been deprecated, and will be removed
+ in a future release. Please use 'nixosModules.nvf' instead.
''
self.nixosModules.nvf;
-
- nvf = import ./flake/modules/nixos.nix self.packages lib;
-
- default = self.nixosModules.nvf;
};
};
From 94d04ba0dff8b5d7cf6a028be791a6bc66ca2e7c Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Mon, 4 Nov 2024 17:23:18 +0300
Subject: [PATCH 24/88] docs: clean up project README
---
.github/README.md | 72 ++++++++++++++++++++++++++++++-----------------
1 file changed, 46 insertions(+), 26 deletions(-)
diff --git a/.github/README.md b/.github/README.md
index 531d062b..029f2fc8 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -48,7 +48,7 @@
[Documentation]: #documentation
[Help]: #help
[Contribute]: #contributing
-[FAQ]: #faq
+[FAQ]: #frequently-asked-questions
[Credits]: #credits
**[
Features
][Features]**
@@ -56,7 +56,7 @@
**[
Documentation
][Documentation]**
**[
Help
][Help]**
**[
Contribute
][Contribute]**
-**[
FAQ
][Faq]** **[
Credits
][Credits]**
+**[
FAQ
][FAQ]** **[
Credits
][Credits]**
@@ -64,12 +64,21 @@
## Features
+[standalone]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-installation
+[NixOS module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-nixos
+[Home-Manager module]: https://notashelf.github.io/nvf/index.xhtml#ch-standalone-hm
+
+- **Simple**: One language to rule them all! Use Nix to configure everything,
+ with additional Lua Support
- **Reproducible**: Your configuration will behave the same _anywhere_. No
surprises, promise!
- **Portable**: nvf depends _solely_ on your Nix store, and nothing else. No
more global binaries! Works on all platforms, without hassle.
+ - Options to install [standalone], [NixOS module] or [Home-Manager module].
- **Customizable**: There are _almost no defaults_ to annoy you. nvf is fully
customizable through the Nix module system.
+- Not comfortable with a full-nix config or want to bring your Lua config? You
+ can do just that, no unnecessary restrictions.
- **Well-documented**: Documentation is priority. You will _never_ face
undocumented, obscure behaviour.
- **Idiomatic**: nvf does things ✨ _the right way_ ✨ - the codebase is, and
@@ -120,7 +129,9 @@ instructions.
## Documentation
-The _recommended_ way of installing **nvf** is using either the NixOS or the
+### Installation
+
+The _recommended_ way of installing nvf is using either the NixOS or the
Home-Manager module, though it is completely possible and no less supported to
install **nvf** as a standalone package, or a flake output.
@@ -138,11 +149,13 @@ Please create an issue on the [issue tracker] if you find the documentation
lacking or confusing. Any improvements to the documentation through pull
requests are also welcome, and appreciated.
-## Help
+## Getting Help
-You can create an issue on the [issue tracker] to ask questions or report bugs.
-I am not yet on spaces like matrix or IRC, so please use the issue tracker for
-now.
+If you are confused, stuck or would like to ask a simple question; you may
+create an issue on the [issue tracker] to ask questions or report bugs.
+
+We are not not yet on spaces like matrix or IRC, so please use the issue tracker
+for now.
## Contributing
@@ -152,7 +165,7 @@ submitting a pull request. You can also create an issue on the [issue tracker]
before submitting a pull request if you would like to discuss a feature or bug
fix.
-## FAQ
+## Frequently Asked Questions
[appropriate issue template]: https://github.com/NotAShelf/nvf/issues/new/choose
[list of branches]: https://github.com/NotAShelf/nvf/branches
@@ -160,13 +173,15 @@ fix.
**Q**: What platforms are supported?
**A**: nvf actively supports Linux and Darwin platforms using standalone
-Nix, NixOS or Home-Manager. Please take a look at the
+Nix, NixOS or Home-Manager. Please take a look at the [nvf manual] for available
+installation instructions.
**Q**: Can you add _X_?
**A**: Maybe! It is not one of our goals to support each and every Neovim
plugin, however, I am always open to new modules and plugin setup additions to
**nvf**. Use the [appropriate issue template] and I will consider a module
-addition. As mentioned before, PRs adding new features are also welcome.
+addition. As mentioned before, pull requests to add new features are also
+welcome.
**Q**: A plugin I need is not available in **nvf**. What to do?
**A**: **nvf** exposes several APIs for you to be able to add your own
@@ -185,22 +200,26 @@ better prepare to breaking changes.
### Contributors
-Special, heart-felt thanks to
+[mnw]: https://github.com/gerg-l/mnw
-- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
-- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to
- work
+nvf would not be what it is today without the awesome people below. Special,
+heart-felt thanks to
+
+- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts and
+ invaluable Nix assistance.
+- [@FlafyDev](https://github.com/FlafyDev) - For getting home-manager module to
+ work and Nix assistance.
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally
- possible
+ possible, and other module additions.
- [@horriblename](https://github.com/horriblename) - For actively implementing
- planned features and quality of life updates
+ planned features and quality of life updates.
- [@Yavko](https://github.com/Yavko) - For the amazing **nvf** logo
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I
- could not
-- [@Diniamo](https://github.com/Diniamo) - For actively submitting PRs, pull
- requests and overall assistence
-- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, mnw and
- occasional code improvements
+ could not.
+- [@Diniamo](https://github.com/Diniamo) - For actively submitting pull
+ requests, issues and assistance with maintenance of nvf.
+- [@Gerg-l](https://github.com/gerg-l) - For the modern Neovim wrapper, [mnw],
+ and occasional code improvements.
and everyone who has submitted issues or pull requests!
@@ -214,7 +233,7 @@ including:
is originally based on.
- [@sioodmy's](https://github.com/sioodmy)
[dotfiles](https://github.com/sioodmy/dotfiles) that inspired the design
- choices.
+ choices for UI and plugin defaults.
- [@wiltaylor's](https://github.com/wiltaylor)
[neovim-flake](https://github.com/wiltaylor/neovim-flake) for plugin and
design ideas.
@@ -229,10 +248,11 @@ recommend checking their work out.
## License
Following the license of the
-[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), **nvf**
-has been made available under the [**MIT License**](LICENSE). However, all
-assets and documentation are published under the
-[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE).
+[original neovim-flake](https://github.com/jordanisaacs/neovim-flake), nvf has
+been made available under the [**MIT License**](LICENSE). However, all assets
+and documentation are published under the
+[**CC BY License**](https://github.com/NotAShelf/nvf/blob/main/.github/assets/LICENSE)
+under explicit permission by the artist.
Yes, this includes the logo work too. Stop taking artwork that is not yours!
From 7c8dc07824bcaa0f7ff465c23e1fc5db45588025 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Mon, 4 Nov 2024 17:38:45 +0300
Subject: [PATCH 25/88] docs: fix typo in standalone installation pages
---
docs/manual/installation/standalone/home-manager.md | 2 +-
docs/manual/installation/standalone/nixos.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/manual/installation/standalone/home-manager.md b/docs/manual/installation/standalone/home-manager.md
index db1ae632..1f5d55ce 100644
--- a/docs/manual/installation/standalone/home-manager.md
+++ b/docs/manual/installation/standalone/home-manager.md
@@ -1,6 +1,6 @@
# Standalone Installation on Home-Manager {#ch-standalone-hm}
-Your built Neoevim configuration can be exposed as a flake output to make it
+Your built Neovim configuration can be exposed as a flake output to make it
easier to share across machines, repositories and so on. Or it can be added to
your system packages to make it available across your system.
diff --git a/docs/manual/installation/standalone/nixos.md b/docs/manual/installation/standalone/nixos.md
index 2e6343a1..33235ac7 100644
--- a/docs/manual/installation/standalone/nixos.md
+++ b/docs/manual/installation/standalone/nixos.md
@@ -1,6 +1,6 @@
# Standalone Installation on NixOS {#ch-standalone-nixos}
-Your built Neoevim configuration can be exposed as a flake output to make it
+Your built Neovim configuration can be exposed as a flake output to make it
easier to share across machines, repositories and so on. Or it can be added to
your system packages to make it available across your system.
From 5b54f6d5f5b937609a11274311ac77ea25375b51 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Mon, 4 Nov 2024 17:39:10 +0300
Subject: [PATCH 26/88] docs/installation: add standalone flake example
---
.../installation/custom-configuration.md | 54 +++++++++++++++++--
1 file changed, 51 insertions(+), 3 deletions(-)
diff --git a/docs/manual/installation/custom-configuration.md b/docs/manual/installation/custom-configuration.md
index 408b0399..64ae64ee 100644
--- a/docs/manual/installation/custom-configuration.md
+++ b/docs/manual/installation/custom-configuration.md
@@ -1,8 +1,9 @@
# Standalone Installation {#ch-standalone-installation}
-It is possible to install **nvf** without depending on NixOS or home-manager as the parent
-module system, using the `neovimConfiguration` function exposed by **nvf** extended library.
-It takes in the configuration as a module, and returns an attribute set as a result.
+It is possible to install nvf without depending on NixOS or Home-Manager as the
+parent module system, using the `neovimConfiguration` function exposed in the
+extended library. This function will take `modules` and `extraSpecialArgs` as
+arguments, and return the following schema as a result.
```nix
{
@@ -13,6 +14,53 @@ It takes in the configuration as a module, and returns an attribute set as a res
}
```
+An example flake that exposes your custom Neovim configuration might look like
+
+```nix
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ nvf.url = "github:notashelf/nvf";
+ };
+
+ outputs = {
+ self,
+ nixpkgs,
+ ...
+ } @ inputs: {
+ packages."x86_64-linux" = let
+ neovimConfigured = (inputs.nvf.lib.neovimConfiguration {
+ inherit (nixpkgs.legacyPackages."x86_64-linux") pkgs;
+ modules = [{
+ config.vim = {
+ # Enable custom theming options
+ theme.enable = true;
+
+ # Enable Treesitter
+ tree-sitter.enable = true;
+
+ # Other options will go here. Refer to the config
+ # reference in Appendix B of the nvf manual.
+ # ...
+ };
+ }];
+ });
+ in {
+ # Set the default package to the wrapped instance of Neovim.
+ # This will allow running your Neovim configuration with
+ # `nix run` and in addition, sharing your configuration with
+ # other users in case your repository is public.
+ default = neovimConfigured.neovim;
+ };
+ };
+}
+```
+
+
+
+The next two chapters will detail specific usage of standalone nvf
+configurations on NixOS and Home-Manager.
+
```{=include=} chapters
standalone/nixos.md
standalone/home-manager.md
From b2600885c8f025ee768f2af3c7ebbd9e21b5bf00 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Mon, 4 Nov 2024 17:39:23 +0300
Subject: [PATCH 27/88] docs: add preface to modules chapter
---
docs/manual/installation/modules.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/manual/installation/modules.md b/docs/manual/installation/modules.md
index d8462e9d..f78046de 100644
--- a/docs/manual/installation/modules.md
+++ b/docs/manual/installation/modules.md
@@ -1,5 +1,9 @@
# Module Installation {#ch-module-installation}
+The below chapters will describe installing nvf as NixOS and Home-Manager
+modules. Note that those methods are mutually exclusive, and will likely cause
+path collisions if used simultaneously.
+
```{=include=} chapters
modules/nixos.md
modules/home-manager.md
From c382bb02eb6e8309ae59ea11209c5ace9d635c85 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 10:57:59 +0300
Subject: [PATCH 28/88] docs/custom-plugins: better wording and edge cases in
legacy-method.md
---
.../configuring/custom-plugins/legacy-method.md | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/docs/manual/configuring/custom-plugins/legacy-method.md b/docs/manual/configuring/custom-plugins/legacy-method.md
index 0a6b3775..b2bddf43 100644
--- a/docs/manual/configuring/custom-plugins/legacy-method.md
+++ b/docs/manual/configuring/custom-plugins/legacy-method.md
@@ -1,6 +1,6 @@
# Legacy Method {#sec-legacy-method}
-Prior to version 0.5, the method of adding new plugins was adding the plugin
+Prior to version v0.5, the method of adding new plugins was adding the plugin
package to `vim.startPlugins` and add its configuration as a DAG under one of
`vim.configRC` or `vim.luaConfigRC`. Users who have not yet updated to 0.5, or
prefer a more hands-on approach may use the old method where the load order of
@@ -8,13 +8,14 @@ the plugins is determined by DAGs.
## Adding plugins {#sec-adding-plugins}
-To add a plugin to **nvf**'s runtime, you may add it
+To add a plugin not available in nvf as a module to your configuration, you may
+add it to [](#opt-vim.startPlugins) in order to make it available to Neovim at
+runtime.
```nix
{pkgs, ...}: {
- # add a package from nixpkgs to startPlugins
- vim.startPlugins = [
- pkgs.vimPlugins.aerial-nvim ];
+ # Add a Neovim plugin from Nixpkgs to the runtime.
+ vim.startPlugins = [pkgs.vimPlugins.aerial-nvim];
}
```
@@ -23,7 +24,9 @@ provide configuration as a DAG using the **nvf** extended library.
```nix
{inputs, ...}: let
- # assuming you have an input called nvf pointing at the nvf repository
+ # This assumes you have an input called 'nvf' in your flake inputs
+ # and 'inputs' in your specialArgs. In the case you have passed 'nvf'
+ # to specialArgs, the 'inputs' prefix may be omitted.
inherit (inputs.nvf.lib.nvim.dag) entryAnywhere;
in {
vim.luaConfigRC.aerial-nvim= entryAnywhere ''
From d0ae648119fe30f763620077de46dca4eaa58ba0 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 10:58:40 +0300
Subject: [PATCH 29/88] docs/custom-plugins: improve wording for DAG; link to
local docs
---
.../configuring/custom-plugins/configuring.md | 40 +++++++++++--------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/docs/manual/configuring/custom-plugins/configuring.md b/docs/manual/configuring/custom-plugins/configuring.md
index 80ef03a4..c0935f03 100644
--- a/docs/manual/configuring/custom-plugins/configuring.md
+++ b/docs/manual/configuring/custom-plugins/configuring.md
@@ -1,12 +1,13 @@
# Configuring {#sec-configuring-plugins}
-Just making the plugin to your Neovim configuration available might not always be enough. In that
-case, you can write custom lua config using either `config.vim.lazy.plugins.*.setupOpts`
-`config.vim.extraPlugins.*.setup` or `config.vim.luaConfigRC`.
+Just making the plugin to your Neovim configuration available might not always
+be enough. In that case, you can write custom lua config using either
+`config.vim.lazy.plugins.*.setupOpts` `config.vim.extraPlugins.*.setup` or
+`config.vim.luaConfigRC`.
-The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule` and `setupOpt` can
-be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise, the `before` and
-`after` hooks should do what you need.
+The first option uses an extended version of `lz.n`'s PluginSpec. `setupModule`
+and `setupOpt` can be used if the plugin uses a `require('module').setup(...)`
+pattern. Otherwise, the `before` and `after` hooks should do what you need.
```nix
{
@@ -24,10 +25,11 @@ be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise,
}
```
-The second option uses an attribute set, which maps DAG section names to a custom type, which has
-the fields `package`, `after`, `setup`. They allow you to set the package of the plugin, the
-sections its setup code should be after (note that the `extraPlugins` option has its own DAG
-scope), and the its setup code respectively. For example:
+The second option uses an attribute set, which maps DAG section names to a
+custom type, which has the fields `package`, `after`, `setup`. They allow you to
+set the package of the plugin, the sections its setup code should be after (note
+that the `extraPlugins` option has its own DAG scope), and the its setup code
+respectively. For example:
```nix
config.vim.extraPlugins = with pkgs.vimPlugins; {
@@ -56,13 +58,17 @@ For example:
}
```
-:::{.note}
-If your configuration needs to be put in a specific place in the config, you
-can use functions from `inputs.nvf.lib.nvim.dag` to order it. Refer to
-https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix
+
+
+::: {.note}
+One of the greatest strengths of nvf is the ability to order
+snippets of configuration via the DAG system. It will allow specifying positions
+of individual sections of configuration as needed. nvf provides helper functions
+in the extended library, usually under `inputs.nvf.lib.nvim.dag` that you may
+use.
+
+Please refer to the [DAG section](/index.xhtml#ch-dag-entries) in the nvf manual
to find out more about the DAG system.
:::
-If you successfully made your plugin work, please feel free to create a PR to
-add it to **nvf** or open an issue with your findings so that we can make it
-available for everyone easily.
+
From 4156ecfb21a46722cc456fca92fa45a7dae22723 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:06:07 +0300
Subject: [PATCH 30/88] docs/try-it-out: correct number of available configs;
fix typos
---
docs/manual/try-it-out.md | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/docs/manual/try-it-out.md b/docs/manual/try-it-out.md
index bd8c69bb..8244c2b7 100644
--- a/docs/manual/try-it-out.md
+++ b/docs/manual/try-it-out.md
@@ -1,25 +1,27 @@
# Try it out {#ch-try-it-out}
-Thanks to the portability of Nix, you can try out nvf without actually installing it to your machine.
-Below are the commands you may run to try out different configurations provided by this flake. As of v0.5, three
+Thanks to the portability of Nix, you can try out nvf without actually
+installing it to your machine. Below are the commands you may run to try out
+different configurations provided by this flake. As of v0.5, two specialized
configurations are provided:
-- Nix
-- Maximal
+- **Nix** - Nix language server + simple utility plugins
+- **Maximal** - Variable language servers + utility and decorative plugins
-You may try out any of the provided configurations using the `nix run` command on a system where Nix is installed.
+You may try out any of the provided configurations using the `nix run` command
+on a system where Nix is installed.
-```console
+```bash
$ cachix use nvf # Optional: it'll save you CPU resources and time
$ nix run github:notashelf/nvf#nix # will run the default minimal configuration
```
-Do keep in mind that this is **susceptible to garbage collection** meaning it will be removed from your Nix store
-once you garbage collect.
+Do keep in mind that this is **susceptible to garbage collection** meaning it
+will be removed from your Nix store once you garbage collect.
-## Using Prebuilt Configs {#sec-using-prebuild-configs}
+## Using Prebuilt Configs {#sec-using-prebuilt-configs}
-```console
+```bash
$ nix run github:notashelf/nvf#nix
$ nix run github:notashelf/nvf#maximal
```
@@ -28,12 +30,19 @@ $ nix run github:notashelf/nvf#maximal
#### Nix {#sec-configs-nix}
-`Nix` configuration by default provides LSP/diagnostic support for Nix alongisde a set of visual and functional plugins.
-By running `nix run .#`, which is the default package, you will build Neovim with this config.
+`Nix` configuration by default provides LSP/diagnostic support for Nix alongside
+a set of visual and functional plugins. By running `nix run .#`, which is the
+default package, you will build Neovim with this config.
#### Maximal {#sec-configs-maximal}
-`Maximal` is the ultimate configuration that will enable support for more commonly used language as well as additional
-complementary plugins. Keep in mind, however, that this will pull a lot of dependencies.
+`Maximal` is the ultimate configuration that will enable support for more
+commonly used language as well as additional complementary plugins. Keep in
+mind, however, that this will pull a lot of dependencies.
-You are _strongly_ recommended to use the binary cache if you would like to try the Maximal configuration.
+::: {.tip}
+
+You are _strongly_ recommended to use the binary cache if you would like to try
+the Maximal configuration.
+
+:::
From ce6799c9d8d80eacd5935a4830bff64398b2e4a6 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:07:02 +0300
Subject: [PATCH 31/88] docs/plugins: rename to 'quirks' to be more general
---
docs/manual/plugins.md | 16 ----------------
docs/manual/quirks.md | 13 +++++++++++++
docs/manual/{plugins => quirks}/nodejs.md | 16 +++++++++++-----
3 files changed, 24 insertions(+), 21 deletions(-)
delete mode 100644 docs/manual/plugins.md
create mode 100644 docs/manual/quirks.md
rename docs/manual/{plugins => quirks}/nodejs.md (58%)
diff --git a/docs/manual/plugins.md b/docs/manual/plugins.md
deleted file mode 100644
index fa464d18..00000000
--- a/docs/manual/plugins.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Plugin specific quirks {#ch-plugins}
-
-At times, certain plugins refuse to play nicely. Be it as a result of generating
-lua from Nix, or the state of packaging. This page shall list any plugins that
-are known to misbehave, and potential workarounds.
-
-```{=include=} chapters
-plugins/nodejs.md
-```
-
diff --git a/docs/manual/quirks.md b/docs/manual/quirks.md
new file mode 100644
index 00000000..553d6cf3
--- /dev/null
+++ b/docs/manual/quirks.md
@@ -0,0 +1,13 @@
+# Known Issues and Quirks {#ch-known-issues-quirks}
+
+At times, certain plugins and modules may refuse to play nicely with your setup,
+be it a result of generating Lua from Nix, or the state of packaging. This page,
+in turn, will list any known modules or plugins that are known to misbehave, and
+possible workarounds that you may apply.
+
+
+
+```{=include=} chapters
+quirks/nodejs.md
+```
diff --git a/docs/manual/plugins/nodejs.md b/docs/manual/quirks/nodejs.md
similarity index 58%
rename from docs/manual/plugins/nodejs.md
rename to docs/manual/quirks/nodejs.md
index 36b4c79c..d2fb46b7 100644
--- a/docs/manual/plugins/nodejs.md
+++ b/docs/manual/quirks/nodejs.md
@@ -1,16 +1,22 @@
-# NodeJS {#ch-plugins-nodejs}
+# NodeJS {#ch-quirks-nodejs}
## eslint-plugin-prettier {#sec-eslint-plugin-prettier}
-When working with NodeJS, everything works as expected, but some projects have settings that can fool nvf.
+When working with NodeJS, everything works as expected, but some projects have
+settings that can fool nvf.
-If [this plugin](https://github.com/prettier/eslint-plugin-prettier) or similar is included, you might get a situation where your eslint configuration diagnoses your formatting according to its own config (usually `.eslintrc.js`).
+If [this plugin](https://github.com/prettier/eslint-plugin-prettier) or similar
+is included, you might get a situation where your eslint configuration diagnoses
+your formatting according to its own config (usually `.eslintrc.js`).
The issue there is your formatting is made via prettierd.
-This results in auto-formating relying on your prettier config, while your eslint config diagnoses formatting [which it's not supposed to](https://prettier.io/docs/en/comparison.html))
+This results in auto-formating relying on your prettier config, while your
+eslint config diagnoses formatting
+[which it's not supposed to](https://prettier.io/docs/en/comparison.html))
-In the end, you get discrepancies between what your editor does and what it wants.
+In the end, you get discrepancies between what your editor does and what it
+wants.
Solutions are:
From 344348512ecded6cbd29249816584594f8a90a52 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:07:22 +0300
Subject: [PATCH 32/88] docs/preface: include project description in the
preface
---
docs/manual/preface.md | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/docs/manual/preface.md b/docs/manual/preface.md
index 26e30704..ce3e42e6 100644
--- a/docs/manual/preface.md
+++ b/docs/manual/preface.md
@@ -1,7 +1,20 @@
# Preface {#ch-preface}
-If you noticed a bug caused by **nvf** then please consider reporting it over
-[the issue tracker](https://github.com/notashelf/nvf/issues).
+## What is nvf {#sec-what-is-it}
-Bugfixes, feature additions and upstreamed changes from your local configurations
-are always welcome in the [the pull requests tab](https://github.com/notashelf/nvf/pulls).
+nvf is a highly modular, configurable, extensible and easy to use Neovim
+configuration in Nix. Designed for flexibility and ease of use, nvf allows you
+to easily configure your fully featured Neovim instance with a few lines of Nix.
+
+## Bugs & Suggestions {#sec-bugs-suggestions}
+
+[issue tracker]: https://github.com/notashelf/nvf/issues
+[discussions tab]: https://github.com/notashelf/nvf/discussions
+[pull requests tab]: https://github.com/notashelf/nvf/pulls
+
+If you notice any issues with nvf, or this documentation, then please consider
+reporting them over at the [issue tracker]. Issues tab, in addition to the
+[discussions tab] is a good place as any to request new features.
+
+You may also consider submitting bugfixes, feature additions and upstreamed
+changes that you think are critical over at the [pull requests tab].
From eaeb99539bbfa3eb53ecfa0993a46637b1ab1fe7 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:08:53 +0300
Subject: [PATCH 33/88] docs: use the correct path for quirks.md
---
docs/manual/manual.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/manual/manual.md b/docs/manual/manual.md
index 905a7242..fd7ddcd9 100644
--- a/docs/manual/manual.md
+++ b/docs/manual/manual.md
@@ -17,8 +17,8 @@ configuring.md
hacking.md
```
-```{=include=} appendix html:into-file=//plugins.html
-plugins.md
+```{=include=} appendix html:into-file=//quirks.html
+quirks.md
```
```{=include=} appendix html:into-file=//options.html
From 3b27c00268e8d600e06265fa1809a7dff69c7424 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:16:53 +0300
Subject: [PATCH 34/88] docs/options: include warning about option prefix
---
docs/manual/options.md | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/docs/manual/options.md b/docs/manual/options.md
index 748e3180..3b70484f 100644
--- a/docs/manual/options.md
+++ b/docs/manual/options.md
@@ -1,8 +1,14 @@
# Neovim Flake Configuration Options {#ch-options}
-Below are the options provided by nvf provided in no particular order.
-They may include useful comments and warnings, or examples on how a module option
-is meant to be used.
+Below are the module options provided by nvf, in no particular order. Most
+options will include useful comments, warnings or setup tips on how a module
+option is meant to be used as well as examples in complex cases.
+
+
```{=include=} options
id-prefix: opt-
From 41931ea87a1885a307b0cb6e55d3a6ae4e34e998 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:17:24 +0300
Subject: [PATCH 35/88] docs/installation: un-linline section link
---
docs/manual/installation.md | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/docs/manual/installation.md b/docs/manual/installation.md
index afe60d16..33dd8979 100644
--- a/docs/manual/installation.md
+++ b/docs/manual/installation.md
@@ -1,9 +1,12 @@
# Installing nvf {#ch-installation}
+[module installation section]: #ch-module-installation
+
There are multiple ways of installing nvf on your system. You may either choose
-the standalone installation method, which does not depend on a module system and may
-be done on any system that has the Nix package manager or the appropriate modules
-for NixOS and home-manager as described in the [module installation section](#ch-module-installation)
+the standalone installation method, which does not depend on a module system and
+may be done on any system that has the Nix package manager or the appropriate
+modules for NixOS and home-manager as described in the
+[module installation section].
```{=include=} chapters
installation/custom-configuration.md
From a8ebd8972bb1d89b9b47b118dcf5adff337da0e9 Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:17:51 +0300
Subject: [PATCH 36/88] docs/hacking: make preface more readable & friendly
---
docs/manual/hacking.md | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/docs/manual/hacking.md b/docs/manual/hacking.md
index 394022ba..6ff01fc6 100644
--- a/docs/manual/hacking.md
+++ b/docs/manual/hacking.md
@@ -1,16 +1,25 @@
# Hacking nvf {#ch-hacking}
-**nvf** is designed for developers as much as it is for the end user. I would like any potential contributor
-to be able to propagate their desired changes into the repository without the extra effort. As such, below are guides
-(and guidelines) to streamline the contribution process and ensure that your valuable input seamlessly integrates
-into **nvf**'s development without leaving question marks in your head.
+[open issues]: https://github.com/notashelf/nvf/issues
+[new issue]: https://github.com/notashelf/nvf/issues/new
-This section is mainly directed towards those who wish to contribute code into **nvf**. If you wish to instead
-report a bug or discuss a potential feature implementation, first look among the
-already [open issues](https://github.com/notashelf/nvf/issues) and if no matching issue exists you may open
-a [new issue](https://github.com/notashelf/nvf/issues/new) and describe your problem/request. While creating an
-issue, please try to include as much information as you can, ideally also include relevant context in which an issue
-occurs or a feature should be implemented.
+nvf is designed for the developer as much as it is designed for the end-user. We
+would like for any contributor to be able to propagate their changes, or add new
+features to the project with minimum possible friction. As such, below are the
+guides and guidelines written to streamline the contribution process and to
+ensure that your valuable input integrates into nvf's development as seamlessly
+as possible without leaving any question marks in your head.
+
+This section is directed mainly towards those who wish to contribute code into
+the project. If you instead wish to report a bug, or discuss a potential new
+feature implementation (which you do not wish to implement yourself) first look
+among the already [open issues] and if no matching issue exists you may open a
+[new issue] and describe your problem/request.
+
+While creating an issue, please try to include as much information as you can,
+ideally also include relevant context in which an issue occurs or a feature
+should be implemented. If you wish to make a contribution, but feel stuck -
+please do not be afraid to submit a pull request, we will help you get it in.
```{=include=} sections
hacking/getting-started.md
From 1e9f5d09a73aa42daced8696cfa2ab5f45a0b22b Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 15:45:03 +0300
Subject: [PATCH 37/88] docs/installation: connect custom-configuration section
to the module chapters better
---
docs/manual/installation/custom-configuration.md | 6 ++++--
docs/manual/installation/modules/home-manager.md | 6 ++++--
docs/manual/installation/modules/nixos.md | 6 ++++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/docs/manual/installation/custom-configuration.md b/docs/manual/installation/custom-configuration.md
index 64ae64ee..b6c27163 100644
--- a/docs/manual/installation/custom-configuration.md
+++ b/docs/manual/installation/custom-configuration.md
@@ -58,8 +58,10 @@ An example flake that exposes your custom Neovim configuration might look like
-The next two chapters will detail specific usage of standalone nvf
-configurations on NixOS and Home-Manager.
+The above setup will allow to set up nvf as a standalone flake, which you can
+build independently from your system configuration while also possibly sharing
+it with others. The next two chapters will detail specific usage of such a setup
+for a package output in the context of NixOS or Home-Manager installation.
```{=include=} chapters
standalone/nixos.md
diff --git a/docs/manual/installation/modules/home-manager.md b/docs/manual/installation/modules/home-manager.md
index 6764f797..a2170159 100644
--- a/docs/manual/installation/modules/home-manager.md
+++ b/docs/manual/installation/modules/home-manager.md
@@ -77,7 +77,9 @@ configure **nvf**.
```
::: {.note}
+
**nvf** exposes a lot of options, most of which are not referenced in the
-installation sections of the manual. You may find all avaliable options
-in the [appendix](https://notashelf.github.io/nvf/options)
+installation sections of the manual. You may find all available options in the
+[appendix](https://notashelf.github.io/nvf/options)
+
:::
diff --git a/docs/manual/installation/modules/nixos.md b/docs/manual/installation/modules/nixos.md
index 9cbc1447..d8be2035 100644
--- a/docs/manual/installation/modules/nixos.md
+++ b/docs/manual/installation/modules/nixos.md
@@ -76,7 +76,9 @@ configure **nvf**.
```
::: {.note}
+
**nvf** exposes a lot of options, most of which are not referenced in the
-installation sections of the manual. You may find all avaliable options
-in the [appendix](https://notashelf.github.io/nvf/options)
+installation sections of the manual. You may find all available options in the
+[appendix](https://notashelf.github.io/nvf/options)
+
:::
From cb10266dce8c41499491350d859797474adbcaec Mon Sep 17 00:00:00 2001
From: NotAShelf
Date: Thu, 7 Nov 2024 16:11:53 +0300
Subject: [PATCH 38/88] docs: add anchors to individual headers
Taken from Nixpkgs manual derivation, neat.
---
docs/manual.nix | 108 +++++++++++++++++++------------
docs/static/script/anchor-min.js | 10 +++
docs/static/script/anchor-use.js | 4 ++
3 files changed, 79 insertions(+), 43 deletions(-)
create mode 100644 docs/static/script/anchor-min.js
create mode 100644 docs/static/script/anchor-use.js
diff --git a/docs/manual.nix b/docs/manual.nix
index f5b23d04..b9f9888b 100644
--- a/docs/manual.nix
+++ b/docs/manual.nix
@@ -8,56 +8,78 @@
# nrd configuration
release,
optionsJSON,
-}:
-stdenvNoCC.mkDerivation {
- name = "nvf-manual";
- src = builtins.path {
- path = lib.sourceFilesBySuffices ./manual [".md"];
+} @ args: let
+ manual-release = args.release or "unstable";
+in
+ stdenvNoCC.mkDerivation {
name = "nvf-manual";
- };
+ src = builtins.path {
+ name = "nvf-manual-${manual-release}";
+ path = lib.sourceFilesBySuffices ./manual [".md" ".md.in"];
+ };
- nativeBuildInputs = [nixos-render-docs];
+ nativeBuildInputs = [nixos-render-docs];
- buildPhase = ''
- dest="$out/share/doc/nvf"
- mkdir -p "$(dirname "$dest")"
- mkdir -p $dest/{highlightjs,media}
+ postPatch = ''
+ ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
+ '';
- cp -vt $dest/highlightjs \
- ${documentation-highlighter}/highlight.pack.js \
- ${documentation-highlighter}/LICENSE \
- ${documentation-highlighter}/mono-blue.css \
- ${documentation-highlighter}/loader.js
+ buildPhase = ''
+ dest="$out/share/doc/nvf"
+ mkdir -p "$(dirname "$dest")"
+ mkdir -p $dest/{highlightjs,script}
- substituteInPlace ./options.md \
- --subst-var-by \
- OPTIONS_JSON \
- ${optionsJSON}/share/doc/nixos/options.json
+ # Copy highlight scripts to /highlights in document root.
+ cp -vt $dest/highlightjs \
+ ${documentation-highlighter}/highlight.pack.js \
+ ${documentation-highlighter}/LICENSE \
+ ${documentation-highlighter}/mono-blue.css \
+ ${documentation-highlighter}/loader.js
- substituteInPlace ./manual.md \
- --subst-var-by \
- NVF_VERSION \
- ${release}
+ cp -vt $dest/script \
+ ${./static/script}/anchor-min.js \
+ ${./static/script}/anchor-use.js
- # copy stylesheet
- cp ${./static/style.css} "$dest/style.css"
+ substituteInPlace ./options.md \
+ --subst-var-by OPTIONS_JSON ./config-options.json
- # copy release notes
- cp -vr ${./release-notes} release-notes
+ substituteInPlace ./manual.md \
+ --subst-var-by NVF_VERSION ${manual-release} \
+ --subst-var-by NVF_SRC "https://github.com/nvf/blob/${manual-release}"
- # generate manual from
- nixos-render-docs manual html \
- --manpage-urls ${path + "/doc/manpage-urls.json"} \
- --revision ${lib.trivial.revisionWithDefault release} \
- --stylesheet style.css \
- --script highlightjs/highlight.pack.js \
- --script highlightjs/loader.js \
- --toc-depth 2 \
- --section-toc-depth 1 \
- manual.md \
- "$dest/index.xhtml"
+ # copy stylesheet
+ cp ${./static/style.css} "$dest/style.css"
- mkdir -p $out/nix-support/
- echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
- '';
-}
+
+ # copy release notes
+ cp -vr ${./release-notes} release-notes
+
+ # Generate final manual from a set of parameters. Explanation of the CLI flags are
+ # as follows:
+ #
+ # 1. --manpage-urls will allow you to use manual pages as they are defined in
+ # the nixpkgs documentation.
+ # 2. --revision is the project revision as it is defined in 'release.json' in the
+ # repository root
+ # 3. --script will inject a given Javascript file into the resulting pages inside
+ # the