utility/gesture-nvim: convert to vim.options

This commit is contained in:
raf 2025-01-04 16:08:11 +03:00
parent b67759273b
commit 85347de09d
No known key found for this signature in database
GPG key ID: EED98D11B85A2819
2 changed files with 40 additions and 36 deletions

View file

@ -15,9 +15,10 @@
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>") {
@ -25,20 +26,21 @@ in {
}) })
]; ];
vim.pluginRC.gesture-nvim = entryAnywhere '' options.mouse = "a";
vim.opt.mouse = "a" pluginRC.gesture-nvim = entryAnywhere ''
local gesture = require("gesture") local gesture = require("gesture")
gesture.register({ gesture.register({
name = "scroll to bottom", name = "scroll to bottom",
inputs = { gesture.up(), gesture.down() }, inputs = { gesture.up(), gesture.down() },
action = "normal! G", action = "normal! G",
}) })
gesture.register({ gesture.register({
name = "next tab", name = "next tab",
inputs = { gesture.right() }, inputs = { gesture.right() },
action = "tabnext", action = "tabnext",
}) })
gesture.register({ gesture.register({
name = "previous tab", name = "previous tab",
inputs = { gesture.left() }, inputs = { gesture.left() },
@ -46,6 +48,7 @@ in {
vim.cmd.tabprevious() vim.cmd.tabprevious()
end, end,
}) })
gesture.register({ gesture.register({
name = "go back", name = "go back",
inputs = { gesture.right(), gesture.left() }, inputs = { gesture.right(), gesture.left() },
@ -54,4 +57,5 @@ in {
}) })
''; '';
}; };
};
} }

View file

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