Skip to content

Instantly share code, notes, and snippets.

@julienrbrt
Last active July 28, 2025 13:47
Show Gist options
  • Save julienrbrt/bb4a2efa7c076ef63c139b2445ba45cc to your computer and use it in GitHub Desktop.
Save julienrbrt/bb4a2efa7c076ef63c139b2445ba45cc to your computer and use it in GitHub Desktop.
JSON-to-Go Zed Editor Task

JSON-to-Go Zed Editor

This is a Zed Task for JSON-to-Go. I was using the VSCode extension prior to moving to Zed.

Adding this snippet to your ~/.config/zed/tasks.json plus a shortcut in the ~/.config/zed/keymap.json brings back most of the basic functionalities.

Another prerequisite is to have node installed and the json-to-go.js script placed at the location defined in your tasks.json

[
{
"context": "Workspace",
"bindings": {
"alt-g": ["task::Spawn", { "task_name": "JSON-to-Go" }]
}
},
]
[
{
"label": "JSON-to-Go",
"command": "tempfile=$(mktemp --suffix=.go) && node $HOME/tools/scripts/json-to-go.js <<< '$ZED_SELECTED_TEXT' > \"$tempfile\" && zed \"$tempfile\"",
"use_new_terminal": false,
"allow_concurrent_runs": false,
"reveal": "never",
"reveal_target": "dock",
"hide": "on_success",
"shell": "system"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment