Sketch out lazy.nvim nix interface
This commit is contained in:
parent
c54f974a8c
commit
91eb12343c
5 changed files with 404 additions and 61 deletions
home/features/neovim
|
@ -1,46 +1,53 @@
|
|||
local M = {}
|
||||
|
||||
local function importFrom(p)
|
||||
return { import = p }
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
require("lazy").setup("my.plugins", {
|
||||
defaults = { lazy = true },
|
||||
install = {
|
||||
-- install missing plugins on startup. This doesn't increase startup time.
|
||||
missing = true,
|
||||
-- try to load one of these colorschemes when starting an installation during startup
|
||||
colorscheme = { "rose-pine", "catpuccin" },
|
||||
},
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
notify = false,
|
||||
},
|
||||
dev = {
|
||||
-- Fallback to git when local plugin doesn't exist
|
||||
fallback = true,
|
||||
require("lazy").setup(
|
||||
{ importFrom("my.plugins"), importFrom("nix.plugins") },
|
||||
{
|
||||
defaults = { lazy = true },
|
||||
install = {
|
||||
-- install missing plugins on startup. This doesn't increase startup time.
|
||||
missing = true,
|
||||
-- try to load one of these colorschemes when starting an installation during startup
|
||||
colorscheme = { "rose-pine", "catpuccin" },
|
||||
},
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
notify = false,
|
||||
},
|
||||
dev = {
|
||||
-- Fallback to git when local plugin doesn't exist
|
||||
fallback = true,
|
||||
|
||||
-- Directory where I store my local plugin projects
|
||||
path = "~/Projects",
|
||||
-- Directory where I store my local plugin projects
|
||||
path = "~/Projects",
|
||||
|
||||
patterns = { "Mateiadrielrafael" },
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
paths = {
|
||||
-- Extra runtime path specified by nix
|
||||
os.getenv("NVIM_EXTRA_RUNTIME") or "",
|
||||
},
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
patterns = { "Mateiadrielrafael" },
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
paths = {
|
||||
-- Extra runtime path specified by nix
|
||||
os.getenv("NVIM_EXTRA_RUNTIME") or "",
|
||||
},
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>L", "<cmd>Lazy<cr>", { desc = "[L]azy ui" })
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
local env = require("my.helpers.env")
|
||||
|
||||
local M = {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
cmd = "NvimTreeToggle",
|
||||
config = true,
|
||||
cond = env.vscode.not_active() and env.firenvim.not_active(),
|
||||
}
|
||||
|
||||
function M.init()
|
||||
-- Toggle nerdtree with Control-n
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<C-n>",
|
||||
":NvimTreeToggle<CR>",
|
||||
{ desc = "Toggle [n]vim-tree" }
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
|
@ -76,10 +76,7 @@ let
|
|||
];
|
||||
# }}}
|
||||
# {{{ extraRuntime
|
||||
extraRuntime = env: [
|
||||
# Snippets
|
||||
(config.satellite.dev.path "home/features/neovim/snippets")
|
||||
|
||||
extraRuntimePaths = env: [
|
||||
# Base16 theme
|
||||
(pkgs.writeTextDir
|
||||
"lua/nix/theme.lua"
|
||||
|
@ -92,7 +89,21 @@ let
|
|||
"lua/nix/env.lua"
|
||||
"return '${env}'"
|
||||
)
|
||||
|
||||
# Experimental nix module generation
|
||||
config.satellite.neovim.generated.all
|
||||
];
|
||||
|
||||
extraRuntime = env:
|
||||
let
|
||||
generated = pkgs.symlinkJoin {
|
||||
name = "nixified-neovim-lua-modules";
|
||||
paths = extraRuntimePaths env;
|
||||
};
|
||||
|
||||
snippets = config.satellite.dev.path "home/features/neovim/snippets";
|
||||
in
|
||||
lib.concatStringsSep "," [ generated snippets ];
|
||||
# }}}
|
||||
# {{{ Client wrapper
|
||||
# Wraps a neovim client, providing the dependencies
|
||||
|
@ -109,7 +120,7 @@ let
|
|||
postBuild = ''
|
||||
wrapProgram $out/bin/${binName} \
|
||||
--prefix PATH : ${lib.makeBinPath extraPackages} \
|
||||
--set NVIM_EXTRA_RUNTIME ${lib.strings.concatStringsSep "," (extraRuntime name)} \
|
||||
--set NVIM_EXTRA_RUNTIME ${extraRuntime name} \
|
||||
${extraArgs}
|
||||
'';
|
||||
};
|
||||
|
@ -195,4 +206,14 @@ in
|
|||
};
|
||||
};
|
||||
# }}}
|
||||
# {{{ Custom module testing
|
||||
satellite.neovim.styluaConfig = ../../../stylua.toml;
|
||||
satellite.neovim.lazy.nvim-tree = {
|
||||
setup = true;
|
||||
package = "kyazdani42/nvim-tree.lua";
|
||||
keys.mapping = "<C-n>";
|
||||
keys.desc = "Toggle [n]vim-tree";
|
||||
keys.action = "<cmd>NvimTreeToggle<cr>";
|
||||
};
|
||||
# }}}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue