Making the Linux terminal beautiful and convenient

All Linux distributions come with a functional and customizable terminal emulator. On the Internet, and sometimes even in the terminal itself, there are a lot of ready-made themes to make it look beautiful. However, in order to make something beautiful and at the same time convenient and easy to use from a standard terminal (in any DE, any distribution), I spent a lot of time. So, how to make the default terminal convenient and pleasant to use?

Adding functionality

command shell

Most distributions ship with Bash built in. Using add-ons you can make it whatever you want, but it's much easier to achieve this with zsh. Why?

  • Advanced mechanics of autocompletion of commands on click or . Unlike Bash, you don't need to set it up, everything works at the highest level right out of the box.
  • Lots of ready-made themes, modules, plugins and more. Customizability through frameworks (oh-my-zsh, prezto, etc.), which greatly expand the possibilities of customization and improvement of the terminal. Again, all this can be done in Bash, but Zsh has a lot of ready-made materials. For Bash, there are significantly fewer of them, and some do not exist at all.

These are the main reasons why I switched from Bash to Zsh. In addition, Zsh has many other "goodies".

zsh setup

First, install Zsh (if it is already installed, for example, like in Manjaro, you can skip this step):

sudo apt install zsh

When prompted to set Zsh as your default shell, click Yto confirm.

Oh-My-zsh is a popular and actively developing Zsh framework that allows you to flexibly customize the terminal shell. Let's install it:

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

zsh: command not found: curl
Set curl:

sudo apt install curl

Syntax highlighting. It is much easier to navigate through the contents of the terminal when different parts of the commands are highlighted in different colors. For example, directories will be underlined, and commands will be highlighted in a different color than regular text. Install the plugin zsh-syntax-highlighting:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

zsh: command not found: git
Install git:

sudo apt install git

In order for the plugin to work, it must be enabled.

In file ~/.zshrc change the line from plugins=:

plugins=(git zsh-syntax-highlighting)

If there is no such line, add it.

Ready! We get a convenient and functional terminal. Now let's make it visually pleasing.

Customizing the look

Installing the theme PowerLevel10K:

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

Download and add the font to the system JetBrains Mono Nerd (with icons):
Choose one of list of, in folder ΡˆΡ€ΠΈΡ„Ρ‚/complete choose a font without "Windows Compatible", ending with "Mono".

We connect the font and theme.

Editing ~/.zshrc.

If the file already has these lines, replace them.

  • ZSH_THEME="powerlevel10k/powerlevel10k"
  • POWERLEVEL9K_MODE="nerdfont-complete"

Colors. An important part of the terminal design is the color scheme. I went through many different schemes, edited them, settled on Monokai Dark. Does not hurt the eyes, but at the same time pleasant and bright. Color List:

[colors]

# special
foreground      = #e6e6e6
foreground_bold = #e6e6e6
cursor          = #fff
background      = #000

# black
color0  = #75715e
color8  = #272822

# red
color1  = #f92672
color9  = #f92672

# green
color2  = #a6e22e
color10 = #a6e22e

# yellow
color3  = #434648
color11 = #7ea35f

# blue
color4  = #66d9ef
color12 = #66d9ef

# magenta
color5  = #ae81ff
color13 = #ae81ff

# cyan
color6  = #adb3b9
color14 = #62ab9d

# white
color7  = #2AA198
color15 = #2AA198

In different terminals, the color scheme changes differently (usually, this is done through the terminal settings), but the order of colors is the same everywhere. You can import this template in Termite format and export it for your terminal via terminal.sexy

Run the theme configuration: p10k configure.
Customize the theme by choosing the display options you like best.

The final touch is to change the theme config and replace the built-in colors.

Editing the file ~/.p10k.zsh.

If the file already has these lines, replace them. Color codes can be obtained with the command

for i in {0..255}; do print -Pn "%K{$i}  %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'n'}; done

  • Display only the current directory:
    typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
  • The background of the block with the directory:
    typeset -g POWERLEVEL9K_DIR_BACKGROUND=33
  • Arrow colors:
    typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=2

    ΠΈ

    typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=1

  • Git branch background:
    typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=15

Experience the Power of Effective Results

Making the Linux terminal beautiful and convenient
Mistake:
Making the Linux terminal beautiful and convenient
git:
Making the Linux terminal beautiful and convenient

Sources of

Documentation PowerLevel10K
Online terminal color scheme designer
Differences between Bash and Zsh

Source: habr.com

Add a comment