add fish config
This commit is contained in:
@@ -54,12 +54,24 @@ function restore_cursor --on-event fish_postexec
|
||||
tput cnorm
|
||||
end
|
||||
|
||||
# 检查当前的 LANG 是否包含 UTF-8(忽略大小写),修复 nano 无法输入中文的问题
|
||||
# --- 自动化 Locale 修复逻辑 ---
|
||||
# 只有在当前环境不支持 UTF-8 时才介入,修复例如 nano 无法输入中文的问题
|
||||
if not string match -qi "*UTF-8" "$LANG"
|
||||
# 如果当前没有设置或者不是 UTF-8,则尝试设置为 zh_CN.UTF-8
|
||||
# 如果你更偏好英文界面但要中文输入,这里也可以写 en_US.UTF-8
|
||||
set -gx LANG zh_CN.UTF-8
|
||||
set -gx LC_ALL zh_CN.UTF-8
|
||||
# 定义尝试顺序:C.UTF-8 (最通用) -> en_US.UTF-8 (最标准) -> 其他已安装的 UTF-8
|
||||
if locale -a | string match -q "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
|
||||
else
|
||||
# 如果以上都没有,自动寻找系统里任何一个可用的 UTF-8 语言包
|
||||
set -l any_utf8 (locale -a | string match -ri '.*\.utf8' | head -n 1)
|
||||
if test -n "$any_utf8"
|
||||
set -gx LANG $any_utf8
|
||||
set -gx LC_ALL $any_utf8
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
abbr -a port 'sudo ss -tulnp | grep'
|
||||
|
||||
Reference in New Issue
Block a user