请问大家都用什么Shell

我就在 nixos 上用 zimfw。一点问题都没有。当然, setup 稍微复杂一些,如果决定 allin nixos 了倒是用 nix 来管理 zsh 插件就行了,没必要用 zimfw。但是我还是需要用 非 nix 的环境,所以还是决定用 zimfw 来管理。zsh 的插件都是至少十几年的稳定的老插件了,也不担心 breaking change。

同理,emacs 也完全可以用 package.el 一点问题也没有,不需要用 nix 装 emacs 的包。就一套 emacs 配置完全可以在不同的环境里面用。

在 你的 zsh.nix 里面这么写:

        initContent = let
            zshConfigBeforeInit = lib.mkOrder 500
                ''
                [ -f "$HOME/.zsh-preload.sh" ] && source ~/.zsh-preload.sh
                [ -f "$HOME/.zimfw-setup.sh" ] && source ~/.zimfw-setup.sh'';
            zshConfigAfterInit = lib.mkOrder 1200
                ''[ -f "$HOME/.zsh-postload.sh" ] && source ~/.zsh-postload.sh'';
        in
            lib.mkMerge [ zshConfigBeforeInit zshConfigAfterInit ];

然后 zimfw.setup 里面你写 zimfw bootstrap code 的前半部分,大概就长这样:

ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
# Download zimfw plugin manager if missing.
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
  if (( ${+commands[curl]} )); then
    curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \
        https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
  else
    mkdir -p ${ZIM_HOME} && wget -nv -O ${ZIM_HOME}/zimfw.zsh \
        https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
  fi
fi
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
  source ${ZIM_HOME}/zimfw.zsh init -q
fi
# Initialize modules.
source ${ZIM_HOME}/init.zsh

然后 zsh-postload.sh 里面写 zimfw setup 后需要的 code,例如

#!/bin/zsh


# Sensible configuration setup by zimfw.
# relocate these settings to the user configuration
# ------------------------------
# Post-init module configuration
# ------------------------------

#
# zsh-history-substring-search
#

zmodload -F zsh/terminfo +p:terminfo
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
for key ('^[[A' '^P' ${terminfo[kcuu1]}) bindkey ${key} history-substring-search-up
for key ('^[[B' '^N' ${terminfo[kcud1]}) bindkey ${key} history-substring-search-down
for key ('k') bindkey -M vicmd ${key} history-substring-search-up
for key ('j') bindkey -M vicmd ${key} history-substring-search-down
unset key
# }}} End configuration added by Zim install

这样就可以在 nixos 里面用 zimfw 了。

对的,zsh插件非常稳定了

公司的内网 centos8 机器,断网状态下,starship 确实不如 power10k 运行快速,尤其是用 tmux 频繁开关 panel 的场景(应该就是启动慢? 对了,文件系统也是 nfs