nvf/modules/utility/gestures/gesture-nvim/config.nix
NotAShelf 729276c4c5
feat: apply new module format to utility plugins
new file:   modules/utility/binds/cheatsheet/cheatsheet.nix
	new file:   modules/utility/binds/cheatsheet/config.nix
	modified:   modules/utility/binds/cheatsheet/default.nix
	modified:   modules/utility/binds/default.nix
	new file:   modules/utility/binds/which-key/config.nix
	modified:   modules/utility/binds/which-key/default.nix
	new file:   modules/utility/binds/which-key/which-key.nix
	renamed:    modules/utility/colorizer.nix -> modules/utility/colorizer/colorizer.nix
	new file:   modules/utility/colorizer/config.nix
	new file:   modules/utility/colorizer/default.nix
	modified:   modules/utility/default.nix
	modified:   modules/utility/gestures/default.nix
	renamed:    modules/utility/gestures/gesture-nvim.nix -> modules/utility/gestures/gesture-nvim/config.nix
	new file:   modules/utility/gestures/gesture-nvim/default.nix
	new file:   modules/utility/gestures/gesture-nvim/gesture-nvim.nix
	renamed:    modules/utility/icon-picker.nix -> modules/utility/icon-picker/config.nix
	new file:   modules/utility/icon-picker/default.nix
	new file:   modules/utility/icon-picker/icon-picker.nix
	new file:   modules/utility/telescope/config.nix
	modified:   modules/utility/telescope/default.nix
	new file:   modules/utility/telescope/telescope.nix
	renamed:    modules/utility/venn.nix -> modules/utility/venn/config.nix
	new file:   modules/utility/venn/default.nix
	new file:   modules/utility/venn/venn.nix
2023-02-28 10:14:44 +03:00

52 lines
1.6 KiB
Nix

{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.gestures.gesture-nvim;
in {
config = mkIf cfg.enable {
vim.startPlugins = ["gesture-nvim"];
vim.luaConfigRC.gesture-nvim = nvim.dag.entryAnywhere ''
vim.opt.mouse = "a"
vim.keymap.set("n", "<LeftDrag>", [[<Cmd>lua require("gesture").draw()<CR>]], { silent = true })
vim.keymap.set("n", "<LeftRelease>", [[<Cmd>lua require("gesture").finish()<CR>]], { silent = true })
-- or if you would like to use right click
-- vim.keymap.set("n", "<RightMouse>", [[<Nop>]])
-- vim.keymap.set("n", "<RightDrag>", [[<Cmd>lua require("gesture").draw()<CR>]], { silent = true })
-- vim.keymap.set("n", "<RightRelease>", [[<Cmd>lua require("gesture").finish()<CR>]], { silent = true })
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)]],
})
'';
};
}