Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/notomo/gesture.nvim
Mouse gesture plugin for neovim
https://github.com/notomo/gesture.nvim
mouse-gestures neovim neovim-plugin
Last synced: 12 days ago
JSON representation
Mouse gesture plugin for neovim
- Host: GitHub
- URL: https://github.com/notomo/gesture.nvim
- Owner: notomo
- License: mit
- Created: 2018-10-27T11:22:19.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-08T23:31:23.000Z (14 days ago)
- Last Synced: 2024-05-09T03:41:15.578Z (14 days ago)
- Topics: mouse-gestures, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 544 KB
- Stars: 503
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-list - gesture.nvim
- awesome-neovim - notomo/gesture.nvim - Mouse gesture plugin. (Mouse / Treesitter Based)
- awesome-stars - notomo/gesture.nvim - Mouse gesture plugin for neovim (Lua)
- awesome-stars - notomo/gesture.nvim - Mouse gesture plugin for neovim (Lua)
- awesome-stars - notomo/gesture.nvim - Mouse gesture plugin for neovim (Lua)
- awesome-stars - gesture.nvim
- awesome-stars - notomo/gesture.nvim - Mouse gesture plugin for neovim (Lua)
- awesome-neovim - notomo/gesture.nvim - Mouse gesture plugin. (Mouse / Treesitter Based)
- awesome-neovim - notomo/gesture.nvim - Mouse gesture plugin. (Mouse / Treesitter Based)
README
# gesture.nvim
[![ci](https://github.com/notomo/gesture.nvim/workflows/ci/badge.svg?branch=master)](https://github.com/notomo/gesture.nvim/actions/workflows/ci.yml?query=branch%3Amaster)
gesture.nvim is a mouse gesture plugin for Neovim (nightly).
## Example
```lua
vim.opt.mouse = "a"
vim.opt.mousemoveevent = truevim.keymap.set("n", "", [[lua require("gesture").draw()]], { silent = true })
vim.keymap.set("n", "", [[lua require("gesture").finish()]], { silent = true })-- or if you would like to use right click
vim.keymap.set("n", "", [[]])
vim.keymap.set("n", "", [[lua require("gesture").draw()]], { silent = true })
vim.keymap.set("n", "", [[lua require("gesture").finish()]], { 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(_) -- also can use callable
vim.cmd.tabprevious()
end,
})
gesture.register({
name = "go back",
inputs = { gesture.right(), gesture.left() },
-- map to `` keycode
action = function()
vim.api.nvim_feedkeys(vim.keycode(""), "n", true)
end,
})
gesture.register({
name = "close gesture traced windows",
match = function(ctx)
local last_input = ctx.inputs[#ctx.inputs]
return last_input and last_input.direction == "UP"
end,
can_match = function(ctx)
local first_input = ctx.inputs[1]
return first_input and first_input.direction == "RIGHT"
end,
action = function(ctx)
table.sort(ctx.window_ids, function(a, b)
return a > b
end)
for _, window_id in ipairs(vim.fn.uniq(ctx.window_ids)) do
vim.api.nvim_win_close(window_id, false)
end
end,
})
```