October 26, 2020

Terminal Setup

I can’t quite remember things, so I wrote down some steps to install stuff I like for my terminal setup.

Next time I do a fresh install it should be as annoying as today.

Colors

Colors from the Solarized color palette by Ethan Schoonover. The dark color scheme is cool by default but i find the light one easier on the eyes when there’s a lot of light.

It’s usually already present in most terminal emulators. I’ve tried it on:

  • The gnome-terminalsupport looks good, you just have to set the following settings.

    Gnome terminal settings

  • Another at work that i can’t remember. Something like QT terminal. Solarized looked pretty good over there too.

The $TERM environment variable should be set to something like xterm-256color for nice colors.

This is usually the case, execute echo $TERM to just be sure.

Font

I’ve chosen the Hack font for my terminal.

To install it I did this:

wget https://github.com/source-foundry/Hack/releases/download/v3.003/Hack-v3.003-ttf.zip
unzip Hack-v3.003-ttf.zip
cd ttf
sudo cp *.ttf /usr/local/share/fonts/
fc-cache -f -v

A good size is 11 points.

Shell

I use bash as my shell.

Editor

I use vim as my editor of choice.

The environment variable $EDITOR should be set to vim otherwise it’s annoying sometimes and it says vi: comand not found.

Just add in the ~/.bash-profile or ~/.bashrc file the following line:

export $EDITOR="vim"

Color scheme

There is a Solarized colorscheme to use in vim and it’s available here.

Just clone the repository and follow the instructions in the readme the instruction for the manual installation.

Basically just:

git clone git://github.com/altercation/vim-colors-solarized.git
cd vim-colors-solarized
mkdir --parents ~/.vim/colors
cp colors/solarized.vim ~/.vim/colors/

Fixing spell check

I’ve found a problem with the configuration with the built-in spell checker in vim, spell.

I’m not quite sure why, but after running the command

set spell

the spell checker run fine, but I could not see any highlighted wrong word.

Searching on the web pointed me to this issue.

I did the following changes in the solarized.vim file to restore the original behaviour:

diff --git a/vim-colors-solarized/colors/solarized.vim b/.vim/colors/solarized.vim
index 70f5223..8af1712 100644
--- a/home/scompo/programmi/vim-colors-solarized/colors/solarized.vim
+++ b/home/scompo/.vim/colors/solarized.vim
@@ -360,7 +360,8 @@ endif
     let s:none            = "NONE"
     let s:t_none          = "NONE"
     let s:n               = "NONE"
-    let s:c               = ",undercurl"
+    let s:c               = ",underline"
     let s:r               = ",reverse"
     let s:s               = ",standout"
     let s:ou              = ""
@@ -656,10 +657,10 @@ exe "hi! DiffText"       .s:fmt_none   .s:fg_blue   .s:bg_base02 .s:sp_blue
 endif
 exe "hi! SignColumn"     .s:fmt_none   .s:fg_base0
 exe "hi! Conceal"        .s:fmt_none   .s:fg_blue   .s:bg_none
-exe "hi! SpellBad"       .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_red
-exe "hi! SpellCap"       .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_violet
-exe "hi! SpellRare"      .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_cyan
-exe "hi! SpellLocal"     .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_yellow
+"exe "hi! SpellBad"       .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_red
+"exe "hi! SpellCap"       .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_violet
+"exe "hi! SpellRare"      .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_cyan
+"exe "hi! SpellLocal"     .s:fmt_curl   .s:fg_none   .s:bg_none    .s:sp_yellow
 exe "hi! Pmenu"          .s:fmt_none   .s:fg_base0  .s:bg_base02  .s:fmt_revbb
 exe "hi! PmenuSel"       .s:fmt_none   .s:fg_base01 .s:bg_base2   .s:fmt_revbb
 exe "hi! PmenuSbar"      .s:fmt_none   .s:fg_base2  .s:bg_base0   .s:fmt_revbb

I’ve opened an issue on the repository to tell them about the problem. This one.

Configuration file

My ~/.vimrc file consist of the following:

" Enable filetype plugins
filetype plugin on
filetype indent on

" When searching try to be smart about cases 
set smartcase

" Enable syntax highlighting
syntax enable 

" colors
set background=dark
colorscheme solarized

" Use Unix as the standard file type
set ffs=unix,dos,mac

set number
set relativenumber

" tab is 4 chars
set tabstop=4
" indent 4 chars
set shiftwidth=4
" auto indent
set autoindent
set smartindent

It will probably change, but that’s not really a problem right now.

Terminal multiplexer

I use tmux as a terminal multiplexer.

Install the last version from the distribution package manager and it’s fine.

The colors of vim are scaled down by default because tmux sets the $TERM variable to screen.

To fix that follow what’s suggested on the tmux FAQ and add the following line to the ~/.tmux.conf file:

set -g default-terminal "tmux-256color"

The rest is pretty good by default, CTRL-B is fine for me.

© Mauro Scomparin 2020 - 2023

Powered by Hugo & Kiss.