Last active
August 19, 2025 12:53
-
-
Save LewisGet/bcde5beae47119c8ea42caf20b82bfc3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 懶得裝 zsh 跟整套 oh my 時,塞上去 bash 版本 | |
_my_ssh_autocomplete() { | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
if [[ $cur =~ ^[0-9]{1,3}$ ]]; then | |
local full_ip="[email protected].${cur}" | |
COMPREPLY=( $(compgen -W "$full_ip" -- "$cur") ) | |
fi | |
} | |
complete -F _my_ssh_autocomplete ssh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zsh 自動完成註冊方法不同,直接放到 oh my zsh custom 內就好 | |
_my_ssh_complete() { | |
local cur=${words[CURRENT]} | |
local -a completions | |
if [[ $cur =~ ^[0-9]{1,3}$ ]]; then | |
completions=( "[email protected].${cur}" ) | |
fi | |
_describe 'ssh completions' completions | |
} | |
compdef _my_ssh_complete ssh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment