mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 19:11:15 +00:00
Compare commits
1 commit
b8aed0e102
...
7bb3a337ff
Author | SHA1 | Date | |
---|---|---|---|
|
7bb3a337ff |
27 changed files with 380 additions and 534 deletions
|
@ -174,7 +174,6 @@ isMaximal: {
|
|||
|
||||
notes = {
|
||||
obsidian.enable = false; # FIXME: neovim fails to build if obsidian is enabled
|
||||
neorg.enable = false;
|
||||
orgmode.enable = false;
|
||||
mind-nvim.enable = isMaximal;
|
||||
todo-comments.enable = true;
|
||||
|
|
|
@ -136,7 +136,8 @@ plugins are managed by `lz.n`.
|
|||
let
|
||||
cfg = config.vim.your-plugin;
|
||||
in {
|
||||
vim.lazy.plugins.your-plugin = {
|
||||
vim.lazy.plugins = [
|
||||
{
|
||||
# instead of vim.startPlugins, use this:
|
||||
package = "your-plugin";
|
||||
|
||||
|
@ -156,9 +157,9 @@ in {
|
|||
mode = "n";
|
||||
action = ":YourPluginCommand";
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
};
|
||||
;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -63,14 +63,6 @@ Note that we are looking to add more alternatives in the future like
|
|||
dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for
|
||||
everyone.
|
||||
|
||||
### `type` based modules removed {#sec-type-based-modules-removed}
|
||||
|
||||
As part of the autocompletion rewrite, modules that used to use a `type` option
|
||||
have been replaced by per-plugin modules instead. Since both modules only had
|
||||
one type, you can simply change
|
||||
- `vim.autocomplete.*` -> `vim.autocomplete.nvim-cmp.*`
|
||||
- `vim.autopairs.enable` -> `vim.autopairs.nvim-autopairs.enable`
|
||||
|
||||
## Changelog {#sec-release-0.7-changelog}
|
||||
|
||||
[ItsSorae](https://github.com/ItsSorae):
|
||||
|
@ -274,10 +266,8 @@ one type, you can simply change
|
|||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||
ccc
|
||||
- Add Neorg support under `vim.notes.neorg`
|
||||
- Add LSP, diagnostics, formatter and Treesitter support for Kotlin under
|
||||
`vim.languages.kotlin`
|
||||
- changed default keybinds for leap.nvim to avoid altering expected behavior
|
||||
|
||||
[Bloxx12](https://github.com/Bloxx12)
|
||||
|
||||
|
@ -289,4 +279,3 @@ one type, you can simply change
|
|||
|
||||
- Add LSP support for Scala via
|
||||
[nvim-metals](https://github.com/scalameta/nvim-metals)
|
||||
|
||||
|
|
68
flake.lock
68
flake.lock
|
@ -828,22 +828,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-lua-utils-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1708177208,
|
||||
"narHash": "sha256-9ildzQEMkXKZ3LHq+khGFgRQFxlIXQclQ7QU3fcU1C4=",
|
||||
"owner": "nvim-neorg",
|
||||
"repo": "lua-utils.nvim",
|
||||
"rev": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-neorg",
|
||||
"repo": "lua-utils.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-lualine": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1005,38 +989,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-neorg": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1727821831,
|
||||
"narHash": "sha256-yfWQ6yKytu1jkWUtRZTVICslUWej6jVYv7frmSB7/6Q=",
|
||||
"owner": "nvim-neorg",
|
||||
"repo": "neorg",
|
||||
"rev": "afc9a37bf021acb0853e95714c4c6436e1588286",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-neorg",
|
||||
"repo": "neorg",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-neorg-telescope": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1722358034,
|
||||
"narHash": "sha256-ei4uUqpIQjGKzu5ryu0Hlmis9TS9FJsYnjt4J4QdWlw=",
|
||||
"owner": "nvim-neorg",
|
||||
"repo": "neorg-telescope",
|
||||
"rev": "ddb2556644cae922699a239bbb0fe16e25b084b7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-neorg",
|
||||
"repo": "neorg-telescope",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-new-file-template-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1550,22 +1502,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-pathlib-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1724943804,
|
||||
"narHash": "sha256-YhCJeNKlcjgg3q51UWFhuIEPzNueC8YTpeuPPJDndvw=",
|
||||
"owner": "pysan3",
|
||||
"repo": "pathlib.nvim",
|
||||
"rev": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "pysan3",
|
||||
"repo": "pathlib.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugin-plenary-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -1988,7 +1924,6 @@
|
|||
"plugin-lsp-signature": "plugin-lsp-signature",
|
||||
"plugin-lspkind": "plugin-lspkind",
|
||||
"plugin-lspsaga": "plugin-lspsaga",
|
||||
"plugin-lua-utils-nvim": "plugin-lua-utils-nvim",
|
||||
"plugin-lualine": "plugin-lualine",
|
||||
"plugin-luasnip": "plugin-luasnip",
|
||||
"plugin-lz-n": "plugin-lz-n",
|
||||
|
@ -1999,8 +1934,6 @@
|
|||
"plugin-neo-tree-nvim": "plugin-neo-tree-nvim",
|
||||
"plugin-neocord": "plugin-neocord",
|
||||
"plugin-neodev-nvim": "plugin-neodev-nvim",
|
||||
"plugin-neorg": "plugin-neorg",
|
||||
"plugin-neorg-telescope": "plugin-neorg-telescope",
|
||||
"plugin-new-file-template-nvim": "plugin-new-file-template-nvim",
|
||||
"plugin-noice-nvim": "plugin-noice-nvim",
|
||||
"plugin-none-ls": "plugin-none-ls",
|
||||
|
@ -2033,7 +1966,6 @@
|
|||
"plugin-orgmode-nvim": "plugin-orgmode-nvim",
|
||||
"plugin-otter-nvim": "plugin-otter-nvim",
|
||||
"plugin-oxocarbon": "plugin-oxocarbon",
|
||||
"plugin-pathlib-nvim": "plugin-pathlib-nvim",
|
||||
"plugin-plenary-nvim": "plugin-plenary-nvim",
|
||||
"plugin-project-nvim": "plugin-project-nvim",
|
||||
"plugin-registers": "plugin-registers",
|
||||
|
|
20
flake.nix
20
flake.nix
|
@ -657,26 +657,6 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
plugin-lua-utils-nvim = {
|
||||
url = "github:nvim-neorg/lua-utils.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-pathlib-nvim = {
|
||||
url = "github:pysan3/pathlib.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-neorg = {
|
||||
url = "github:nvim-neorg/neorg";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-neorg-telescope = {
|
||||
url = "github:nvim-neorg/neorg-telescope";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
plugin-nui-nvim = {
|
||||
# (required by noice.nvim)
|
||||
url = "github:MunifTanjim/nui.nvim";
|
||||
|
|
|
@ -31,11 +31,6 @@ in {
|
|||
vim.autocomplete.type has been removed in favor of per-plugin modules.
|
||||
You can enable nvim-cmp with vim.autocomplete.nvim-cmp.enable instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "autocomplete" "sources"] ''
|
||||
vim.autocomplete.sources has been removed in favor of per-plugin modules.
|
||||
You can add nvim-cmp sources with vim.autocomplete.nvim-cmp.sources
|
||||
instead.
|
||||
'')
|
||||
(mkRemovedOptionModule ["vim" "snippets" "vsnip" "enable"] ''
|
||||
vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip.
|
||||
'')
|
||||
|
|
|
@ -11,15 +11,19 @@
|
|||
inherit (self.options.vim.comments.comment-nvim) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["comment-nvim"];
|
||||
vim.startPlugins = [
|
||||
"comment-nvim"
|
||||
];
|
||||
|
||||
vim.lazy.plugins.comment-nvim = {
|
||||
vim.lazy.plugins = [
|
||||
{
|
||||
package = "comment-nvim";
|
||||
setupModule = "Comment";
|
||||
inherit (cfg) setupOpts;
|
||||
keys = [
|
||||
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderLine "<Plug>(comment_toggle_linewise)" mappings.toggleOpLeaderLine.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.toggleOpLeaderBlock "<Plug>(comment_toggle_blockwise)" mappings.toggleOpLeaderBlock.description)
|
||||
|
||||
(mkLznExprBinding ["n"] cfg.mappings.toggleCurrentLine ''
|
||||
function()
|
||||
return vim.api.nvim_get_vvar('count') == 0 and '<Plug>(comment_toggle_linewise_current)'
|
||||
|
@ -37,6 +41,7 @@ in {
|
|||
(mkLznBinding ["x"] cfg.mappings.toggleSelectedLine "<Plug>(comment_toggle_linewise_visual)" mappings.toggleSelectedLine.description)
|
||||
(mkLznBinding ["x"] cfg.mappings.toggleSelectedBlock "<Plug>(comment_toggle_blockwise_visual)" mappings.toggleSelectedBlock.description)
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,13 +6,17 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (builtins) attrNames;
|
||||
|
||||
cfg = config.vim.autocomplete.nvim-cmp;
|
||||
luasnipEnable = config.vim.snippets.luasnip.enable;
|
||||
inherit (cfg) mappings;
|
||||
|
||||
self = import ./nvim-cmp.nix {inherit lib config;};
|
||||
mappingDefinitions = self.options.vim.autocomplete.nvim-cmp.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
|
@ -41,20 +45,39 @@ in {
|
|||
};
|
||||
|
||||
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs" "luasnip"] ''
|
||||
${optionalString luasnipEnable "local luasnip = require('luasnip')"}
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
cmp.setup(${toLuaObject cfg.setupOpts})
|
||||
'');
|
||||
|
||||
# `cmp` and `luasnip` are defined above, in the `nvim-cmp` section
|
||||
autocomplete.nvim-cmp.setupOpts.mapping = {
|
||||
${mappings.complete} = mkLuaInline "cmp.mapping.complete()";
|
||||
${mappings.close} = mkLuaInline "cmp.mapping.abort()";
|
||||
${mappings.scrollDocsUp} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
|
||||
${mappings.scrollDocsDown} = mkLuaInline "cmp.mapping.scroll_docs(4)";
|
||||
${mappings.confirm} = mkLuaInline "cmp.mapping.confirm({ select = true })";
|
||||
${mappings.complete.value} = mkLuaInline "cmp.mapping.complete()";
|
||||
${mappings.close.value} = mkLuaInline "cmp.mapping.abort()";
|
||||
${mappings.scrollDocsUp.value} = mkLuaInline "cmp.mapping.scroll_docs(-4)";
|
||||
${mappings.scrollDocsDown.value} = mkLuaInline "cmp.mapping.scroll_docs(4)";
|
||||
|
||||
${mappings.next} = mkLuaInline ''
|
||||
${mappings.confirm.value} = mkLuaInline ''
|
||||
cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
${
|
||||
if luasnipEnable
|
||||
then ''
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.confirm({ select = true })
|
||||
end
|
||||
''
|
||||
else "cmp.confirm({ select = true })"
|
||||
}
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end)
|
||||
'';
|
||||
|
||||
${mappings.next.value} = mkLuaInline ''
|
||||
cmp.mapping(function(fallback)
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
|
@ -75,7 +98,7 @@ in {
|
|||
end)
|
||||
'';
|
||||
|
||||
${mappings.previous} = mkLuaInline ''
|
||||
${mappings.previous.value} = mkLuaInline ''
|
||||
cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
|
|
|
@ -54,7 +54,8 @@ in {
|
|||
vim = {
|
||||
startPlugins = ["nvim-nio"];
|
||||
|
||||
lazy.plugins.nvim-dap-ui = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "nvim-dap-ui";
|
||||
setupModule = "dapui";
|
||||
setupOpts = {};
|
||||
|
@ -62,7 +63,8 @@ in {
|
|||
keys = [
|
||||
(mkSetLuaLznBinding mappings.toggleDapUI "function() require('dapui').toggle() end")
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
pluginRC.nvim-dap-ui = entryAfter ["nvim-dap"] (
|
||||
optionalString cfg.ui.autoStart ''
|
||||
|
|
|
@ -14,15 +14,19 @@ in {
|
|||
"plenary-nvim" # commons library
|
||||
"image-nvim" # optional for image previews
|
||||
"nui-nvim" # ui library
|
||||
# neotree
|
||||
"neo-tree-nvim"
|
||||
];
|
||||
|
||||
lazy.plugins.neo-tree-nvim = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "neo-tree-nvim";
|
||||
setupModule = "neo-tree";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
cmd = ["Neotree"];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
visuals.nvimWebDevicons.enable = true;
|
||||
};
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>t" = "+NvimTree";
|
||||
};
|
||||
|
||||
lazy.plugins.nvim-tree-lua = {
|
||||
vim.lazy.plugins = [
|
||||
{
|
||||
package = "nvim-tree-lua";
|
||||
setupModule = "nvim-tree";
|
||||
inherit (cfg) setupOpts;
|
||||
|
@ -31,9 +31,10 @@ in {
|
|||
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
pluginRC.nvimtreelua = entryAnywhere ''
|
||||
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
||||
${
|
||||
optionalString cfg.setupOpts.disable_netrw ''
|
||||
-- disable netrew completely
|
||||
|
@ -84,5 +85,4 @@ in {
|
|||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
in {
|
||||
config = mkIf (cfg.enable && cfg.trouble.enable) {
|
||||
vim = {
|
||||
lazy.plugins.trouble = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "trouble";
|
||||
setupModule = "trouble";
|
||||
inherit (cfg.trouble) setupOpts;
|
||||
|
@ -28,7 +29,8 @@ in {
|
|||
(mkSetLznBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>")
|
||||
(mkSetLznBinding mappings.locList "<cmd>TroubleToggle loclist<CR>")
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>l" = "Trouble";
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
imports = [
|
||||
./obsidian
|
||||
./orgmode
|
||||
./neorg
|
||||
./mind-nvim
|
||||
./todo-comments
|
||||
];
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.notes.neorg;
|
||||
in {
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
vim = {
|
||||
startPlugins = [
|
||||
"lua-utils-nvim"
|
||||
"nui-nvim"
|
||||
"nvim-nio"
|
||||
"pathlib-nvim"
|
||||
"plenary-nvim"
|
||||
"neorg"
|
||||
"neorg-telescope"
|
||||
];
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>o" = "+Notes";
|
||||
};
|
||||
|
||||
pluginRC.neorg = entryAnywhere ''
|
||||
require('neorg').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.norgPackage];
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./neorg.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) submodule listOf str;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.notes.neorg = {
|
||||
enable = mkEnableOption ''
|
||||
Neorg: An intuitive note-taking and organization tool with a structured nested syntax.
|
||||
'';
|
||||
|
||||
setupOpts = mkPluginSetupOption "Neorg" {
|
||||
load = {
|
||||
"core.defaults" = mkOption {
|
||||
default = {};
|
||||
description = ''
|
||||
all of the most important modules that any user would want to have a "just works" experience
|
||||
'';
|
||||
|
||||
type = submodule {
|
||||
options = {
|
||||
enable = mkEnableOption ''
|
||||
all of the most important modules that any user would want to have a "just works" experience
|
||||
'';
|
||||
config = {
|
||||
disable = mkOption {
|
||||
description = ''
|
||||
list of modules from to be disabled from core.defaults
|
||||
'';
|
||||
type = listOf str;
|
||||
default = [];
|
||||
example = ["core.autocommands" "core.itero"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Neorg treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
norgPackage = mkGrammarOption pkgs "norg";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -14,7 +14,8 @@
|
|||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
lazy.plugins.toggleterm-nvim = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "toggleterm-nvim";
|
||||
cmd = ["ToggleTerm" "ToggleTermSendCurrentLine" "ToggleTermSendVisualLines" "ToggleTermSendVisualSelection" "ToggleTermSetName" "ToggleTermToggleAll"];
|
||||
keys = [
|
||||
|
@ -44,7 +45,8 @@ in {
|
|||
|
||||
vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = '${lazygitMapDesc}'})
|
||||
'';
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,13 +9,15 @@
|
|||
cfg = config.vim.binds.cheatsheet;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.lazy.plugins.cheatsheet-nvim = {
|
||||
vim.lazy.plugins = [
|
||||
{
|
||||
package = "cheatsheet-nvim";
|
||||
setupModule = "cheatsheet";
|
||||
setupOpts = {};
|
||||
cmd = ["Cheatsheet" "CheatsheetEdit"];
|
||||
|
||||
before = optionalString config.vim.lazy.enable "require('lz.n').trigger_load('telescope')";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,12 +10,14 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["plenary-nvim"];
|
||||
lazy.plugins.diffview-nvim = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "diffview-nvim";
|
||||
cmd = ["DiffviewClose" "DiffviewFileHistory" "DiffviewFocusFiles" "DiffviewLog" "DiffviewOpen" "DiffviewRefresh" "DiffviewToggleFiles"];
|
||||
setupModule = "diffview";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["dressing-nvim"];
|
||||
|
||||
vim.lazy.plugins.icon-picker-nvim = {
|
||||
vim.lazy.plugins = [
|
||||
{
|
||||
package = "icon-picker-nvim";
|
||||
setupModule = "icon-picker";
|
||||
setupOpts = {
|
||||
|
@ -18,6 +19,7 @@ in {
|
|||
};
|
||||
|
||||
cmd = ["IconPickerInsert" "IconPickerNormal" "IconPickerYank"];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkLznBinding;
|
||||
|
||||
cfg = config.vim.utility.motion.leap;
|
||||
|
@ -11,7 +11,8 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["vim-repeat"];
|
||||
lazy.plugins.leap-nvim = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "leap-nvim";
|
||||
keys = [
|
||||
(mkLznBinding ["n" "o" "x"] cfg.mappings.leapForwardTo "<Plug>(leap-forward-to)" "Leap forward to")
|
||||
|
@ -53,9 +54,8 @@ in {
|
|||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
binds.whichKey.register."<leader>s" = mkDefault "+Leap";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,22 +9,22 @@ in {
|
|||
leapForwardTo = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap forward to";
|
||||
default = "<leader>ss";
|
||||
default = "s";
|
||||
};
|
||||
leapBackwardTo = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap backward to";
|
||||
default = "<leader>sS";
|
||||
default = "S";
|
||||
};
|
||||
leapForwardTill = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap forward till";
|
||||
default = "<leader>sx";
|
||||
default = "x";
|
||||
};
|
||||
leapBackwardTill = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Leap backward till";
|
||||
default = "<leader>sX";
|
||||
default = "X";
|
||||
};
|
||||
leapFromWindow = mkOption {
|
||||
type = nullOr str;
|
||||
|
|
|
@ -30,7 +30,8 @@ in {
|
|||
startPlugins = ["nvim-surround"];
|
||||
pluginRC.surround = entryAnywhere "require('nvim-surround').setup(${toLuaObject cfg.setupOpts})";
|
||||
|
||||
lazy.plugins.nvim-surround = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "nvim-surround";
|
||||
setupModule = "nvim-surround";
|
||||
inherit (cfg) setupOpts;
|
||||
|
@ -47,7 +48,8 @@ in {
|
|||
change
|
||||
change_line
|
||||
]);
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
utility.surround.setupOpts.keymaps = mkIf cfg.useVendoredKeybindings vendoredKeybinds;
|
||||
};
|
||||
|
|
|
@ -20,7 +20,8 @@ in {
|
|||
vim = {
|
||||
startPlugins = ["plenary-nvim"];
|
||||
|
||||
lazy.plugins.telescope = {
|
||||
lazy.plugins = [
|
||||
{
|
||||
package = "telescope";
|
||||
setupModule = "telescope";
|
||||
inherit (cfg) setupOpts;
|
||||
|
@ -68,7 +69,8 @@ in {
|
|||
(mkSetLznBinding mappings.findProjects "<cmd Telescope projects<CR>")
|
||||
]
|
||||
);
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
binds.whichKey.register = pushDownDefault {
|
||||
"<leader>f" = "+Telescope";
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
cfg = config.vim.visuals.fidget-nvim;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.lazy.plugins.fidget-nvim = {
|
||||
vim.lazy.plugins = [
|
||||
{
|
||||
package = "fidget-nvim";
|
||||
setupModule = "fidget";
|
||||
event = "LspAttach";
|
||||
inherit (cfg) setupOpts;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) toJSON typeOf head length filter concatLists concatStringsSep;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (builtins) toJSON typeOf head length tryEval filter concatLists concatStringsSep;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.strings) optionalString;
|
||||
|
@ -22,7 +21,14 @@
|
|||
else keySpec.action;
|
||||
};
|
||||
|
||||
toLuaLznSpec = name: spec:
|
||||
toLuaLznSpec = spec: let
|
||||
name =
|
||||
if typeOf spec.package == "string"
|
||||
then spec.package
|
||||
else if (spec.package ? pname && (tryEval spec.package.pname).success)
|
||||
then spec.package.pname
|
||||
else spec.package.name;
|
||||
in
|
||||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||
// {
|
||||
"@1" = name;
|
||||
|
@ -56,9 +62,9 @@
|
|||
# empty list or str or (listOf str)
|
||||
else spec.keys;
|
||||
};
|
||||
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
||||
lznSpecs = map toLuaLznSpec cfg.plugins;
|
||||
|
||||
specToNotLazyConfig = _: spec: ''
|
||||
specToNotLazyConfig = spec: ''
|
||||
do
|
||||
${optionalString (spec.before != null) spec.before}
|
||||
${optionalString (spec.setupModule != null)
|
||||
|
@ -67,32 +73,34 @@
|
|||
end
|
||||
'';
|
||||
|
||||
specToKeymaps = _: spec:
|
||||
specToKeymaps = spec:
|
||||
if typeOf spec.keys == "list"
|
||||
then map (x: removeAttrs x ["ft"]) (filter (lznKey: lznKey.action != null && lznKey.ft == null) spec.keys)
|
||||
else if spec.keys == null || typeOf spec.keys == "string"
|
||||
then []
|
||||
else [spec.keys];
|
||||
|
||||
notLazyConfig = concatStringsSep "\n" (mapAttrsToList specToNotLazyConfig cfg.plugins);
|
||||
notLazyConfig = concatStringsSep "\n" (map specToNotLazyConfig cfg.plugins);
|
||||
in {
|
||||
config.vim = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
startPlugins = ["lz-n" "lzn-auto-require"];
|
||||
|
||||
optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
||||
optPlugins = map (plugin: plugin.package) cfg.plugins;
|
||||
|
||||
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
|
||||
require('lz.n').load(${toLuaObject lznSpecs})
|
||||
'';
|
||||
})
|
||||
(mkIf (!cfg.enable) {
|
||||
startPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
||||
(
|
||||
mkIf (!cfg.enable) {
|
||||
startPlugins = map (plugin: plugin.package) cfg.plugins;
|
||||
luaConfigPre =
|
||||
concatStringsSep "\n"
|
||||
(filter (x: x != null) (mapAttrsToList (_: spec: spec.beforeAll) cfg.plugins));
|
||||
(filter (x: x != null) (map (spec: spec.beforeAll) cfg.plugins));
|
||||
luaConfigRC.unlazy = entryAfter ["pluginConfigs"] notLazyConfig;
|
||||
keymaps = concatLists (mapAttrsToList specToKeymaps cfg.plugins);
|
||||
})
|
||||
keymaps = concatLists (map specToKeymaps cfg.plugins);
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -188,29 +188,19 @@ in {
|
|||
|
||||
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`.
|
||||
'';
|
||||
type = listOf lznPluginType;
|
||||
description = "list of plugins to lazy load";
|
||||
example = ''
|
||||
[
|
||||
{
|
||||
toggleterm-nvim = {
|
||||
package = "toggleterm-nvim";
|
||||
setupModule = "toggleterm";
|
||||
setupOpts = cfg.setupOpts;
|
||||
|
||||
after = "require('toggleterm').do_something()";
|
||||
cmd = ["ToggleTerm"];
|
||||
};
|
||||
|
||||
$${pkgs.vimPlugins.vim-bbye.pname} = {
|
||||
package = pkgs.vimPlugins.vim-bbye;
|
||||
cmd = ["Bdelete" "Bwipeout"];
|
||||
};
|
||||
}
|
||||
]
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue