How to Enable Autocomplete in Mac Terminal
timleland.com
timleland.com
oh-my-zsh is also horribly slow out of box, spend some time manually configuring zsh and observe your terminals open in fractional seconds instead of multiple seconds.
I'm familiar enough with the terminal that I generally type by rote, I don't even need to look at the terminal while typing for most common tasks.
As for OMZ, yep, it includes a lot of functionality out of the box which makes it a little slow. I personally use prezto because it's quicker. Give that a try.
It's basically exactly what I had before except I can't click on links in my terminal.
iTerm2 is nice but for my usage it does too much. If there were a lite version that cut a lot of the more niche features and focused solely on speed and responsiveness I might consider it.
I also like FZF a lot for fast history search: https://github.com/junegunn/fzf
On that front, I've been using ZIM: https://github.com/zimfw/zimfw
I also recently added sandboxd so certain things are not run during shell init (rbenv/pyenv/asdf/etc): https://github.com/benvan/sandboxd
I have a keybinding set to CTRL+CMD+SPACEBAR for show/hiding item2. This is fairly close to activating the spotlight shortcut (CMD+SPACEBAR)
This makes it easy for me to seamlessly swap between my IDE and 2-3 terminals. Without having to use desktop swapping, etc.
Preferences => Profiles => (Choose or make from scratch[1]) => Keys => Configure Hotkey Window
I think that works with the Control-Command-Space binding mentioned above. I use caps lock to toggle my terminal, which required some remapping via Karabiner[2]
[1] I have a profile called "Hotkey Profile" I don't remember if I set this up myself or if iTerm did it for me. I have it configured to appear on whichever monitor my mouse is on when I open it, and to have its window fill the bottom 1/3 or so of my screen
complete -f -d -W "$(grep '[Hh]ost ' ~/.ssh/config | grep -v '*' | awk '{print $2}')" ssh scp
If you don't use '~/.ssh/config' but have a '~/.ssh/known_hosts' file, add this instead:
complete -f -d -W "$(cut -d',' -f1 ~/.ssh/known_hosts | awk '{print $1}')" ssh scp
Similarly, you can use the 'complete' command in '~/.bash_profile' to tweak everything. Some other ways I use it are:
1. Make 'cd' and 'ls' only autocomplete for directories: complete -d cd ls
2. Make 'foo' autocomplete with 'bar0' and 'bar1': complete -W 'bar0 bar1' foo
I got omz + zgen down to sub 60ms but I had to trade some functionality to get there.
I tried zplug but my pruned omz worked out slower than zgen.
Just a thought.
It doesn't even support `!!` since the maintainers don't seem to like it[0].
[0] https://github.com/fish-shell/fish-shell/issues/288I get the occasional hiccup, but most scripts have a proper shebang line, so they work with fish anyway.
I was a wary zsh user too, until I moved my zsh aliases to scripts with a proper hashbang, then migration to fish was painless, and the benefits are real: I get all the features I expected from my long-tuned zsh, with none of the maintenance/performance pains.
Actually, even for one-time personal scripts I still default to writing (ba)sh, because 1. habit/competence, 2. shellcheck, 3. what you say: examples and resources are everywhere.
Tangentially, upcoming fish will support POSIX && and || (in addition to maybe-even-weirder `; and` / `; or`), and already does if you build from sources now.
I'm still of the opinion that fish is little more than a novelty and won't see widespread adoption in the long run.
If you have 3 options starting with the same prefix, it's fine, but if there's hundreds (e.g. a directory with a lot of libraries starting with lib<something>), it becomes highly annoying and it's better to just give the list so I can type the next letter
(Say you have a directory with two subdirectories "fooabc" and "foo123". You are in the directory and you type "cd f" and then hit tab. This will complete to "cd foo", and if you hit tab again, then it will show the two options, and then you have to enter "a" or "1" to disambiguate.)
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
Now, whenever you run `go install filename.go`, you'll automatically be able to run it anywhere on your machine.
I just added bash completion to a few internal tools that work with kafka, basically just autocompleting topics. It was a little harder than I would have liked (who wants to write all that bash), and I had to fix a bug in Cobra, but overall it wasn't that bad.
I'm actually at Gophercon right now, if anyone wants to hack on Cobra at the community day on Thursday to make this easier, shoot me an email (@gmail).