这里需要用到git-completion.sh,也就是说这其实是一个shell文件
这里需要安装bash-completion
$sudo port install bash-completion
添加到.bash_profile
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then . /opt/local/etc/profile.d/bash_completion.sh fi
大致效果如下,以ls加tab键为例
fdhuang@phodal:~ $ ls ls lsbom lsock lsockU lsvfs lsappinfo lsm lsockT lsof fdhuang@phodal:~ $ ls
不过一种更理想的方式就是使用zsh