Editor/IDE Support
Configure a per-context editor/IDE so ctx edit opens your project in the right editor with the right workspace. This does not set EDITOR or VISUAL environment variables to avoid clobbering your global preferences.
Configuration
editor:
type: vscode # vscode, sublime, or vim
workspace: ~/path/to/project.code-workspace # optional
Commands
Supported Editors
VS Code
Binary lookup: code → code-insiders → macOS app path.
ctx editrunscode ~/projects/myproject.code-workspacectx edit main.gorunscode ~/projects/myproject.code-workspace --goto main.go
Sublime Text
Binary lookup: subl → macOS app path.
ctx editrunssubl --project ~/projects/myproject.sublime-projectctx edit main.gorunssubl --project ~/projects/myproject.sublime-project main.go
Vim / Neovim
# With a session file (created via :mksession)
editor:
type: vim
workspace: ~/projects/myproject.vim
# With a project directory
editor:
type: vim
workspace: ~/projects/myproject
# No workspace (just opens vim)
editor:
type: vim
Binary lookup: nvim → vim (prefers Neovim when available).
- Session file (
.vim): runsnvim -S ~/projects/myproject.vim - Directory: runs
nvim ~/projects/myproject ctx edit main.gorunsnvim -S ~/projects/myproject.vim main.go
Vim runs in the foreground (attached to your terminal). VS Code and Sublime run detached.
Foreground vs Detached
| Editor | Mode | Why |
|---|---|---|
| VS Code | Detached (cmd.Start()) |
GUI application, returns control to shell |
| Sublime | Detached (cmd.Start()) |
GUI application, returns control to shell |
| Vim | Foreground (cmd.Run()) |
Terminal application, needs stdin/stdout |
Example: Full Context
name: myproject-dev
description: "Development with VS Code workspace"
environment: development
aws:
profile: myproject-dev
region: us-west-2
editor:
type: vscode
workspace: ~/projects/myproject.code-workspace
browser:
type: chrome
profile: "MyProject"
urls:
console: https://console.aws.amazon.com
grafana: https://grafana.myproject.com
After switching context: