Preface
Okay, so for the uninitiated, there’s actually a ton of different ways you can interact with a linux terminal. Without getting too technical, there are things called “shells” and different shells, you can kinda think as different “flavors” or “styles” of using a terminal. Each of them with their own pros and cons, but if you’re just getting into this whole Linux shell thing, there’s a good chance you’ve come across one of the most widely-used shells out there called Bash
. Bash stands for the “Bourne Again SHell” which has a very long and interesting history. Yeah, it’s probably older than you are.
Apart from Bash
, there are other different shells like fish
and zsh
. For example, MacOS ships with zsh
by default. After first being introduced to bash
, a while back I decided to venture out into zsh
and see what that could offer. And I liked it! It was primarily thanks to frameworks that enhance zsh
like oh-my-zsh
.
Oh My ZSH
At first, once I figured out how to install oh-my-zsh
I primarily used it simply just to change the look of my terminal. Anything to just get away from the sort of “standard” default look of a regular bash shell. And as it turns out, there’s actually a TON of really cool ZSH themes available to try out simply by changing a single line in your ~/.zshrc
file. (I actually used the jonathan
theme for a really long time)
Many Years Later
I’m talking many. Seriously. That was literally the extent to which I used oh-my-zsh
. Until just recently, I started discovering PLUGINS. The very first one I found use of was zsh-ssh and I still use this one daily for both work and personal. It’s incredible effective since sometimes my SSH config file can be several hundred lines long. The idea is simple. TAB to autocomplete your SSH alias. List all aliases from your config, search for the one you’re looking for using fzf
. Incredibly useful, please check it out https://github.com/sunlei/zsh-ssh
And Finally…
I can’t believe I’ve gone so long without ever using or knowing about this one, but here ya go… autosuggestions for ZSH in general instead of just for SSH aliases. There’s a handful of ways you can configure it; I think by default it just goes by your bash (zsh) history, but so far, it’s amazing. It simply tries to fill in whatever command you’re about to type and so far it’s been amazing in saving me tons of keystrokes and freed up valuable brain space in remembering command syntax. Half the time I can never remember exactly which flag I need (or if I even need a specific flag) and all that mess. Autocomplete to the rescue!
Customization
By default, zsh-autosuggestions
has you accepting the current suggestion with the right arrow key, which for me, is kinda clunky. One last tip and I’ll let you go. To change the key that’s used to accept the current autosuggestion, you can add the following one-liner to your ~/.zshrc
file and you’ll be able to accept the current suggestion with TAB instead:
bindkey '^I' autosuggest-accept
Yeah, I know, ^I kinda looks exactly like CTRL+I, but trust me, it somehow translates to the TAB key. Go figure. Computers. If you need me, I’ll be autocompleting shell commands like I know what I’m doing! Thanks for reading.