telescope-menu.nvim
is an extension for telescope.nvim which provides custom menus.
Using dein.vim
call dein#add('nvim-telescope/telescope.nvim') call dein#add('octarect/telescope-menu.nvim')
If using TOML,
[[plugins]] repo = 'nvim-telescope/telescope.nvim' [[plugins]] repo = 'octarect/telescope-menu.nvim'
require("telescope").setup { extensions = { menu = { default = { items = { -- You can add an item of menu in the form of { "<display>", "<command>" } { "Checkhealth", "checkhealth" }, { "Show LSP Info", "LspInfo" }, { "Files", "Telescope find_files" }, -- The above examples are syntax-sugars of the following; { display = "Change colorscheme", value = "Telescope colorscheme" }, }, }, }, }, } require("telescope").load_extension "menu"
Run Telescope menu
to open the menu default
.
<CR>
Confirm selection Vim Command Lua Description :Telescope menu
:lua require"telescope".extensions.menu.menu{}
Open default menu :Telescope menu filetype
lua require"telescope".extensions.menu.filetype{}
Open filetype-specific menu :Telescope menu <menu_name>
:lua require"telescope".extensions.menu.<menu_name>{}
Open <menu_name>
Defining multiple menus is supported. Menus except for default
is opened by Telescope menu <menu_name>
.
For example, you can have another menu named editor
by the following config;
{ extensions = { menu = { default = { items = { -- Jump to another menu { "Editor", "Telescope menu editor" }, }, }, -- `editor` is an example, and you can name it as you like. editor = { items = { { "Split window vertically", "vsplit" }, { "Split window horizontally", "split" }, { "Write", "w" }, }, }, }, }, }
Then, you can open the menu by
Telescope menu editor
require("telescope").extensions.menu.editor()
You can define menu for a particular filetype, and open them by Telescope menu filetype
.
Example:
{ extensions = { menu = { filetype = { lua = { items = { { "Format", "!stylua %" }, { "Open Luadev menu", "Luadev" }, { "Execute a current buffer", "LuaRun" }, }, }, -- Format -- <filetype> = { -- items = { -- -- your favorite commands -- } -- } } }, }, }
You can specify lua function as command instead of string.
{ extensions = { menu = { default = { items = { { "Example", function() print("This is example."\n") end}, }, } }, }, }
local keymap = require("telescope-menu.actions").keymap require("telescope").setup { extensions = { menu = { default = { items = { { "Jump to the previous hunk", "<Plug>(GitGutterPrevHunk)", keymap }, { "Jump to the next hunk", "<Plug>(GitGutterNextHunk)", keymap }, }, }, }, }, }
Any pull requests are welcome. We consider you have granted non-exclusive right to your contributed code under MIT License. Use http://github.com/octarect/telescope-menu.nvim/issues for discussion.
v0.1.0
Telescope menu
)v0.2.0
New features
Telescope menu filetype
)Breaking changes
global
-> default
Other
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4