https://github.com/rocco-gossmann/nvim-taskrunner
A small Plugin, to choose custom functions via Telescope and then execute them.
https://github.com/rocco-gossmann/nvim-taskrunner
functions lua macros neovim telescope
Last synced: about 1 year ago
JSON representation
A small Plugin, to choose custom functions via Telescope and then execute them.
- Host: GitHub
- URL: https://github.com/rocco-gossmann/nvim-taskrunner
- Owner: Rocco-Gossmann
- License: other
- Created: 2024-04-19T04:14:27.000Z (almost 2 years ago)
- Default Branch: v0.1.0
- Last Pushed: 2024-04-19T04:38:43.000Z (almost 2 years ago)
- Last Synced: 2025-01-28T23:29:30.784Z (about 1 year ago)
- Topics: functions, lua, macros, neovim, telescope
- Language: Lua
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NVIM - TaskRunner
a simple Plugin, that allows for choosing and starting custom functions via a Telescope List.
## Requires
https://github.com/nvim-telescope/telescope.nvim
https://github.com/nvim-lua/plenary.nvim (dependency of Telescope)
## Usage
Once installed, vim gets a new command called `TR`.
So simply type `:TR` in normal mode and your configured list will open.
## Configuration
Speaking of configured list. You configure that list during the setup process.
via Lazy.nvim (https://github.com/folke/lazy.nvim) that setup would look like this.
```lua
{
"rocco-gossmann/nvim-taskrunner",
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim' },
init = function()
require("nvim-taskrunner").setup({
--[[ Define your tasks in here, each task is one entry ]]--
{
--[[ The `label` is shown in Telescope ]]--
label = "Go return err nil",
--[[ `action` is a function, that is executed, when you
choose the task via Telescope
]]
action = function()
vim.api.nvim_put({
"if err != nil {",
"\treturn err",
"}"
}, "", true, false)
end
--[[
The `action` can also be a VIM-Macro-String, (executed via vim.cmd.normal)
type `:h normal` in NeoVim to get more info on how the
syntax of these strings works.
All Macros start from Normal mode.
A Macro-Action may look like this:
action = "oif err != nil {^[oreturn err^[o}^[o",
the ` ^[ ` is the character. you must input that via
(Just copying this string will not work)
]]--
},
})
end
}
```