mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
Compare commits
9 commits
22c105c08f
...
42592a25ed
Author | SHA1 | Date | |
---|---|---|---|
|
42592a25ed | ||
|
12b650fea7 | ||
|
c08d0a79cc | ||
|
a0281d329b | ||
|
cca14c7d29 | ||
|
c4e75c4c1a | ||
|
7f5c33605d | ||
|
62b1e30e49 | ||
|
c971673529 |
8 changed files with 120 additions and 61 deletions
|
@ -11,7 +11,7 @@ be used if the plugin uses a `require('module').setup(...)` pattern. Otherwise,
|
|||
```nix
|
||||
{
|
||||
config.vim.lazy.plugins = {
|
||||
aerial-nvim = {
|
||||
aerial.nvim = {
|
||||
# ^^^^^^^^^ this name should match the package.pname or package.name
|
||||
package = aerial-nvim;
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ As of version **0.7**, we exposed an API for configuring lazy-loaded plugins via
|
|||
```nix
|
||||
{
|
||||
config.vim.lazy.plugins = {
|
||||
aerial = {
|
||||
"aerial.nvim" = {
|
||||
package = pkgs.vimPlugins.aerial-nvim;
|
||||
setupModule = aerial;
|
||||
setupModule = "aerial";
|
||||
setupOpts = {
|
||||
option_name = true;
|
||||
};
|
||||
|
|
|
@ -128,9 +128,10 @@ in {
|
|||
# will return the configuration in full.
|
||||
passthru.neovimConfig = vimOptions;
|
||||
|
||||
meta = {
|
||||
description = "Wrapped version of Neovim with additional helper scripts";
|
||||
mainProgram = "nvim";
|
||||
meta =
|
||||
neovim-wrapped.meta
|
||||
// {
|
||||
description = "Wrapped Neovim package with helper scripts to print the config (path)";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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<cr>" mappings.toggle.description)
|
||||
|
@ -31,9 +32,8 @@ in {
|
|||
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
];
|
||||
};
|
||||
|
||||
pluginRC.nvimtreelua = entryAnywhere ''
|
||||
beforeAll = ''
|
||||
${
|
||||
optionalString cfg.setupOpts.disable_netrw ''
|
||||
-- disable netrew completely
|
||||
|
@ -42,6 +42,24 @@ in {
|
|||
''
|
||||
}
|
||||
|
||||
${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")''}
|
||||
|
@ -85,4 +103,5 @@ in {
|
|||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,6 +26,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
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
};
|
||||
|
||||
setupOpts = mkOption {
|
||||
type = submodule {freeformType = attrsOf anything;};
|
||||
type = attrsOf anything;
|
||||
description = "Options to pass to the setup function";
|
||||
default = {};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue