telescope-tasks.nvim
is a telescope.nvim extension,
that allows running tasks directly from the telescope prompt and displaying their
definitions and outputs in the telescope's previewer.
demo.mp4
The demo uses the default generators for
Go
andPython
projects.
use {"lpoto/telescope-tasks.nvim"}
Plug "lpoto/telescope-tasks.nvim"
First setup and load the extension:
require("telescope").setup {
extensions = {
-- NOTE: this setup is optional
tasks = {
theme = "ivy",
output = {
style = "float", -- "vsplit" | "split" | "float"
layout = "center", -- "bottom" | "left" | "right" | "center"
scale = 0.4, -- output window to editor size ratio
-- NOTE: layout and scale are only relevant when style == "float"
},
-- Directory to store the modified commands data to.
-- Set it to false to disable saving modified commands.
data_dir = Path:new(vim.fn.stdpath "data", "telescope_tasks"))
-- other picker setup values
},
},
}
-- Load the tasks telescope extension
require("telescope").load_extension "tasks"
See Generators on how to generate tasks.
Then use the extension:
:Telescope tasks
or in lua:
require("telescope").extensions.tasks.tasks()
NOTE: See Mappings for the default mappings in the tasks prompt
The last opened output may then be toggled with:
require("telescope").extensions.tasks.actions.toggle_last_output()
You may either use the Default Generators, or add Custom Generators.
Key | Description |
---|---|
<CR> |
Run the selected task, or kill it if it is already running. |
<C-a> |
Run the selected task, but allow modifying the command before running it. |
<C-o> |
Display the output of the selected task in another window. |
<C-d> |
Delete the output of the selected task. |
<C-k> |
Scroll the previewer up. |
<C-j> |
Scroll the previewer down. |
<C-q> |
Send a task's output to quickfix. |
NOTE modified command will be saved, so the next time you run the same task, the modified command will be used.