zsh的ssh自动完成速度慢 [英] zsh autocomplete slow for ssh
本文介绍了zsh的ssh自动完成速度慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近将Macbook升级到了OSX Catalina.自从升级以来,我的ssh的zsh自动完成(制表符完成)确实很慢(以前,它相当快,例如,自动完成将在几秒钟内发生).我认为相关的一些细节:
I upgraded my macbook to OSX Catalina recently. Ever since that upgrade my zsh autocomplete (tab completion) for ssh is really slow (previously, it was reasonably fast, e.g. autocomplete would happen in a few seconds). Some details that I think are relevant:
- 我有一个
〜/.ssh/config
文件,其中配置了〜2000个主机 - 当我键入
ssh x< TAB>
时似乎挂起,键入ctrl-C表示22s后_ssh_hosts中的信号被杀死
,所以看来我的_ssh_hosts
脚本是问题
- I have a
~/.ssh/config
file with ~2000 hosts configured - When I type
ssh x <TAB>
things seem to hang, typing ctrl-C saysKilled by signal in _ssh_hosts after 22s
so it seems that my_ssh_hosts
script is the problem
有关如何调试此方法的任何提示?还是我可以使用的 _ssh_hosts
替代功能?
Any tips on how to debug this? Or alternate _ssh_hosts
function I could use?
推荐答案
I've put together a solution that works for me using zstyle
thanks to this email thread
我的解决方案是使我的〜/.zshrc
包含以下内容
My solution was to make my ~/.zshrc
contain the following
function refresh_ssh_autocomplete () {
host_list=($(cat ~/.ssh/config | grep 'Host ' | awk '{s = s $2 " "} END {print s}'))
zstyle ':completion:*:(ssh|scp|sftp):*' hosts $host_list
}
refresh_ssh_autocomplete
这篇关于zsh的ssh自动完成速度慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文