TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to Enable Autocomplete in Mac Terminal

92 pointsby TimLelandover 6 years ago

11 comments

hrcxxxover 6 years ago
Oh-my-zsh + iterm2 is the best combination out there imho
评论 #17851050 未加载
评论 #17851324 未加载
评论 #17852935 未加载
评论 #17851072 未加载
TmpAccToSayThisover 6 years ago
If you use &#x27;~&#x2F;.ssh&#x2F;config&#x27; with SSH, add this to your &#x27;~&#x2F;.bash_profile&#x27; file to add autocompletion for all your servers:<p>complete -f -d -W &quot;$(grep &#x27;[Hh]ost &#x27; ~&#x2F;.ssh&#x2F;config | grep -v &#x27;*&#x27; | awk &#x27;{print $2}&#x27;)&quot; ssh scp<p>If you don&#x27;t use &#x27;~&#x2F;.ssh&#x2F;config&#x27; but have a &#x27;~&#x2F;.ssh&#x2F;known_hosts&#x27; file, add this instead:<p>complete -f -d -W &quot;$(cut -d&#x27;,&#x27; -f1 ~&#x2F;.ssh&#x2F;known_hosts | awk &#x27;{print $1}&#x27;)&quot; ssh scp<p>Similarly, you can use the &#x27;complete&#x27; command in &#x27;~&#x2F;.bash_profile&#x27; to tweak everything. Some other ways I use it are:<p>1. Make &#x27;cd&#x27; and &#x27;ls&#x27; only autocomplete for directories: complete -d cd ls<p>2. Make &#x27;foo&#x27; autocomplete with &#x27;bar0&#x27; and &#x27;bar1&#x27;: complete -W &#x27;bar0 bar1&#x27; foo
massysettover 6 years ago
inputrc has nothing to do with Mac Terminal. It’s the configuration file for GNU readline.
评论 #17851847 未加载
aiyodevover 6 years ago
Recently discovered the wonders of zsh and oh my zsh. If you’re like me and never tried anything other than bash, you’re missing out.
评论 #17855508 未加载
tachionover 6 years ago
If any of you find Oh-My-ZSH bloated and slow and ZPrezto being abandonware then check out ZIM framework that&#x27;s ZPrezto fork with goal of being maintained, workable and making ZSH great again ;)
评论 #17851992 未加载
hibbeligover 6 years ago
The bash that comes with macOS is very old due to Apple sticking to GPLv2 I believe. So I did &quot;brew install bash&quot; and switched my login shell from &#x2F;bin&#x2F;bash to &#x2F;usr&#x2F;local&#x2F;bin&#x2F;bash and now I can use new bash things.<p>Just a thought.
megidoover 6 years ago
brew install bash-completion?
评论 #17851208 未加载
agiamasover 6 years ago
from a comment from tfa: &#x27;Now if you’re really tired of seventies tech you should try fish.&#x27; Really, that&#x27;s pretty much it.
评论 #17851502 未加载
webdevetcover 6 years ago
But if you don&#x27;t do this, you can still use &lt;tab&gt; - and if there are more than one option it&#x27;ll list the possibilities. With this you just have to tab through all the options to see what is there.
评论 #17851596 未加载
评论 #17853048 未加载
nkcmrover 6 years ago
what i have yet to figure out is how i can make the commands that i build work with auto-completion. i have never been able to find a good guide. anyone have a good resource&#x2F;library (in Go) that can help me with this?
评论 #17851942 未加载
评论 #17851776 未加载
评论 #17851409 未加载
评论 #17851887 未加载
stevageover 6 years ago
Eep, people still use MacOS Terminal? Just get iTerm2, it&#x27;s vastly better.