更新 fish 配置,添加 SUDO_EDITOR 设置以支持使用 vim 或 vi 进行 sudo 编辑

This commit is contained in:
2026-04-02 00:38:03 +08:00
parent c7e31a1133
commit 4566314b11

View File

@@ -27,12 +27,15 @@ if status is-interactive
type -q zoxide; and zoxide init --cmd=cd fish | source
# ========= 编辑器/查看器(优先 vim否则 vi=========
# SUDO_EDITOR供 visudo / sudoedit 等使用;若仍打开 nano需在 sudoers 中加 Defaults env_keep += "SUDO_EDITOR"
if type -q vim
set -gx EDITOR vim
set -gx VISUAL vim
set -gx SUDO_EDITOR vim
else if type -q vi
set -gx EDITOR vi
set -gx VISUAL vi
set -gx SUDO_EDITOR vi
end
# ========= fastfetch启动信息显示 =========