mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
wrapper/rc: add vim.additionaLuafiles
Allows the user to specify a list of lua files that will be called via `luafile`. All paths that are passed to this option are checked by `builtins.isPath` so attempting to source paths that do not exist do not result in a broken Lua configuration.
This commit is contained in:
parent
7c1a8e2c1e
commit
407ecf00d5
3 changed files with 57 additions and 9 deletions
|
@ -6,13 +6,14 @@ Release notes for release 0.7
|
||||||
|
|
||||||
[ItsSorae](https://github.com/ItsSorae):
|
[ItsSorae](https://github.com/ItsSorae):
|
||||||
|
|
||||||
- Added support for [typst](https://typst.app/) under `vim.languages.typst`
|
- Added support for [typst](https://typst.app/) under `vim.languages.typst` This
|
||||||
This will enable the `typst-lsp` language server, and the `typstfmt` formatter
|
will enable the `typst-lsp` language server, and the `typstfmt` formatter
|
||||||
|
|
||||||
[frothymarrow](https://github.com/frothymarrow):
|
[frothymarrow](https://github.com/frothymarrow):
|
||||||
|
|
||||||
- Modified type for [](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides)
|
- Modified type for
|
||||||
from `anything` to a `submodule` for better type checking.
|
[](#opt-vim.visuals.fidget-nvim.setupOpts.progress.display.overrides) from
|
||||||
|
`anything` to a `submodule` for better type checking.
|
||||||
- Fix null `vim.lsp.mappings` generating an error and not being filtered out.
|
- Fix null `vim.lsp.mappings` generating an error and not being filtered out.
|
||||||
|
|
||||||
[horriblename](https://github.com/horriblename):
|
[horriblename](https://github.com/horriblename):
|
||||||
|
@ -25,6 +26,9 @@ Release notes for release 0.7
|
||||||
automatically if you have autoformatting enabled, but can be disabled manually
|
automatically if you have autoformatting enabled, but can be disabled manually
|
||||||
if you choose to.
|
if you choose to.
|
||||||
|
|
||||||
|
- Add `vim.extraLuaFiles` for optionally sourcing additional lua files in your
|
||||||
|
configuration.
|
||||||
|
|
||||||
- Refactor `programs.languages.elixir` to use lspconfig and none-ls for LSP and
|
- Refactor `programs.languages.elixir` to use lspconfig and none-ls for LSP and
|
||||||
formatter setups respectively. Diagnostics support is considered, and may be
|
formatter setups respectively. Diagnostics support is considered, and may be
|
||||||
added once the [credo](https://github.com/rrrene/credo) linter has been added
|
added once the [credo](https://github.com/rrrene/credo) linter has been added
|
||||||
|
|
|
@ -133,6 +133,14 @@ in {
|
||||||
configRC = {
|
configRC = {
|
||||||
globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript);
|
globalsScript = entryAnywhere (concatStringsSep "\n" globalsScript);
|
||||||
|
|
||||||
|
# Call additional lua files with :luafile in Vimscript
|
||||||
|
# section of the configuration, only after
|
||||||
|
# the luaScript section has been evaluated
|
||||||
|
extraLuaFiles = let
|
||||||
|
callLuaFiles = map (file: "luafile ${file}") cfg.extraLuaFiles;
|
||||||
|
in
|
||||||
|
entryAfter ["globalScript"] (concatStringsSep "\n" callLuaFiles);
|
||||||
|
|
||||||
# wrap the lua config in a lua block
|
# wrap the lua config in a lua block
|
||||||
# using the wrapLuaConfic function from the lib
|
# using the wrapLuaConfic function from the lib
|
||||||
luaScript = let
|
luaScript = let
|
||||||
|
@ -148,7 +156,7 @@ in {
|
||||||
inherit mapResult;
|
inherit mapResult;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
entryAfter ["globalsScript"] luaConfig;
|
entryAnywhere luaConfig;
|
||||||
|
|
||||||
extraPluginConfigs = let
|
extraPluginConfigs = let
|
||||||
mapResult = result: (wrapLuaConfig {
|
mapResult = result: (wrapLuaConfig {
|
||||||
|
|
|
@ -37,8 +37,8 @@ in {
|
||||||
To avoid leaking imperative user configuration into your
|
To avoid leaking imperative user configuration into your
|
||||||
configuration, this is enabled by default. If you wish
|
configuration, this is enabled by default. If you wish
|
||||||
to load configuration from user configuration directories
|
to load configuration from user configuration directories
|
||||||
(e.g. `$HOME/.config/nvim`, `$HOME/.config/nvim/after`
|
(e.g. {file}`$HOME/.config/nvim`, {file}`$HOME/.config/nvim/after`
|
||||||
and `$HOME/.local/share/nvim/site`) you may set this
|
and {file}`$HOME/.local/share/nvim/site`) you may set this
|
||||||
option to true.
|
option to true.
|
||||||
:::
|
:::
|
||||||
'';
|
'';
|
||||||
|
@ -68,16 +68,52 @@ in {
|
||||||
active runtimepath of the Neovim. This can be used to
|
active runtimepath of the Neovim. This can be used to
|
||||||
add additional lookup paths for configs, plugins, spell
|
add additional lookup paths for configs, plugins, spell
|
||||||
languages and other things you would generally place in
|
languages and other things you would generally place in
|
||||||
your `$HOME/.config/nvim`.
|
your {file}`$HOME/.config/nvim`.
|
||||||
|
|
||||||
This is meant as a declarative alternative to throwing
|
This is meant as a declarative alternative to throwing
|
||||||
files into `~/.config/nvim` and having the Neovim
|
files into {file}`~/.config/nvim` and having the Neovim
|
||||||
wrapper pick them up. For more details on
|
wrapper pick them up. For more details on
|
||||||
`vim.o.runtimepath`, and what paths to use; please see
|
`vim.o.runtimepath`, and what paths to use; please see
|
||||||
[the official documentation](https://neovim.io/doc/user/options.html#'runtimepath')
|
[the official documentation](https://neovim.io/doc/user/options.html#'runtimepath')
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraLuaFiles = mkOption {
|
||||||
|
type = listOf (either path str);
|
||||||
|
default = [];
|
||||||
|
example = literalExpression ''
|
||||||
|
[
|
||||||
|
# absolute path, as a string - impure
|
||||||
|
"$HOME/.config/nvim/my-lua-file.lua"
|
||||||
|
|
||||||
|
# relative path, as a path - pure
|
||||||
|
./nvim/my-lua-file.lua
|
||||||
|
|
||||||
|
# source type path - pure and reproducible
|
||||||
|
(builtins.source {
|
||||||
|
path = ./nvim/my-lua-file.lua;
|
||||||
|
name = "my-lua-file";
|
||||||
|
})
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
Additional lua files that will be sourced by Neovim.
|
||||||
|
Takes both absolute and relative paths, all of which
|
||||||
|
will be called via the `luafile` command in Neovim.
|
||||||
|
|
||||||
|
See [lua-commands](https://neovim.io/doc/user/lua.html#lua-commands)
|
||||||
|
on the Neovim documentation for more details.
|
||||||
|
|
||||||
|
::: {.warning}
|
||||||
|
All paths passed to this option must be valid. If Neovim cannot
|
||||||
|
resolve the path you are attempting to sourcee, then your configuration
|
||||||
|
will error, and Neovim will not start. Please ensure that all paths
|
||||||
|
are correct before using this option.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
globals = mkOption {
|
globals = mkOption {
|
||||||
type = attrs;
|
type = attrs;
|
||||||
default = {};
|
default = {};
|
||||||
|
|
Loading…
Reference in a new issue