Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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",
},
},
}
```