![使用 ZSH 时 Nano 在 Mac 上打开速度极慢?](https://linux22.com/image/1531365/%E4%BD%BF%E7%94%A8%20ZSH%20%E6%97%B6%20Nano%20%E5%9C%A8%20Mac%20%E4%B8%8A%E6%89%93%E5%BC%80%E9%80%9F%E5%BA%A6%E6%9E%81%E6%85%A2%EF%BC%9F.png)
每当我在 ZSH 中尝试使用 Mac 上的 nano 打开文件时,nano 大约需要 4 秒钟才能打开,我不知道为什么。有人有建议来调试这个问题并找到解决办法吗?
答案1
因此,由于我没有收到任何回复,所以我认为我会发布我目前的工作,尽管有点俗气。
由于该问题似乎仅在我使用 zsh 时发生,因此我在文件末尾添加了以下内容,~/.zshrc
以强制 nano 始终在 bash 而不是 zsh 中打开。
# For some reason, when I open nano in zsh it's incredibly slow
# So instead, alias it with this function that forces nano
# to open in bash instead of zsh.
function nano() {
bash -c "nano $@"
}
虽然这可能不是最好的解决方案,但我不知道发生了什么,也不知道该如何解决。目前,这个可以解决问题。