I’ve been using Zed as my main editor lately, and I also use Zed when editing some command-line files. But sometimes, the commands of some applications will automatically call the default editor. At this time, nano or vim will be used by default instead of Zed, and the experience is slightly worse. So I want to change the default editor of the command line to Zed editor.
If you need to use Zed as your own command line editor, you first need to confirm whether Zed supports wait mode ( wait model
). Execute zed --help
on the command line, and you can see that Zed supports wait mode. Then you can proceed to the next steps to test.
This is used when writing Rails, so I continue to use rails credentials
to test. Execute the following command to confirm whether the command is available.
EDITOR="zed --wait" rails credentials:edit
After execution, it can be awakened normally, which means that the entire link is smooth. Next, you only need to configure it in the default environment variable of the system, and put the following code in .zshrc
.
export EDITOR="zed --wait"
Command reference for other editors
# Sublime Text export EDITOR="subl --wait" # VSCode export EDITOR="code --wait"
This article is reproduced from: https://www.ixiqin.com/2023/06/04/%E5%A6%82%E4%BD%95%E5%B0%86-zed-%E7%BC%96%E8%BE %91%E5%99%A8%E8%AE%BE%E7%BD%AE%E4%B8%BA%E4%BD%A0%E7%9A%84%E5%91%BD%E4%BB%A4 %E8%A1%8C%E9%BB%98%E8%AE%A4%E7%BC%96%E8%BE%91%E5%99%A8/
This site is only for collection, and the copyright belongs to the original author.