Skip to main content
Bounty Awarded with 100 reputation awarded by Martin Vegter
_ssh_hosts change for ~/.ssh/config defined hosts
Source Link
Tomasz Pala
  • 881
  • 5
  • 10

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh - this one handles ~/.ssh/config hosts, see below) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

Ad. update 2:

Handling the ~/.ssh/config defined hosts is actually pretty much the same as for _hosts - depending on your zsh version in either Unix/(Command/)_ssh or Unix/(Type/)_ssh_hosts change the

compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts

line to

compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' "$@" $config_hosts

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

Ad. update 2:

Handling the ~/.ssh/config defined hosts is actually pretty much the same as for _hosts - depending on your zsh version in either Unix/(Command/)_ssh or Unix/(Type/)_ssh_hosts change the

compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts

line to

compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' "$@" $config_hosts

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh - this one handles ~/.ssh/config hosts, see below) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

Ad. update 2:

Handling the ~/.ssh/config defined hosts is actually pretty much the same as for _hosts - depending on your zsh version in either Unix/(Command/)_ssh or Unix/(Type/)_ssh_hosts change the

compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts

line to

compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' "$@" $config_hosts

_ssh_hosts change for ~/.ssh/config defined hosts
Source Link
Tomasz Pala
  • 881
  • 5
  • 10

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

Ad. update 2:

Handling the ~/.ssh/config defined hosts is actually pretty much the same as for _hosts - depending on your zsh version in either Unix/(Command/)_ssh or Unix/(Type/)_ssh_hosts change the

compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts

line to

compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' "$@" $config_hosts

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

Ad. update 2:

Handling the ~/.ssh/config defined hosts is actually pretty much the same as for _hosts - depending on your zsh version in either Unix/(Command/)_ssh or Unix/(Type/)_ssh_hosts change the

compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts

line to

compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' "$@" $config_hosts

Bounty Awarded with 125 reputation awarded by CommunityBot
reloading the function body
Source Link
Tomasz Pala
  • 881
  • 5
  • 10

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Second answer tries to explain that you need to do two things:

1_ make sure your general matching rules are not case-insensitive (matcher-list) - from the updated question it's not,

2_ change Unix/(Type/)_hosts (the actual location might vary, but not the Unix/_ssh) last 2 lines to:

_wanted hosts expl host \
   compadd -M 'm:{a-z}={A-Z} r:|.=* r:|=*' -a "$@" - _hosts

All of this was already summarized in my answer, so simply try doing this without reading all the rationale before. Also, since your global config is not case-insensitive, the @zeppelin's answer should also work, although it doesn't use $fpath and removes also small->CAPS matching of the hosts.

I did test this with your settings from the update and it works as expected.

Update: remember that zsh keeps it's functions loaded, so after modifying the _hosts you need to reload it either by logging in fresh, or:

unfunction _hosts
autoload -Uz _hosts

Also remember that zsh can have the scripts 'compiled' in zwc form (zcompile [file]) and if such file exists and is newer than the source it would be used instead.

@zeppelin answer differences
Source Link
Tomasz Pala
  • 881
  • 5
  • 10
Loading
Source Link
Tomasz Pala
  • 881
  • 5
  • 10
Loading