Open anutator opened 11 months ago
Cmder comes with a small collection of completion scripts for the cmd shell. Cmder does not come with completion scripts for bash.
The scop/bash-completion repo contains a large collection of completion scripts for bash. Directions for installing it are here.
@anutator I am sorry I thought I responded to this yesterday but I guess I never hit the Comment
button.
While the instructions @chrisant996 pointed at may work for Cmder, I would recommend another approach for install in Cmder if you want to:
$cmder_root/config/bash-completion
that you create.Create a file $cmder_root/config/profile.d/bash-completion.sh
and source the files you want to use in this file.
. $cmder_root/config/bash-completion/ssh
. $cmder_root/config/bash-completion/scp
or adapt those instructions using the info here. I just do not recommend putting the files inside the $cmder_root/vendor/git-for-windows
folder.
@anutator to specifically answer your question this is what I did:
296951@DESKTOP-V3893H0 ~
λ cd $cmder_root/
296951@DESKTOP-V3893H0 ~/cmderdev (more_speed_2)
λ cat config/profile.d/bash-completion.sh
. $cmder_root/config/bash-completion/scp
. $cmder_root/config/bash-completion/ssh
296951@DESKTOP-V3893H0 ~/cmderdev (more_speed_2)
λ cat config/bash-completion/*
_scp()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
COMPREPLY=( $(compgen -W "$opts" -- ${cur}): )
return 0
}
complete -F _scp -o nospace scp
_ssh()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
return 0
}
complete -F _ssh ssh
Version Information
Cmder Edition
Cmder Full (with Git)
Description of the issue
I have many connections configured in .ssh/config When I use cmd::Cmder type of terminal autocompletions works, I print ssh, press Tab and see all names of connections. But if I use bash::bash type of terminal, Tab shows folders in current folder:
My environment settings:
How to reproduce
Add any connections to .ssh/config in home directory.
Additional context
No response
Checklist