mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-01-07 18:42:24 +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;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["gesture-nvim"];
|
||||
vim = {
|
||||
startPlugins = ["gesture-nvim"];
|
||||
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkSetLuaBinding mappings.draw "require('gesture').draw")
|
||||
(mkSetLuaBinding mappings.finish "require('gesture').finish")
|
||||
(mkIf (mappings.draw.value == "<RightDrag>") {
|
||||
"<RightMouse>" = {action = "<Nop>";};
|
||||
})
|
||||
];
|
||||
maps.normal = mkMerge [
|
||||
(mkSetLuaBinding mappings.draw "require('gesture').draw")
|
||||
(mkSetLuaBinding mappings.finish "require('gesture').finish")
|
||||
(mkIf (mappings.draw.value == "<RightDrag>") {
|
||||
"<RightMouse>" = {action = "<Nop>";};
|
||||
})
|
||||
];
|
||||
|
||||
vim.pluginRC.gesture-nvim = entryAnywhere ''
|
||||
vim.opt.mouse = "a"
|
||||
options.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({
|
||||
name = "scroll to bottom",
|
||||
inputs = { gesture.up(), gesture.down() },
|
||||
action = "normal! G",
|
||||
})
|
||||
gesture.register({
|
||||
name = "next tab",
|
||||
inputs = { gesture.right() },
|
||||
action = "tabnext",
|
||||
})
|
||||
gesture.register({
|
||||
name = "previous tab",
|
||||
inputs = { gesture.left() },
|
||||
action = function(ctx) -- also can use callable
|
||||
vim.cmd.tabprevious()
|
||||
end,
|
||||
})
|
||||
gesture.register({
|
||||
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)]],
|
||||
})
|
||||
'';
|
||||
gesture.register({
|
||||
name = "next tab",
|
||||
inputs = { gesture.right() },
|
||||
action = "tabnext",
|
||||
})
|
||||
|
||||
gesture.register({
|
||||
name = "previous tab",
|
||||
inputs = { gesture.left() },
|
||||
action = function(ctx) -- also can use callable
|
||||
vim.cmd.tabprevious()
|
||||
end,
|
||||
})
|
||||
|
||||
gesture.register({
|
||||
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 = [
|
||||
./gesture-nvim.nix
|
||||
./config.nix
|
||||
|
|
Loading…
Reference in a new issue