New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssh completion is slow if /etc/hosts is long #4604
Comments
@nthapaliya: Please try #4610. I have a hosts file of about 30k entries, and for me that speeds up |
@faho its much better, much more usable now. However |
Are you sure that worked before? That function is defined as # Defined in /usr/share/fish/functions/__fish_complete_user_at_hosts.fish @ line 1
function __fish_complete_user_at_hosts --description 'Print list host-names with user@'
for user_at in (commandline -ct | string match -r '.*@'; or echo "")(__fish_print_hostnames)
echo $user_at
end
end So there's some string stuff involved. With the current token being "root@", that |
Now that you mention it, that 'broken' behavior existed before your patch, and is unrelated to your changes. I am convinced I was able to complete |
If /etc/hosts is a large file (for example, using https://github.com/StevenBlack/hosts to block adware), then ssh completion is really slow. I've isolated the offending line that causes most of the hangup:
https://github.com/fish-shell/fish-shell/blob/master/share/functions/__fish_print_hostnames.fish#L12
If that line is replaced with a grep/awk pipeline, ssh completion feels instantaneous again.
For example:
Two solutions come to mind:
string match
builtin.MacOS High Sierra
fish, version 2.7.0
The text was updated successfully, but these errors were encountered: