As someone who interacts with the terminal almost as much as with editors and browsers, it's time to do some tinkering. Previously, I downloaded oh-my-zsh. However, I have always been using its default theme - robbyrussell. This theme is actually quite good, much cleaner and more visually appealing compared to the built-in zsh. But as a frontend developer, how can I resist the urge to tinker 🌊.
Preparation before tinkering#
I won't go into the specific installation steps, you can check the documentation for that.
Configuration needed#
iTerm color themes#
This theme library contains over 170 themes. You can download the files to your local machine and import them into color presets (use the shortcut cmd + i).
zsh theme#
I'm using powerlevel9k, which allows for further customization of the terminal, like this 🌰.
Of course, you can also do this.
Installing powerlevel9k#
- Clone the theme repository
$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
- Set the theme in .zsh
ZSH_THEME="powerlevel9k/powerlevel9k"
zsh-related plugins#
These are two plugins that I recommend, but you can also add other plugins. The specific repository can be found here.
Installing zsh plugins in two ways#
Using oh-my-zsh#
- Clone the plugin repository
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- Find the plugins section in ~/.zshrc and add this plugin
plugins = (
git
rails
zsh-autosuggestions
)
Using .zshrc#
- Same as above
- Add this line to .zshrc
source ./zsh-syntax-highlighting/zsh-syntax-highlighting.
Others#
Hiding user information#
When you open the terminal, you'll notice a long user information prefix. It feels a bit unnecessary, so how do we hide it? I remember that it wasn't there when I was using the robbyrussell theme, so it's likely due to the theme file. Open the powerlevel9k.zsh-theme file (pay attention to the clone path mentioned earlier).
# Note that if $DEFAULT_USER is not set, this prompt segment will always print
So the solution is to set the default username in .zshrc.
VS Code configuration#
After completing the above steps, a good-looking and functional terminal is born. Let's open VS Code and get to work. Wait, what's with the garbled characters? It turns out I forgot to set the terminal font. Open the settings.json file and add the following line.
"terminal.integrated.fontFamily": "Meslo LG M (your font) for Powerline"