mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 18:25:57 +01:00
Merge 32d17bcc15
into 694012dbd8
This commit is contained in:
commit
ac52dbdf1f
2 changed files with 44 additions and 11 deletions
|
@ -92,8 +92,10 @@ inputs: {
|
|||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
||||
|
||||
extraWrapperArgs =
|
||||
concatStringsSep " " (optional (vimOptions.extraPackages != []) ''--prefix PATH : "${makeBinPath vimOptions.extraPackages}"'');
|
||||
extraWrapperArgs = concatStringsSep " " (optional (vimOptions.extraPackages != []) ''
|
||||
--unset XDG_DATA_DIRS \
|
||||
--prefix PATH : "${makeBinPath vimOptions.extraPackages}"
|
||||
'');
|
||||
|
||||
# wrap user's desired neovim package with the desired neovim configuration
|
||||
# using wrapNeovimUnstable and makeNeovimConfig from nixpkgs.
|
||||
|
@ -119,6 +121,8 @@ in {
|
|||
inherit (module) options config;
|
||||
inherit (module._module.args) pkgs;
|
||||
|
||||
# expose wrapped neovim-package
|
||||
neovim = neovim-wrapped;
|
||||
# expose wrapped neovim package
|
||||
neovim = neovim-wrapped.overrideAttrs (old: {
|
||||
generatedWrapperArgs = (old.generatedWrapperArgs or []) ++ ["--set" "NVIM_APPNAME" "nvf"];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,8 +49,24 @@ in {
|
|||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
"$HOME/.config/nvim-extra" # absolute path, as a string - impure
|
||||
./nvim # relative path, as a path - pure
|
||||
# absolute path, as a string - impure
|
||||
"$HOME/.config/nvim-extra"
|
||||
|
||||
# relative path, as a path - pure
|
||||
./nvim
|
||||
|
||||
# source type path - pure and reproducible
|
||||
(builtins.source {
|
||||
path = ./runtime;
|
||||
name = "nvim-runtime";
|
||||
})
|
||||
|
||||
# as a Neovim plugin - pure, reproducible and follows Neovim practices
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "nvim-runtime";
|
||||
src = ./nvim-runtime; # needs a plugin/init.lua, can refer to modules in a root level lua/ dir
|
||||
version = "#";
|
||||
})
|
||||
]
|
||||
'';
|
||||
|
||||
|
@ -124,9 +140,22 @@ in {
|
|||
-- Remove default user runtime paths from the
|
||||
-- `runtimepath` option to avoid leaking user configuration
|
||||
-- into the final neovim wrapper
|
||||
vim.opt.runtimepath:remove(vim.fn.stdpath('config')) -- $HOME/.config/nvim
|
||||
vim.opt.runtimepath:remove(vim.fn.stdpath('config') .. "/after") -- $HOME/.config/nvim/after
|
||||
vim.opt.runtimepath:remove(vim.fn.stdpath('data') .. "/site") -- $HOME/.local/share/nvim/site
|
||||
local defaultRuntimePaths = {}
|
||||
local function addPath(path)
|
||||
table.insert(defaultRuntimePaths, path)
|
||||
table.insert(defaultRuntimePaths, path .. "/site")
|
||||
end
|
||||
|
||||
-- Add standard paths to the table
|
||||
addPath(vim.fn.stdpath('config')) -- $XDG_CONFIG_HOME
|
||||
addPath(vim.fn.stdpath('data')) -- $XDG_DATA_HOME
|
||||
addPath(vim.fn.stdpath('state')) -- $XDG_STATE_HOME
|
||||
addPath(vim.fn.stdpath('cache')) -- $XDG_CACHE_HOME
|
||||
|
||||
-- Remove paths that are already in runtimepath
|
||||
for _, path in ipairs(defaultRuntimePaths) do
|
||||
vim.opt.runtimepath:remove(path)
|
||||
end
|
||||
''}
|
||||
|
||||
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
|
||||
|
@ -134,9 +163,9 @@ in {
|
|||
|
||||
defaultText = literalMD ''
|
||||
By default, this option will **append** paths in
|
||||
[vim.additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
|
||||
[](#opt-vim.additionalRuntimePaths)
|
||||
to the `runtimepath` and enable the experimental Lua module loader
|
||||
if [vim.enableLuaLoader](#opt-vim.enableLuaLoader) is set to true.
|
||||
if [](#opt-vim.enableLuaLoader) is set to true.
|
||||
'';
|
||||
|
||||
example = literalExpression ''"$${builtins.readFile ./my-lua-config-pre.lua}"'';
|
||||
|
|
Loading…
Reference in a new issue