Compare commits

...

3 commits

Author SHA1 Message Date
5749739e4b
wrapper/rc: clean up option documentation
Some checks failed
Check for typos in the source tree / check-typos (push) Has been cancelled
2025-01-04 16:08:53 +03:00
85347de09d
utility/gesture-nvim: convert to vim.options 2025-01-04 16:08:11 +03:00
b67759273b
neovim/spellcheck: convert to vim.options 2025-01-04 15:52:27 +03:00
4 changed files with 55 additions and 46 deletions

View file

@ -124,7 +124,6 @@ in {
nvim --headless --clean \ nvim --headless --clean \
--cmd "mkspell $out/spell/$name.add.spl $spellfile" -Es -n --cmd "mkspell $out/spell/$name.add.spl $spellfile" -Es -n
done done
''; '';
in in
mkIf (cfg.extraSpellWords != {}) [ mkIf (cfg.extraSpellWords != {}) [
@ -133,10 +132,12 @@ in {
compileJoinedSpellfiles.outPath compileJoinedSpellfiles.outPath
]; ];
luaConfigRC.spellcheck = entryAfter ["basic"] '' options = {
vim.opt.spell = true spell = true;
vim.opt.spelllang = ${listToLuaTable cfg.languages} spelllang = cfg.languages;
};
luaConfigRC.spellcheck = entryAfter ["basic"] ''
-- Disable spellchecking for certain filetypes -- Disable spellchecking for certain filetypes
-- as configured by `vim.spellcheck.ignoredFiletypes` -- as configured by `vim.spellcheck.ignoredFiletypes`
vim.api.nvim_create_augroup("nvf_autocmds", {clear = false}) vim.api.nvim_create_augroup("nvf_autocmds", {clear = false})

View file

@ -15,43 +15,47 @@
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions; mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = ["gesture-nvim"]; vim = {
startPlugins = ["gesture-nvim"];
vim.maps.normal = mkMerge [ maps.normal = mkMerge [
(mkSetLuaBinding mappings.draw "require('gesture').draw") (mkSetLuaBinding mappings.draw "require('gesture').draw")
(mkSetLuaBinding mappings.finish "require('gesture').finish") (mkSetLuaBinding mappings.finish "require('gesture').finish")
(mkIf (mappings.draw.value == "<RightDrag>") { (mkIf (mappings.draw.value == "<RightDrag>") {
"<RightMouse>" = {action = "<Nop>";}; "<RightMouse>" = {action = "<Nop>";};
}) })
]; ];
vim.pluginRC.gesture-nvim = entryAnywhere '' options.mouse = "a";
vim.opt.mouse = "a" pluginRC.gesture-nvim = entryAnywhere ''
local gesture = require("gesture")
gesture.register({
name = "scroll to bottom",
inputs = { gesture.up(), gesture.down() },
action = "normal! G",
})
local gesture = require("gesture") gesture.register({
gesture.register({ name = "next tab",
name = "scroll to bottom", inputs = { gesture.right() },
inputs = { gesture.up(), gesture.down() }, action = "tabnext",
action = "normal! G", })
})
gesture.register({ gesture.register({
name = "next tab", name = "previous tab",
inputs = { gesture.right() }, inputs = { gesture.left() },
action = "tabnext", action = function(ctx) -- also can use callable
}) vim.cmd.tabprevious()
gesture.register({ end,
name = "previous tab", })
inputs = { gesture.left() },
action = function(ctx) -- also can use callable gesture.register({
vim.cmd.tabprevious() name = "go back",
end, inputs = { gesture.right(), gesture.left() },
}) -- map to `<C-o>` keycode
gesture.register({ action = [[lua vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-o>", true, false, true), "n", true)]],
name = "go back", })
inputs = { gesture.right(), gesture.left() }, '';
-- map to `<C-o>` keycode };
action = [[lua vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-o>", true, false, true), "n", true)]],
})
'';
}; };
} }

View file

@ -1,4 +1,4 @@
_: { {
imports = [ imports = [
./gesture-nvim.nix ./gesture-nvim.nix
./config.nix ./config.nix

View file

@ -3,7 +3,7 @@
lib, lib,
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; inherit (lib.options) mkOption literalMD literalExpression;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything; inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything;
inherit (lib.trivial) isBool; inherit (lib.trivial) isBool;
@ -19,7 +19,7 @@ in {
default = false; default = false;
example = true; example = true;
description = '' description = ''
[{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable() [official documentation]: https://neovim.io/doc/user/lua.html#vim.loader.enable()
the experimental Lua module loader to speed up the start up process the experimental Lua module loader to speed up the start up process
@ -31,7 +31,7 @@ in {
::: {.note} ::: {.note}
The Lua module loader is *disabled* by default. Before setting this option, please The Lua module loader is *disabled* by default. Before setting this option, please
take a look at the [{option}`official documentation`]. This option may be enabled by take a look at the {option}`[official documentation]`. This option may be enabled by
default in the future. default in the future.
::: :::
''; '';
@ -83,7 +83,7 @@ in {
./nvim/my-lua-file.lua ./nvim/my-lua-file.lua
# source type path - pure and reproducible # source type path - pure and reproducible
(builtins.source { (builtins.path {
path = ./nvim/my-lua-file.lua; path = ./nvim/my-lua-file.lua;
name = "my-lua-file"; name = "my-lua-file";
}) })
@ -274,7 +274,11 @@ in {
vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths}) vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths})
''} ''}
${optionalString cfg.enableLuaLoader "vim.loader.enable()"} ${optionalString cfg.enableLuaLoader ''
if vim.loader then
vim.loader.enable()
end
''}
''; '';
defaultText = literalMD '' defaultText = literalMD ''
@ -284,7 +288,7 @@ in {
if [](#opt-vim.enableLuaLoader) is set to true. if [](#opt-vim.enableLuaLoader) is set to true.
''; '';
example = literalExpression ''"$${builtins.readFile ./my-lua-config-pre.lua}"''; example = literalExpression ''''${builtins.readFile ./my-lua-config-pre.lua}'';
description = '' description = ''
Verbatim lua code that will be inserted **before** Verbatim lua code that will be inserted **before**