How to Setup Zsh Tmux and Alacritty

So lets just get started for setting up zsh, tmux, and Alacritty.

Alacritty Installation

Alacritty is fast and awesome terminal emulator with multi-platform support. My best choice an alternative for urxvt and terminator. I still considering for setting up st.

For archlinux user, install alacritty via pacman.

1
sudo pacman -S alacritty

Setup the alacritty configuration directory.

1
mkdir -p ~/.config/alacritty/; cd ~/.config/alacritty/
  1. Alacritty configuration file alacritty.yml

Below is the simple configuration I found on GitHub.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Configuration for Alacritty, the GPU enhanced terminal emulator.
## Created by Aditya Shakya (@adi1090x)

## It's a very basic and simple config file, for full configuration...
## See, /usr/share/doc/alacritty/example/alacritty.yml

## Import files (Colors, Fonts, Etc)
import:
  - ~/.config/alacritty/colors.yml
  - ~/.config/alacritty/fonts.yml

## Set environment variables
env:
  TERM: xterm-256color

## Terminal window settings
window:
  dimensions:
    columns: 84
    lines: 22

  padding:
    x: 8
    y: 8

  decorations: full
  startup_mode: Windowed
  dynamic_title: true

## scrolling
  history: 10000
  multiplier: 3

## Background opacity
background_opacity: 1.0

## Cursor
cursor:
  style:
    shape: Block
    blinking: On

  unfocused_hollow: false

## Live config reload
live_config_reload: true

Fonts configuration fonts.yml.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Font configuration
font:
  # Normal (roman) font face
  normal:
    family: "Iosevka"
    style: Medium

  # Bold font face
  bold:
    family: "Iosevka"
    style: Bold

  # Italic font face
  italic:
    family: "Iosevka"
    style: Italic

  # Bold italic font face
  bold_italic:
    family: "Iosevka"
    style: Bold Italic

  # Point size
  size: 13.4

  # Offset
  #offset:
  #  x: 0
  #  y: 0

  # Glyph offset
  #glyph_offset:
  #  x: 0
  #  y: 0
  1. Color schema configuration color.yml - for more color schema.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Colors (Ayu Dark)
colors:
  # Default colors
  primary:
    background: '#0A0E14'
    foreground: '#B3B1AD'

  # Normal colors
  normal:
    black: '#01060E'
    red: '#EA6C73'
    green: '#91B362'
    yellow: '#F9AF4F'
    blue: '#53BDFA'
    magenta: '#FAE994'
    cyan: '#90E1C6'
    white: '#C7C7C7'

  # Bright colors
  bright:
    black: '#686868'
    red: '#F07178'
    green: '#C2D94C'
    yellow: '#FFB454'
    blue: '#59C2FF'
    magenta: '#FFEE99'
    cyan: '#95E6CB'
    white: '#FFFFFF'

ZSH and Prezto

  1. Install ZSH.
1
sudo pacman -S zsh

Setup user to use ZSH as default shell.

1
sudo chsh -s /usr/bin/zsh username
  1. Install Prezto - it’s zsh framework just like oh-my-zsh but more simple and fast. Also support all of oh-my-zsh plugins.

Clone repository.

1
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

Create new zsh configuration needed using the following command.

1
2
3
4
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

Now restart your terminal and you will get zsh shell with prezto.

Prezto comes with additional command prompt for choosing theme.

1
2
prompt -l
prompt -p themen-ame

More info about prezto.

Tmux Configuration

  1. Install tmux via pacman.
1
sudo pacman -S tmux
  1. Tmux configuration ~/.tmux.conf.
# Use C-s (control and s key at the same time) as the prefix key
unbind C-b
set -g prefix C-s
bind-key -r C-s send-prefix

bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"

bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R

set-option -g default-terminal "screen-256color"
set-option -g status-keys "emacs"

bind-key - split-window -v  -c '#{pane_current_path}'
bind-key '"' split-window -h -c '#{pane_current_path}'

# Fine adjustment (1 or 2 cursor cells per bump)
bind -n S-Left resize-pane -L 2
bind -n S-Right resize-pane -R 2
bind -n S-Down resize-pane -D 1
bind -n S-Up resize-pane -U 1

# Coarse adjustment (5 or 10 cursor cells per bump)
bind -n C-Left resize-pane -L 10
bind -n C-Right resize-pane -R 10
bind -n C-Down resize-pane -D 5
bind -n C-Up resize-pane -U 5

bind c new-window -c "#{pane_current_path}"

set -g base-index 1
set -g renumber-windows on
set -g mouse on
setw -g mode-keys vi

bind-key b break-pane -d

bind-key C-j choose-tree

set-option -g status-left-length 100

# setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c" \; display-message     "copied to system clipboard"

# Update default binding of `Enter` to also use copy-selection
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c" \; display-message "copied to system clipboard"

# copy from tmux to clipboard
#bind-key -T copy-mode-vi y send-keys -X copy-pipe "xclip -r" \; display-message "Copied to selection"
#bind-key -T copy-mode-vi Y send-keys -X copy-pipe "xclip -r -selection clipboard" \; display-message "Copied to clipboard"
#bind-key C-p run-shell "xclip -o | tmux load-buffer - && tmux paste-buffer"

set -g @yank_selection 'primary'
#set -g @themepack 'powerline/block/green'


# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
#set -g @plugin 'jimeh/tmux-themepack'

set -g @plugin "arcticicestudio/nord-tmux"

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

For this configuration I use tmux theme nord-tmux - I dont need any additional status-bar on tmux.

Learn more on this tmux course - free and thanks.

Setup zsh and tmux as default shell

Using prezto is simple.

1
vim ~/.zprezto/runcoms/zpreztorc

Add the tmux plugin - below is my tmux plugin I use.

# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'colorize' \
  'tmux' \
  'history-substring-search' \
  'prompt' \
  'git' \
  'pacman' \
  'ssh' \
  'vagrant' \
  'autojump'

Now go to the bottom of the line and uncomment the tmux options.

#
# Tmux
#

# Auto start a session when Zsh is launched in a local terminal.
 zstyle ':prezto:module:tmux:auto-start' local 'yes'

# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'

# Integrate with iTerm2.
# zstyle ':prezto:module:tmux:iterm' integrate 'yes'

# Set the default session name:
zstyle ':prezto:module:tmux:session' name 'NAME-YOUR-SESSION'

and viola is done.