mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
Compare commits
7 commits
0b2fa2e38a
...
56dd5f3f11
Author | SHA1 | Date | |
---|---|---|---|
|
56dd5f3f11 | ||
|
f9769dcdb4 | ||
|
4adf0aa5da | ||
|
ca6e46e3d9 | ||
|
11bb327ab5 | ||
|
33f584b8e1 | ||
|
12b650fea7 |
7 changed files with 87 additions and 78 deletions
|
@ -79,14 +79,14 @@
|
||||||
expr = true;
|
expr = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSetLznBinding = binding: action: {
|
mkSetLznBinding = mode: binding: action: {
|
||||||
inherit action;
|
inherit action mode;
|
||||||
key = binding.value;
|
key = binding.value;
|
||||||
desc = binding.description;
|
desc = binding.description;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSetLuaLznBinding = binding: action: {
|
mkSetLuaLznBinding = mode: binding: action: {
|
||||||
inherit action;
|
inherit action mode;
|
||||||
key = binding.value;
|
key = binding.value;
|
||||||
lua = true;
|
lua = true;
|
||||||
desc = binding.description;
|
desc = binding.description;
|
||||||
|
|
|
@ -60,7 +60,7 @@ in {
|
||||||
inherit (cfg.ui) setupOpts;
|
inherit (cfg.ui) setupOpts;
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
(mkSetLuaLznBinding "n" mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ in {
|
||||||
|
|
||||||
cmd = "Trouble";
|
cmd = "Trouble";
|
||||||
keys = [
|
keys = [
|
||||||
(mkSetLznBinding mappings.toggle "<cmd>TroubleToggle<CR>")
|
(mkSetLznBinding "n" mappings.toggle "<cmd>TroubleToggle<CR>")
|
||||||
(mkSetLznBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
(mkSetLznBinding "n" mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>")
|
||||||
(mkSetLznBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
(mkSetLznBinding "n" mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>")
|
||||||
(mkSetLznBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
(mkSetLznBinding "n" mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>")
|
||||||
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
(mkSetLznBinding "n" mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||||
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
(mkSetLznBinding "n" mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ in {
|
||||||
[(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")]
|
[(mkLznBinding ["n"] cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal")]
|
||||||
++ optional cfg.lazygit.enable {
|
++ optional cfg.lazygit.enable {
|
||||||
key = cfg.lazygit.mappings.open;
|
key = cfg.lazygit.mappings.open;
|
||||||
|
mode = "n";
|
||||||
desc = lazygitMapDesc;
|
desc = lazygitMapDesc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,36 +34,36 @@ in {
|
||||||
|
|
||||||
keys =
|
keys =
|
||||||
[
|
[
|
||||||
(mkSetLznBinding mappings.findFiles "<cmd> Telescope find_files<CR>")
|
(mkSetLznBinding "n" mappings.findFiles "<cmd> Telescope find_files<CR>")
|
||||||
(mkSetLznBinding mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
(mkSetLznBinding "n" mappings.liveGrep "<cmd> Telescope live_grep<CR>")
|
||||||
(mkSetLznBinding mappings.buffers "<cmd> Telescope buffers<CR>")
|
(mkSetLznBinding "n" mappings.buffers "<cmd> Telescope buffers<CR>")
|
||||||
(mkSetLznBinding mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
(mkSetLznBinding "n" mappings.helpTags "<cmd> Telescope help_tags<CR>")
|
||||||
(mkSetLznBinding mappings.open "<cmd> Telescope<CR>")
|
(mkSetLznBinding "n" mappings.open "<cmd> Telescope<CR>")
|
||||||
|
|
||||||
(mkSetLznBinding mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
(mkSetLznBinding "n" mappings.gitCommits "<cmd> Telescope git_commits<CR>")
|
||||||
(mkSetLznBinding mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
(mkSetLznBinding "n" mappings.gitBufferCommits "<cmd> Telescope git_bcommits<CR>")
|
||||||
(mkSetLznBinding mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
(mkSetLznBinding "n" mappings.gitBranches "<cmd> Telescope git_branches<CR>")
|
||||||
(mkSetLznBinding mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
(mkSetLznBinding "n" mappings.gitStatus "<cmd> Telescope git_status<CR>")
|
||||||
(mkSetLznBinding mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
(mkSetLznBinding "n" mappings.gitStash "<cmd> Telescope git_stash<CR>")
|
||||||
]
|
]
|
||||||
++ (optionals config.vim.lsp.enable [
|
++ (optionals config.vim.lsp.enable [
|
||||||
(mkSetLznBinding mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
(mkSetLznBinding "n" mappings.lspDocumentSymbols "<cmd> Telescope lsp_document_symbols<CR>")
|
||||||
(mkSetLznBinding mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
(mkSetLznBinding "n" mappings.lspWorkspaceSymbols "<cmd> Telescope lsp_workspace_symbols<CR>")
|
||||||
|
|
||||||
(mkSetLznBinding mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
(mkSetLznBinding "n" mappings.lspReferences "<cmd> Telescope lsp_references<CR>")
|
||||||
(mkSetLznBinding mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
(mkSetLznBinding "n" mappings.lspImplementations "<cmd> Telescope lsp_implementations<CR>")
|
||||||
(mkSetLznBinding mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
(mkSetLznBinding "n" mappings.lspDefinitions "<cmd> Telescope lsp_definitions<CR>")
|
||||||
(mkSetLznBinding mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
(mkSetLznBinding "n" mappings.lspTypeDefinitions "<cmd> Telescope lsp_type_definitions<CR>")
|
||||||
(mkSetLznBinding mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
(mkSetLznBinding "n" mappings.diagnostics "<cmd> Telescope diagnostics<CR>")
|
||||||
])
|
])
|
||||||
++ (
|
++ (
|
||||||
optionals config.vim.treesitter.enable [
|
optionals config.vim.treesitter.enable [
|
||||||
(mkSetLznBinding mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
(mkSetLznBinding "n" mappings.treesitter "<cmd> Telescope treesitter<CR>")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
++ (
|
++ (
|
||||||
optionals config.vim.projects.project-nvim.enable [
|
optionals config.vim.projects.project-nvim.enable [
|
||||||
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
(mkSetLznBinding "n" mappings.findProjects "<cmd Telescope projects<CR>")
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.dag) entryBefore entryAfter;
|
|
||||||
cfg = config.vim.lazy;
|
cfg = config.vim.lazy;
|
||||||
|
|
||||||
toLuaLznKeySpec = keySpec:
|
toLuaLznKeySpec = keySpec:
|
||||||
|
@ -50,6 +49,16 @@
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
load =
|
||||||
|
if spec.load != null
|
||||||
|
then
|
||||||
|
mkLuaInline ''
|
||||||
|
funcion()
|
||||||
|
${spec.load}
|
||||||
|
end
|
||||||
|
''
|
||||||
|
else null;
|
||||||
|
|
||||||
keys =
|
keys =
|
||||||
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
||||||
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
|
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
|
||||||
|
|
|
@ -22,21 +22,21 @@
|
||||||
'';
|
'';
|
||||||
|
|
||||||
desc = mkOption {
|
desc = mkOption {
|
||||||
description = "Description of the key map";
|
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Description of the key map";
|
||||||
};
|
};
|
||||||
|
|
||||||
ft = mkOption {
|
ft = mkOption {
|
||||||
description = "TBD";
|
|
||||||
type = nullOr (listOf str);
|
type = nullOr (listOf str);
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "TBD";
|
||||||
};
|
};
|
||||||
|
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
description = "Modes to bind in";
|
|
||||||
type = either str (listOf str);
|
type = either str (listOf str);
|
||||||
default = ["n" "x" "s" "o"];
|
example = ["n" "x" "o"];
|
||||||
|
description = "Modes to bind in";
|
||||||
};
|
};
|
||||||
|
|
||||||
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
silent = mkBool true "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||||
|
@ -48,6 +48,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 {
|
lznPluginType = submodule {
|
||||||
options = {
|
options = {
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
|
@ -57,84 +72,67 @@
|
||||||
|
|
||||||
setupModule = mkOption {
|
setupModule = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Lua module to run setup function on.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lua module to run setup function on.";
|
||||||
};
|
};
|
||||||
|
|
||||||
setupOpts = mkOption {
|
setupOpts = mkOption {
|
||||||
type = submodule {freeformType = attrsOf anything;};
|
type = attrsOf anything;
|
||||||
description = "Options to pass to the setup function";
|
|
||||||
default = {};
|
default = {};
|
||||||
|
description = "Options to pass to the setup function";
|
||||||
};
|
};
|
||||||
|
|
||||||
# lz.n options
|
# lz.n options
|
||||||
|
|
||||||
enabled = mkOption {
|
enabled = mkOption {
|
||||||
type = nullOr (either bool str);
|
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;
|
default = null;
|
||||||
|
description = "When false, or if the lua function returns false, this plugin will not be included in the spec";
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll = mkOption {
|
beforeAll = mkOption {
|
||||||
type = nullOr lines;
|
type = nullOr lines;
|
||||||
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lua code to run before any plugins are loaded. This will be wrapped in a function.";
|
||||||
};
|
};
|
||||||
|
|
||||||
before = mkOption {
|
before = mkOption {
|
||||||
type = nullOr lines;
|
type = nullOr lines;
|
||||||
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lua code to run before plugin is loaded. This will be wrapped in a function.";
|
||||||
};
|
};
|
||||||
|
|
||||||
after = mkOption {
|
after = mkOption {
|
||||||
type = nullOr lines;
|
type = nullOr lines;
|
||||||
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Lua code to run after plugin is loaded. This will be wrapped in a function.
|
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`.
|
If [](#opt-vim.lazy.plugins._name_.setupModule) is provided, the setup will be ran before `after`.
|
||||||
'';
|
'';
|
||||||
default = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
event = mkOption {
|
event = mkOption {
|
||||||
description = "Lazy-load on event";
|
type = nullOr (oneOf [str (listOf str) lznEvent]);
|
||||||
default = null;
|
default = null;
|
||||||
type = let
|
description = "Lazy-load on event";
|
||||||
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]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cmd = mkOption {
|
cmd = mkOption {
|
||||||
description = "Lazy-load on command";
|
|
||||||
default = null;
|
|
||||||
type = nullOr (either str (listOf str));
|
type = nullOr (either str (listOf str));
|
||||||
|
default = null;
|
||||||
|
description = "Lazy-load on command";
|
||||||
};
|
};
|
||||||
|
|
||||||
ft = mkOption {
|
ft = mkOption {
|
||||||
description = "Lazy-load on filetype";
|
|
||||||
default = null;
|
|
||||||
type = nullOr (either str (listOf str));
|
type = nullOr (either str (listOf str));
|
||||||
|
default = null;
|
||||||
|
description = "Lazy-load on filetype";
|
||||||
};
|
};
|
||||||
|
|
||||||
keys = mkOption {
|
keys = mkOption {
|
||||||
description = "Lazy-load on key mapping";
|
|
||||||
default = null;
|
|
||||||
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
|
||||||
|
default = null;
|
||||||
example = ''
|
example = ''
|
||||||
keys = [
|
keys = [
|
||||||
{
|
{
|
||||||
|
@ -152,20 +150,21 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
'';
|
'';
|
||||||
|
description = "Lazy-load on key mapping";
|
||||||
};
|
};
|
||||||
|
|
||||||
colorscheme = mkOption {
|
colorscheme = mkOption {
|
||||||
description = "Lazy-load on colorscheme.";
|
|
||||||
type = nullOr (either str (listOf str));
|
type = nullOr (either str (listOf str));
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Lazy-load on colorscheme.";
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
|
lazy = mkBool false "Lazy-load manually, e.g. using `trigger_load`.";
|
||||||
|
|
||||||
priority = mkOption {
|
priority = mkOption {
|
||||||
type = nullOr int;
|
type = nullOr int;
|
||||||
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
|
||||||
default = null;
|
default = null;
|
||||||
|
description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first.";
|
||||||
};
|
};
|
||||||
|
|
||||||
load = mkOption {
|
load = mkOption {
|
||||||
|
@ -183,20 +182,14 @@ in {
|
||||||
options.vim.lazy = {
|
options.vim.lazy = {
|
||||||
enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;};
|
enable = mkEnableOption "plugin lazy-loading via lz.n and lzn-auto-require" // {default = true;};
|
||||||
loader = mkOption {
|
loader = mkOption {
|
||||||
description = "Lazy loader to use";
|
|
||||||
type = enum ["lz.n"];
|
type = enum ["lz.n"];
|
||||||
default = "lz.n";
|
default = "lz.n";
|
||||||
|
description = "Lazy loader to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = mkOption {
|
plugins = mkOption {
|
||||||
default = {};
|
|
||||||
type = attrsOf lznPluginType;
|
type = attrsOf lznPluginType;
|
||||||
description = ''
|
default = {};
|
||||||
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`.
|
|
||||||
'';
|
|
||||||
example = ''
|
example = ''
|
||||||
{
|
{
|
||||||
toggleterm-nvim = {
|
toggleterm-nvim = {
|
||||||
|
@ -214,15 +207,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 {
|
enableLznAutoRequire = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Enable lzn-auto-require. Since builtin plugins rely on this, only turn
|
Enable lzn-auto-require. Since builtin plugins rely on this, only turn
|
||||||
off for debugging.
|
off for debugging.
|
||||||
'';
|
'';
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
builtLazyConfig = mkOption {
|
builtLazyConfig = mkOption {
|
||||||
|
|
Loading…
Reference in a new issue