无法在 fish shell 中将 Homebrew 公式编辑器设置为 vim
Fail to set Homebrew formula editor to vim in fish shell
我在使用 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.
EDITOR
和HOMEBREW_EDITOR
在config.fish
中设置得很好:
set EDITOR vim
set HOMEBREW_EDITOR vim
我签入了 shell:
$ echo $EDITOR
vim
为什么我的编辑器选择没有被考虑在内?
您还没有导出变量,因此外部进程(如自制程序)看不到它。
使用 set -x
,但最好使用 set -gx
来定义变量的全局范围。
例如
set -gx EDITOR vim
要查看外部进程看到的内容,您可以使用 env
。如果不带参数调用,它会将其环境打印为 VAR=VALUE 行。
如果没有显示 EDITOR=,则说明您还没有导出 $EDITOR。
我在使用 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.
EDITOR
和HOMEBREW_EDITOR
在config.fish
中设置得很好:
set EDITOR vim
set HOMEBREW_EDITOR vim
我签入了 shell:
$ echo $EDITOR
vim
为什么我的编辑器选择没有被考虑在内?
您还没有导出变量,因此外部进程(如自制程序)看不到它。
使用 set -x
,但最好使用 set -gx
来定义变量的全局范围。
例如
set -gx EDITOR vim
要查看外部进程看到的内容,您可以使用 env
。如果不带参数调用,它会将其环境打印为 VAR=VALUE 行。
如果没有显示 EDITOR=,则说明您还没有导出 $EDITOR。