Note: Zed as the default editor for commits

October 2, 2024
zed git

I started to use the Zed editor as my default editor, and with it I also use the terminal that comes with it. When using the Zed terminal, I would also like the git commit messages to open in Zed, but only if I’m actually in the Zed terminal. To do this, I first added this to my Zed configuration:

"terminal": {
  "env": {
    "TERM_PROGRAM": "zed"
  }
}

And then, in my Fish config, I added this:

# Zed editor
if test "$TERM_PROGRAM" = "zed"
    set -x EDITOR zed --wait
    set -x VISUAL zed --wait
end

Now, only when I’m in Zed terminal, git commits will also open in Zed. Any other terminal, it defaults back to Neovim.

Comparisons in Javascript Domains for local apps