未能将Homebrew公式编辑器设置为vim in fish shell

Mar*_*lle 0 vim homebrew editor fish

我有Homebrew编辑器的问题:使用Atom而不是Vim

$ brew edit a_brew_formula
Editing /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/a_brew_formula.rb
Warning: Using atom because no editor was set in the environment.
This may change in the future, so we recommend setting EDITOR,
or HOMEBREW_EDITOR to your preferred text editor.
Run Code Online (Sandbox Code Playgroud)

EDITOR并且HOMEBREW_EDITOR很好地设置在config.fish:

set EDITOR vim
set HOMEBREW_EDITOR vim
Run Code Online (Sandbox Code Playgroud)

我检查了shell:

$ echo $EDITOR
vim
Run Code Online (Sandbox Code Playgroud)

为什么我的编辑选择没有考虑在内?

fah*_*aho 5

您尚未导出变量,因此外部进程(如自制程序)看不到它.

使用set -x,但最好set -gx还要定义变量的全局范围.

例如

set -gx EDITOR vim
Run Code Online (Sandbox Code Playgroud)

要查看外部流程看到的内容,您可以使用env.如果不带参数调用,它将将其环境打印为VAR = VALUE行.

如果没有显示EDITOR =,则表示您没有导出$ EDITOR.