Hacking Your iTerm. Boost your command line productivity by… | by Chandan Kumar

Picture supply — google

Some builders cringe on the mere considered opening a terminal window. For the uninitiated it may be daunting, nerve-racking, and downright annoying. However devs who perceive the command line would argue it’s among the finest instruments at your disposal. — Jake Rocheleau

So is it essential to do modern-day software program growth? Effectively probably not! You may nonetheless handle to do all of the stuff, however you may be lacking the enjoyable and productiveness which comes together with it.

True, there are elements to it. Such as you received’t get UI in all places. For instance, many instruments at the moment are transferring in direction of on-premise. Moreover, it’s the world of containers, the place you’ve to make use of the command line. After which regardless of how productive you’re with UI you would possibly endure should you don’t know the command line nicely.

A developer ought to attempt to cut back using mouse as a lot as they’ll — and the dependency on shortcuts needs to be elevated with the intention to enhance productiveness in long term.

Using UI not solely slows you down just a few seconds every time you navigate by means of it but additionally provides you the liberty to not bear in mind many shortcuts which can be there to make your work life simpler. And this doesn’t simply apply to the command line but additionally while you use any sort of editor.

A easy instance may very well be navigating to a file to open it within the editor versus utilizing a shortcut where-in you’ll be able to merely kind the filename to open it, while you do it you recognize which one is quicker after makes an attempt.

Now let’s get again to the subject once more. Beneath is my agenda for the article to cowl:

  1. iTerm
  2. powerlevel10k
  3. Syntax highlighting
  4. Auto-suggestions
  5. Reverse search
  6. Autojump
  7. Navigating into the command line
  8. Management your caps-lock

Mac comes with built-in terminal which is fundamental and may be customised.

iTerm acts like a wrapper round it — extra like a personalized model giving us lot extra options — equivalent to offering fancy stuff like colours on the command line.

Picture supply — iTerm

Seek advice from the hyperlink for set up — https://iterm2.com/

When you’re prepared with iTerm as your default terminal let’s customise it even additional utilizing powerlevel10k.

Picture supply — powerlevel10k github

Seek advice from the information for set up — https://github.com/romkatv/powerlevel10k

powerline10k will help you customise your command line in some ways, however the precise instructions that you simply’ll execute within the terminal will nonetheless be the identical as now and also you’ll not see any variations whereas typing or executing it.

Enabling syntax highlighting gives you an editor-like really feel the place you recognize should you’re typing the appropriate command or not.

Picture supply — google

Seek advice from the information for set up — https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md

If an IDE can provide you auto-suggestion so why not your terminal? Auto suggestion plugin will use your zsh historical past to counsel instructions as you kind.

Picture supply — google

Refer information for set up — https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md

You may press the up and down arrows in your terminal to navigate by means of your historical past. This navigates by means of your historical past chronologically.

Urgent the up arrow will go one entry earlier in your historical past. Urgent the down arrow will go one entry later in your historical past.

Picture supply — google

That is handy for instructions that you simply ran 5 minutes in the past. However it might get unwieldy when you find yourself trying to find an obscure command you used 5 days in the past.

As an alternative, we will use reverse-i-search.

reverse-i-search: Search backward beginning on the present line and transferring ‘up’ by means of the historical past as vital. That is an incremental search. (source)

Press ctrl + r once more to navigate by means of earlier entries in your historical past that match your search time period.

Autojump is a quicker option to navigate your filesystem. It really works by sustaining a database of the directories you employ essentially the most from the command line.

Picture supply — google

Directories should be visited first earlier than they are often jumped to.

Seek advice from the information for set up — https://github.com/wting/autojump

I’ve seen individuals going character by character within the terminal, which makes it actually gradual and worsening generally, why achieve this when you’ll be able to navigate phrase by phrase or simply bounce to the beginning or finish of a line utilizing shortcuts

I can manually kind in all of the shortcuts within the article however we’re speaking about productiveness and there are already good individuals who have created a pleasant little cheat sheet that you could comply with.

Command-line cheat sheet — https://gist.github.com/squarism/ae3613daf5c01a98ba3a

It’s additionally higher to focus on just a few generally used:

  • New Tab — + T
  • Shut Tab or Window — + W (similar as many mac apps)
  • Go to Tab + Quantity Key — (ie: ⌘2 is 2nd tab)
  • Cut up Window Vertically (similar profile) — + D
  • Cut up Window Horizontally (similar profile) — + Shift + D (mnemonic: shift is a large horizontal key)
  • Go to Cut up Pane by Order of Use — + ] , + [
  • Earlier Tab+ Left Arrow — (I often transfer by tab quantity)
  • Subsequent Tab+ Proper Arrow
  • Maximize a pane + Shift + Enter (use with fullscreen to temp fullscreen a pane!)

As lots of the shortcuts use ctrl as their initials and caps-lock is essentially the most unused key on the keyboard or not less than for me, I’ve modified the mapping to the management key for it.

MacOS: In System Preferences > Keyboard, one can find a backside on the backside proper labeled Modifier Keys. Click on this and go to the Caps Lock drop down. If you need to alter your Caps Lock key to Management, Choice, or Shift, use the choices within the dropdown. If you would like Backspace, set it to No Motion.

Now management is close to to my fingers once I use it and it makes my life straightforward.

More Posts