mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-01-08 11:02:22 +00:00
utility/gesture-nvim: convert to vim.options
This commit is contained in:
parent
b67759273b
commit
85347de09d
2 changed files with 40 additions and 36 deletions
|
@ -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)]],
|
|
||||||
})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./gesture-nvim.nix
|
./gesture-nvim.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
Loading…
Reference in a new issue