Setting up a fancy coding environment: Zsh, Tmux and Nvim

Are you tired of starting anew every time you’re on a new server/computer? And normal vim just sucks. Yeah, me too. So here you go. Or here I go. Whatever.

Sanna Persson
3 min readAug 31, 2023

Setting up ZSH

Content from: https://www.josean.com/posts/terminal-setup

Setting up oh-my-zsh to make you terminal look like this

Install zsh and make it to your main shell

sudo apt install -y zsh

Make it your default shell

sudo chsh -s /usr/bin/zsh

Check that it worked

echo $SHELL

Install oh-my-zsh

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

Install nice theme

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

Add theme in ~/.zshrc

ZSH_THEME="powerlevel10k/powerlevel10k"

Install plugins

Auto-complete in zsh shell

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

Zsh-syntax-highlighting

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

Add plugins in ~/.zshrc

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

Update oh-my-zsh settings

source ~/.zshrc

Install TMUX

sudo apt install tmux

Install plug-ins

First install the plug-in manager

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

Add to source-file in ~/.tmux.conf.

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

set -g prefix C-a
unbind C-b
bind-key C-a send-prefix

unbind %
bind | split-window -h

unbind '"'
bind - split-window -v

unbind r
bind r source-file ~/.tmux.conf

bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r h resize-pane -L 5
bind -r l resize-pane -R 5

bind -r m resize-pane -Z

set -g mouse on

set-window-option -g mode-keys vi

bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection

unbind -T copy-mode-vi MouseDragEnd1Pane

# tpm plugin manager
set -g @plugin 'tmux-plugins/tpm'

# list of tmux plugins
#set -g @plugin 'christoomey/vim-tmux-navigator'
#set -g @plugin 'jimeh/tmux-themepack'
#set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @plugin 'tmux-plugins/tmux-continuum'

#set -g @themepack 'powerline/default/cyan'

#set -g @resurrect-capture-pane-contents 'on'
#set -g @continuum-restore 'on'


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

Reload source

tmux source ~/.tmux.conf

Comment in the plug-ins

set -g default-terminal "screen-256color"
set -as terminal-features ",xterm-256color:RGB"

set -g prefix C-a
unbind C-b
bind-key C-a send-prefix

unbind %
bind | split-window -h

unbind '"'
bind - split-window -v

unbind r
bind r source-file ~/.tmux.conf

bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r h resize-pane -L 5
bind -r l resize-pane -R 5

bind -r m resize-pane -Z

set -g mouse on

set-window-option -g mode-keys vi

bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection

unbind -T copy-mode-vi MouseDragEnd1Pane

# tpm plugin manager
set -g @plugin 'tmux-plugins/tpm'

# list of tmux plugins
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'jimeh/tmux-themepack'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

set -g @themepack 'powerline/default/cyan'

set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'


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

Open TMUX by tmux and press ctrl+a shift-a. In your ~/.tmux/plugins -folder, a lot of plugins should now be installed. Now let’s install nvim.

Install Neovim

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage

Download nvim-setup into ~/.config/nvim with configuration for some plugins that you may or may not find useful

git clone https://github.com/SannaPersson/Fancy-Coding-Environment.git ~/.config/nvim

Run installation

./nvim.appimage

Add to path if nvim command not available

sudo ln -s $(pwd)/nvim.appimage /usr/local/bin/nvim

Add Github Copilot

Clone from repo for nvim (see: https://github.com/github/copilot.vim)

git clone https://github.com/github/copilot.vim.git ~/.config/nvim/pack/github/start/copilot.vim

Start nvim and write :Copilot setup to login and start using

Honestly, there is probably always some minor issues with setting up a completely new environment but these should be the main commands necessary in the most minimal text possible.

Now, let’s just just relax and enjoy coding.

--

--

Sanna Persson

Currently exploring the realms of deep learning. Particularly interested in healthcare applications