Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dsieradzki/nvim-runner
Generic task runner for Neovim
https://github.com/dsieradzki/nvim-runner
neovim task-runner vim
Last synced: 28 days ago
JSON representation
Generic task runner for Neovim
- Host: GitHub
- URL: https://github.com/dsieradzki/nvim-runner
- Owner: dsieradzki
- License: mit
- Created: 2024-03-25T18:33:43.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-30T08:19:08.000Z (10 months ago)
- Last Synced: 2024-11-03T19:23:12.613Z (3 months ago)
- Topics: neovim, task-runner, vim
- Language: Lua
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introduction
This is experimental plugin for running generic tasks with definition saved in working directory. I have created this plugin to help create background processes during development like database, backend, frontend.# Installation
lazy.nvim
```lua
{
'dsieradzki/nvim-runner',
dependencies = {
-- Only when telescope integration is enabled
'nvim-telescope/telescope.nvim', -- optional-- Only when you want to use which-key in mappings in example below
'folke/which-key.nvim', -- optional
},
config = function()
require('runner').setup {
--true|false(default): When integration with telescope is enabled, buffer is not shown on buffer list, unless task finish with error, or keep output is enabled in task, then buffer is unhidden
telescope = true,
}-- Example mappings, before apply check are not conflicting with your current mappints
require('which-key').register {
['m'] = { name = 'Task runner', _ = 'which_key_ignore' },
}
vim.keymap.set('n', 'mr', ':Telescope runner run_task', { desc = '[R]un task', silent = true })
vim.keymap.set('n', 'mg', ':Telescope runner run_group', { desc = 'Run [G]roup of tasks', silent = true })
vim.keymap.set('n', 'ml', ':Telescope runner list', { desc = '[L]ist running tasks', silent = true })
vim.keymap.set('n', 'ms', ':Telescope runner stop', { desc = '[S]op task', silent = true })
vim.keymap.set('n', 'mS', ':RunnerStopAll', { desc = '[S]op all tasks', silent = true })
end,
},
```# Commands
- RunnerRunGroup [group name]
- RunnerRunTask [task name]
- RunnerList
- RunnerStop
- RunnerStopAll# Telescope (when telescope integration is enabed)
- Telescope runner list
- Telescope runner run_task
- Telescope runner run_group
- Telescope runner stop# Example: tasks.lua
```lua
return {
default_group = "dev",
default_task = "backend",
groups = {
{
name = "dev",
tasks = { "database", "backend", "frontend" },
},
},
tasks = {
{
name = "database",
exec = "make dev.db",
keep_output = false,
},
{
name = "backend",
exec = "cargo watch -x run",
working_dir = "server/web-api",
},
{
name = "frontend",
exec = "pnpm run dev",
working_dir = "web",
},
},
}
```