Zed supports ways to spawn (and rerun) commands using its integrated terminal to output the results.

Currently, two kinds of tasks are supported, but more will be added in the future.

All tasks are sorted in LRU order and their names can be used (with picker::UseSelectedQuery, shift-enter by default) as an input text for quicker oneshot task edit-spawn cycle.

Static tasks

Tasks, defined in a config file (tasks.json in the Zed config directory).

The global configuration file can be opened with zed::OpenTasks action (zed: open tasks in the command palette); upon first run, a configuration file will be generated that includes examples with all options commented. The global tasks.json file can be overridden in project-specific tasks.json files. Simply run zed::OpenLocalTasks (zed: open local tasks in the command palette) and a .zed/tasks.json file will be generated in the root of your project.

Every task from that file can be spawned via the task modal, that is opened with task::Spawn action ("tasks: spawn" in the command pane).

Last task spawned via that modal can be rerun with task::Rerun (tasks: rerun in the command palette) command.

Oneshot tasks

The same task modal opened via task::Spawn supports arbitrary bash-like command execution: type a command inside the modal, and use opt-enter to spawn it.

Task modal will persist list of those command for current Zed session, task::Rerun will also rerun such tasks if they were the last ones spawned.

Ephemeral tasks

You can use cmd modifier when spawning a task via a modal; tasks spawned this way will not have their usage count increased (thus, they will not be spawned with task::Rerun and they won't be have a high rank in task modal). The intented use of ephemeral tasks is to stay in the flow with continuous task::Rerun usage - by using ephemerals, you do not need to spawn your previous task via task::Spawn to get back to using it with task::Rerun.


Variables allow you to pull information from the current editor and use it in your tasks. The following variables are available:

  • ZED_COLUMN: current line column
  • ZED_ROW: current line row
  • ZED_FILE: absolute path to the file
  • ZED_SYMBOL: currently selected symbol; should match the last symbol shown in a symbol breadcrumb (e.g. mod tests > fn test_task_contexts)
  • ZED_SELECTED_TEXT: currently selected text
  • ZED_WORKTREE_ROOT: absolute path to the root of the current worktree.
  • ZED_PACKAGE: (Rust-specific) name of the parent package of $ZED_FILE source file.

To use a variable in a task, prefix it with a dollar sign ($):

    "label": "echo current file's path",
    "command": "echo $ZED_FILE",
    "use_new_terminal": true

You can also use verbose syntax that allows specifying a default if a given variable is not available: ${ZED_FILE:default_value}

Project-specific tasks

folder-specific settings support tasks. To add custom tasks scoped to your project, create a tasks.json file and place it in a .zed directory at the root of the worktree.

Custom keybindings for tasks

You can define your own keybindings for your tasks. If you wanted to bind the aforementioned echo current file's path task to alt-g, you would add the following snippet in your keybindings.json file:

    "context": "Workspace",
    "bindings": {
        "alt-g": ["task::Spawn", { "task_name": "echo current file's path" }]