mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-23 00:29:48 +01:00
f9789432f9
* modules: switch to gerg's neovim-wrapper * modules: use initViml instead of writing the file * treewide: make the entire generated config lua based * docs: remove mentions of configRC * plugins/treesitter: remove vim.cmd hack * treewide: move resolveDag to lib * modules/wrapper(rc): fix typo * treewide: migrate to pluginRC for correct DAG order The "new" DAG order is as follows: - (luaConfigPre) - globalsScript - basic - theme - pluginConfigs - extraPluginConfigs - mappings - (luaConfigPost) * plugins/theme: fix theme DAG place * plugins/theme: fix fixed theme DAG place * modules/wrapper(rc): add removed option module for configRC * docs: add dag-entries chapter, add release note entry * fix: formatting CI * languages/nix: add missing `local` * docs: fix page link * docs: add mention of breaking changes at the start of the release notes * plugins/neo-tree: convert to pluginRC * modules/wrapper(rc): add back entryAnywhere * modules/wrapper(rc): expose pluginRC * apply raf patch --------- Co-authored-by: NotAShelf <raf@notashelf.dev>
57 lines
1.6 KiB
Nix
57 lines
1.6 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
|
|
cfg = config.vim.gestures.gesture-nvim;
|
|
|
|
self = import ./gesture-nvim.nix {inherit lib;};
|
|
|
|
mappingDefinitions = self.options.vim.gestures.gesture-nvim.mappings;
|
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
|
in {
|
|
config = mkIf cfg.enable {
|
|
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>";};
|
|
})
|
|
];
|
|
|
|
vim.pluginRC.gesture-nvim = entryAnywhere ''
|
|
vim.opt.mouse = "a"
|
|
|
|
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)]],
|
|
})
|
|
'';
|
|
};
|
|
}
|