mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
feat: mouse gestures & nvim-session-manager
This commit is contained in:
parent
306d63f9d6
commit
1c8d224775
8 changed files with 146 additions and 0 deletions
34
flake.lock
34
flake.lock
|
@ -320,6 +320,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gesture-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1675384642,
|
||||
"narHash": "sha256-HxVWZopV3wx6ANefuowrdbSQpQriYHV43r187t7UJXQ=",
|
||||
"owner": "notomo",
|
||||
"repo": "gesture.nvim",
|
||||
"rev": "902a97219e126a08aea6016994c50eea485bcd79",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "notomo",
|
||||
"repo": "gesture.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitsigns-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -798,6 +814,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-session-manager": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1675414961,
|
||||
"narHash": "sha256-dHFhZtBvU6sc6XR49oL3TW0sUwAOwLf4S5q+m8u76c8=",
|
||||
"owner": "Shatur",
|
||||
"repo": "neovim-session-manager",
|
||||
"rev": "e7a2cbf56b5fd3a223f2774b535499fc62eca6ef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Shatur",
|
||||
"repo": "neovim-session-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-tree-lua": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -983,6 +1015,7 @@
|
|||
"discord-nvim": "discord-nvim",
|
||||
"dressing-nvim": "dressing-nvim",
|
||||
"flake-utils": "flake-utils",
|
||||
"gesture-nvim": "gesture-nvim",
|
||||
"gitsigns-nvim": "gitsigns-nvim",
|
||||
"glow-nvim": "glow-nvim",
|
||||
"icon-picker-nvim": "icon-picker-nvim",
|
||||
|
@ -1009,6 +1042,7 @@
|
|||
"nvim-lspconfig": "nvim-lspconfig",
|
||||
"nvim-neoclip": "nvim-neoclip",
|
||||
"nvim-notify": "nvim-notify",
|
||||
"nvim-session-manager": "nvim-session-manager",
|
||||
"nvim-tree-lua": "nvim-tree-lua",
|
||||
"nvim-treesitter-context": "nvim-treesitter-context",
|
||||
"nvim-ts-autotag": "nvim-ts-autotag",
|
||||
|
|
21
flake.nix
21
flake.nix
|
@ -173,6 +173,14 @@
|
|||
copilot.enable = false;
|
||||
tabnine.enable = false; # FIXME: this is not working because the plugin depends on an internal script to be ran by the package manager
|
||||
};
|
||||
|
||||
vim.session = {
|
||||
nvim-session-manager.enable = false;
|
||||
};
|
||||
|
||||
vim.gestures = {
|
||||
gesture-nvim.enable = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -582,6 +590,19 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# Session management
|
||||
|
||||
nvim-session-manager = {
|
||||
url = "github:Shatur/neovim-session-manager";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Mouse Gestures
|
||||
gesture-nvim = {
|
||||
url = "github:notomo/gesture.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# Dependencies
|
||||
plenary-nvim = {
|
||||
# (required by crates-nvim)
|
||||
|
|
5
modules/gestures/default.nix
Normal file
5
modules/gestures/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
imports = [
|
||||
./gesture-nvim.nix
|
||||
];
|
||||
}
|
55
modules/gestures/gesture-nvim.nix
Normal file
55
modules/gestures/gesture-nvim.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.gestures.gesture-nvim;
|
||||
in {
|
||||
options.vim.gestures.gesture-nvim = {
|
||||
enable = mkEnableOption "Enable GitHub Copilot";
|
||||
};
|
||||
|
||||
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)]],
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -64,6 +64,8 @@ with lib; let
|
|||
"nui-nvim"
|
||||
"copilot-lua"
|
||||
"tabnine-nvim"
|
||||
"nvim-session-manager"
|
||||
"gesture-nvim"
|
||||
];
|
||||
# You can either use the name of the plugin or a package.
|
||||
pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
./terminal
|
||||
./ui
|
||||
./assistant
|
||||
./session
|
||||
./gestures
|
||||
];
|
||||
|
||||
pkgsModule = {config, ...}: {
|
||||
|
|
5
modules/session/default.nix
Normal file
5
modules/session/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
imports = [
|
||||
./nvim-session-manager.nix
|
||||
];
|
||||
}
|
22
modules/session/nvim-session-manager.nix
Normal file
22
modules/session/nvim-session-manager.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
cfg = config.vim.session.nvim-session-manager;
|
||||
in {
|
||||
options.vim.session.nvim-session-manager = {
|
||||
enable = mkEnableOption "Enable nvim-session-manager";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["nvim-session-manager"];
|
||||
|
||||
vim.luaConfigRC.nvim-session-manager = nvim.dag.entryAnywhere ''
|
||||
require('session_manager').setup({})
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue