avatarThe PyCoach

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3579

Abstract

</p><div id="7f78"><pre><span class="hljs-attr">ZSH_THEME</span>=”powerlevel10k/powerlevel10k”</pre></div><figure id="b206"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*9eKfGyT-PZ6vZeDv3fhuug.png"><figcaption></figcaption></figure><p id="e19e">Then exit ~/.zshrc (<code>esc</code> &gt; :<code>wq</code> or <code>^x</code> &gt; <code>enter</code>) and apply the changes running the command below.</p><div id="36be"><pre><span class="hljs-built_in">source</span> ~/.zshrc</pre></div><p id="fa72">Then you’ll see the window below. If you want to install Meslo Nert Font (which I recommend you), press Y.</p><figure id="abab"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*3hXhPv4hu-4f9zQXdQkK0A.png"><figcaption></figcaption></figure><p id="ed97">The font will be downloaded and then we have to quit iTerm (use Cmd+Q).</p><p id="edde">Open iTerm again. You should see the image below (if not run “p10k configure”). These are a series of questions to verify everything is fine. If everything is as indicated in the questions, press Y.</p><figure id="a0e6"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*EfNsxfUPmzVHh13XdGwfbQ.png"><figcaption></figcaption></figure><p id="7979">Then you’ll see some preferences to configure the prompt style, heads, tails, spacing, etc. You can choose the options you like the most.</p><figure id="4fa0"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*EIM5D0yaiUJvi1baah-Eug.png"><figcaption></figcaption></figure><p id="fbbc">After the setup is done, iTerm2 should look like the image below.</p><figure id="6657"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*PfWeagPbFY3z3653TxuD0A.png"><figcaption>Upgraded Mac terminal</figcaption></figure><h2 id="78c6">Extra Customizations</h2><p id="3333">ITerm 2 can be further customized. We can increase the font size, install useful plugins, and more.</p><h2 id="0cd4">1. Change iTerm2 font size</h2><ol><li>Open iTerm2 preferences (cmd + ,)</li><li>Go to Profiles and click on Text</li><li>In the Font section, you can increase the font size and select other fonts</li></ol><figure id="c949"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*r53LE0JLQc0YIlcum_BStg.png"><figcaption></figcaption></figure><h2 id="6cf4">2. Install Plugins</h2><p id="d08e">Here are some useful plugins I recommend you to install.</p><h2 id="d4dc">a. Autosuggestions</h2><p id="5f57">First, install autosuggestions to get suggestions based on the previous commands you run on the terminal.</p><div id="8b53"><pre>git <span class="hljs-built_in">clone</span> https://github.com/zsh-users/zsh-autosuggestions <span class="hljs-variable">${ZSH_CUSTOM:-~/.oh-my-zsh/custom}</span>/plugins/zsh-autosuggestions</pre></div><p id="0c46">After installing a plugin, you go to the home folder, open ~/.zshrc, and modify the line below.</p><div id="e033"><pre>nano ~/.zshrc vim ~/.zshrc</pre></div><figure id="99f5"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*5kchEmAzTNbiw-Y3k7mHMA.png"><figcaption></figcaption></figure><p id="77bc">Add this plugin inside the parenthesis.</p><div id="a333"><pre><span class="hljs-attr">plugins</span>=(git zsh-autosuggestions)</pre></div><p id="a709">Exit ~/.zshrc and apply the changes by running the command below.</p><div id="efc6"><pre><span class="hljs-built_in">source</span> ~/.zshrc</pre></div><p id="5a7c">Now you should have auto suggestions enabled. Every time you type a command, you’ll see the suggestions in gray.</p><figure id="7f9a"><img src="https:// # Options cdn-images-1.readmedium.com/v2/resize:fit:800/1*SC-q3F9MaSnkEG22IGskBg.png"><figcaption></figcaption></figure><h2 id="78b4">b. Syntax-highlighting</h2><p id="aa69">If you want to add syntax and highlighting to the commands we run (like in a code editor), you should install this plugin with the command below.</p><div id="47d1"><pre>git <span class="hljs-built_in">clone</span> https://github.com/zsh-users/zsh-syntax-highlighting.git <span class="hljs-variable">${ZSH_CUSTOM:-~/.oh-my-zsh/custom}</span>/plugins/zsh-syntax-highlighting</pre></div><p id="94e2">As we did before, after the installation, we need to add this new plugin to the plugin variable inside ~/.zshrc.</p><div id="20af"><pre><span class="hljs-attr">plugins</span>=(git zsh-autosuggestions zsh-syntax-highlighting)</pre></div><p id="ebc7">Exit ~/.zshrc and apply the changes by running the command below.</p><div id="da1f"><pre><span class="hljs-built_in">source</span> ~/.zshrc</pre></div><p id="9332">Now you should have auto syntax-highlighting enabled.</p><p id="ab23">That’s it! You’ve just upgraded your Mac terminal.</p><h2 id="ce1c">3. Bonus: Themes for Vim</h2><p id="6f76">In case you’re using Vim as your text editor, you can also change the themes used for Vim.</p><p id="8fc3">To do so, open ~/.vimrc</p><div id="5ebe"><pre>vim ~/.vimrc</pre></div><p id="eb73">Now, to see a<b> </b>list of ready-to-use themes, type the following</p><div id="f59d"><pre>:<span class="hljs-selector-tag">colorscheme</span> <span class="hljs-selector-attr">[space]</span> <span class="hljs-selector-attr">[Ctrl+d]</span></pre></div><p id="c3c8">Now you should see all the themes available.</p><figure id="e577"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ht0pIKGl71LkSsfQ8IJDrg.png"><figcaption></figcaption></figure><p id="d763">If you want to set the default vim theme, type i (to enable insert mode) and then type the following to set the default color scheme to the color you want and also enable the syntax highlight</p><div id="4e4c"><pre>colorscheme [colorscheme_name] syntax <span class="hljs-keyword">on</span></pre></div><p id="f1c8">Here’s how your ~/.vimrc should look like (in this case, I chose the desert theme).</p><figure id="75e4"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*yuvUX8HESjTg8y1x2HKfpg.png"><figcaption></figcaption></figure><p id="84b9">Now press escape and then :wq to save and quit. Now vim will have the theme you chose!</p><p id="cf09"><a href="https://frankandrade.ck.page/08c94cf1c1"><b>Join my newsletter with 30K+ people to get my free ChatGPT cheat sheet.</b></a></p><p id="9e58">If you enjoy reading stories like these and want to support me as a writer, subscribe to my <a href="https://artificialcorner.substack.com/subscribe">Substack</a>. On Substack, I publish articles that you won’t find on the other platforms where I create content.</p><div id="fae9" class="link-block"> <a href="https://artificialcorner.substack.com/subscribe"> <div> <div> <h2>Subscribe to Artificial Corner by ThePyCoach</h2> <div><h3>Artificial Intelligence in plain English. In-depth tutorials to make the most of ChatGPT and other AI tools. The latest…</h3></div> <div><p>artificialcorner.substack.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*DWj0dQVuxM-KZoQh)"></div> </div> </div> </a> </div></article></body>

Your Mac Terminal Doesn’t Have to Look Ugly. Upgrade It In a Few Minutes

Here’s my guide to transform your Mac terminal, so that you become more productive as a programmer.

Image made with Dall-E 3

The Mac terminal is quite a useful tool for programmers, yet it doesn’t have a friendly interface.

If you’re a programmer, chances are you spend a lot of your time using the terminal. That’s why you should invest some minutes to upgrade it in order to become more productive when working with it.

Here’s how to upgrade your Mac terminal so it looks less like the first image and more like the second image below.

Old vs Upgraded Mac terminal

Install Homebrew

In this guide, we’ll use the brew command a lot, so the first thing to do is install Homebrew. Open up a terminal and paste the command below.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install iTerm2

Then we’re going to install iTerm 2. That’s a replacement for Terminal and has features you wouldn’t find on the default terminal. iTerm2 works on Macs with macOS 10.14 or newer. To install it run the command below in the terminal.

brew install --cask iterm2

Once you get the message “iterm2 was successfully installed!” a new iTerm icon will be added (press F4 to see it in launchpad)

Open iTerm 2. From now on, we’ll work with it. Now, let’s install some extra packages.

Install Git

Git will help us easily clone themes for our terminal a bit later.

brew install git

Install Oh-My-ZSh

Oh My Zsh is a framework that comes bundled with thousands of helpful functions, helpers, plugins, and themes that will help us transform our terminal.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Install Themes

There are many themes you can install to give a different look to your terminal. One cool theme I found on the internet is PowerLevel10K

First, install PowerLevel10K theme.

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Then set the theme in configuration. To do so, go to the home folder and open ~/.zshrc with the command below (you can use nano or vim for that).

nano ~/.zshrc
vim ~/.zshrc

Once ~/.zshrc is opened, locate the word “ZSH_THEME” and change its value to the name of the theme we installed (powerlevel10k/powerlevel10k)

ZSH_THEME=”powerlevel10k/powerlevel10k”

Then exit ~/.zshrc (esc > :wq or ^x > enter) and apply the changes running the command below.

source ~/.zshrc

Then you’ll see the window below. If you want to install Meslo Nert Font (which I recommend you), press Y.

The font will be downloaded and then we have to quit iTerm (use Cmd+Q).

Open iTerm again. You should see the image below (if not run “p10k configure”). These are a series of questions to verify everything is fine. If everything is as indicated in the questions, press Y.

Then you’ll see some preferences to configure the prompt style, heads, tails, spacing, etc. You can choose the options you like the most.

After the setup is done, iTerm2 should look like the image below.

Upgraded Mac terminal

Extra Customizations

ITerm 2 can be further customized. We can increase the font size, install useful plugins, and more.

1. Change iTerm2 font size

  1. Open iTerm2 preferences (cmd + ,)
  2. Go to Profiles and click on Text
  3. In the Font section, you can increase the font size and select other fonts

2. Install Plugins

Here are some useful plugins I recommend you to install.

a. Autosuggestions

First, install autosuggestions to get suggestions based on the previous commands you run on the terminal.

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

After installing a plugin, you go to the home folder, open ~/.zshrc, and modify the line below.

nano ~/.zshrc
vim ~/.zshrc

Add this plugin inside the parenthesis.

plugins=(git zsh-autosuggestions)

Exit ~/.zshrc and apply the changes by running the command below.

source ~/.zshrc

Now you should have auto suggestions enabled. Every time you type a command, you’ll see the suggestions in gray.

b. Syntax-highlighting

If you want to add syntax and highlighting to the commands we run (like in a code editor), you should install this plugin with the command below.

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

As we did before, after the installation, we need to add this new plugin to the plugin variable inside ~/.zshrc.

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Exit ~/.zshrc and apply the changes by running the command below.

source ~/.zshrc

Now you should have auto syntax-highlighting enabled.

That’s it! You’ve just upgraded your Mac terminal.

3. Bonus: Themes for Vim

In case you’re using Vim as your text editor, you can also change the themes used for Vim.

To do so, open ~/.vimrc

vim ~/.vimrc

Now, to see a list of ready-to-use themes, type the following

:colorscheme [space] [Ctrl+d]

Now you should see all the themes available.

If you want to set the default vim theme, type i (to enable insert mode) and then type the following to set the default color scheme to the color you want and also enable the syntax highlight

colorscheme [colorscheme_name]
syntax on

Here’s how your ~/.vimrc should look like (in this case, I chose the desert theme).

Now press escape and then :wq to save and quit. Now vim will have the theme you chose!

Join my newsletter with 30K+ people to get my free ChatGPT cheat sheet.

If you enjoy reading stories like these and want to support me as a writer, subscribe to my Substack. On Substack, I publish articles that you won’t find on the other platforms where I create content.

Programming
Data Science
Software Engineering
Python
Software Development
Recommended from ReadMedium