Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/notomo/piemenu.nvim

Pie menu plugin for neovim
https://github.com/notomo/piemenu.nvim

neovim neovim-plugin

Last synced: 3 months ago
JSON representation

Pie menu plugin for neovim

Awesome Lists containing this project

README

        

# piemenu.nvim

piemenu.nvim is a circular menu plugin for Neovim (nightly).

## Example

```lua
vim.opt.mouse = "a"

local group = vim.api.nvim_create_augroup("piemenu_setting", {})
vim.api.nvim_create_autocmd({ "FileType" }, {
group = group,
pattern = { "piemenu" },
callback = function()
vim.o.mousemoveevent = true
vim.keymap.set("n", "", [[lua require("piemenu").highlight()]], { buffer = true })
vim.keymap.set("n", "", [[lua require("piemenu").highlight()]], { buffer = true })
vim.keymap.set("n", "", [[lua require("piemenu").finish()]], { buffer = true })
vim.keymap.set("n", "", [[lua require("piemenu").cancel()]], { buffer = true })
end,
})

vim.keymap.set("n", "", [[lua require("piemenu").start("example")]])
require("piemenu").register("example", {
menus = {
{
text = "📋 copy",
action = function()
vim.cmd.normal({ args = { "yy" }, bang = true })
end,
},
{
text = "📝 paste",
action = function()
vim.cmd.normal({ args = { "p" }, bang = true })
end,
},
{
text = "✅ save",
action = function()
vim.cmd.write()
end,
},
{
text = "👉 goto file",
action = function()
vim.cmd.normal({ args = { "gF" }, bang = true })
end,
},
{
text = "📚 help",
action = function()
vim.cmd.help(vim.fn.expand(""))
end,
},
{
text = "❌ close",
action = function()
vim.cmd.quit()
end,
},
},
})

-- start by gesture.nvim (optional)
local piemenu = require("piemenu")
local gesture = require("gesture")
gesture.register({
name = "open pie menu",
inputs = { gesture.up() },
action = function(ctx)
piemenu.start("gesture_example", { position = ctx.last_position })
end,
})

piemenu.register("gesture_example", {
menus = {
{
text = "🆕 new tab",
action = function()
vim.cmd.tabedit()
end,
},
{
text = "🏠 open vimrc",
action = function()
vim.cmd.edit(vim.env.MYVIMRC)
end,
},
{
text = "🔃 reload",
action = function()
vim.cmd.edit({ bang = true })
end,
},
{
text = "😃 smile",
action = function()
vim.cmd.smile()
end,
},
},
})
```