diff --git a/fish/add-on.fish b/fish/add-on.fish index 6cccb22..ee3df1a 100644 --- a/fish/add-on.fish +++ b/fish/add-on.fish @@ -101,32 +101,6 @@ function restore_cursor --on-event fish_postexec tput cnorm end -# 自动化 Locale 修复:强制开启 UTF-8 支持并保持英文界面 -# 解决 nano, vim 等工具无法输入/显示中文的问题 -if not locale >/dev/null 2>&1 - or begin - test -z "$LC_ALL" - and string match -qi "C*" "$LANG" - end - - # 1. 寻找系统可用的 UTF-8 Locale - # 优先使用 C.UTF-8 (现代 Linux 发行版标准,无需安装) - # 备选 en_US.UTF-8 - if locale -a | string match -qi "C.utf8" - set -gx LANG C.UTF-8 - set -gx LC_ALL C.UTF-8 - else if locale -a | string match -qi "en_US.utf8" - set -gx LANG en_US.UTF-8 - set -gx LC_ALL en_US.UTF-8 - end - - # 2. 彻底清理可能冲突的变量 - # 清理 LC_CTYPE 确保其继承 LC_ALL 的 UTF-8 设置 - set -e LC_CTYPE - # 清理 LANGUAGE 确保 UI 界面回退到 LC_ALL 定义的英文 - set -e LANGUAGE -end - ## 让 sudo 能够识别自定义 bin 下的脚本 function sudo --description "Replacement for sudo that preserves custom PATH commands" # 1. 如果没有任何参数,直接运行原始 sudo (通常显示帮助) @@ -156,4 +130,6 @@ function sudo --description "Replacement for sudo that preserves custom PATH com end abbr -a port 'sudo ss -tulnp | grep' -abbr -a process 'ps aux | grep' \ No newline at end of file +abbr -a process 'ps aux | grep' + +alias nano="LANG=C.UTF-8 LC_ALL=C.UTF-8 command nano -u" \ No newline at end of file