Rebuilding My Zsh and Neovim Setup from Scratch in 2022

Zsh+zinit and NeoVim+vim-plug

* This page contains promotional content

I have been a fan of the Zsh shell on Linux and elsewhere for a long time, and lately I have even flirted with fish, but I took another look at my configuration files for the first time in ages.
I had been managing my shared configuration files (dotfiles) on GitHub, and to my surprise the last update turned out to be about 10 years ago. (@_@)

The configuration files were quite old too, and various helper tools and plugins have changed, so I reviewed everything from scratch.

The article below builds Zsh+zinit and NeoVim+vim-plug in a Linux (Debian11) and an Apple M1 (Monterey) environment

Preparation

It can be used on Red Hat based CentOS as well, but the zsh version there is old and many packages are not available through yum or dnf, so I will proceed in a Debian11 environment

Installing the required packages (Debian)

$ sudo apt update
$ sudo apt -y install curl git zsh neovim peco ripgrep bat

On a Mac, install the same packages with Homebrew by using the brew command instead of apt, and add coreutils as well.
Also, it does not have to be run with sudo

## Homebrew for Mac
$ brew install curl git zsh neovim peco ripgrep bat coreutils

Zsh

Around zsh I am going to use zinit, peco, fzf and powerlevel10k

Zinit

The official location changed in 2022/10, so I have corrected the installation method.

$ zsh
$ bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
$ source ~/.zshrc
$ zinit self-update

If zinit fails, see the article below

fzf Install

$ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
$ ~/.fzf/install

Powerlevel10k

$ git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k

.zshrc

Replace the .zshrc you already have with the contents below
Note that since this is still an early stage, there may be configuration mistakes or things that are missing

Enabling the zsh configuration

Once you have replaced .zshrc, reload the configuration to enable it

$ source ~/.zshrc

If an error appears here, delete .zshrc
When .zshrc does not exist, /etc/zsh/zshrc is loaded, and you could also copy the one from /usr/share/doc/zsh-common/examples/zshrc.

Neovim

Create the folder

mkdir -p ~/.config/nvim/plugged

vim-plug

sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

init.vim

Place the init.vim below as ~/.config/nvim/init.vim

Start Neovim (nvim) and run :PlugInstall to install the plugins defined inside init.vim

Notes

In .zshrc I wrote everything out in a single file, which is not very elegant, so I think it would be easier to manage if each setting were split into separate files and loaded from there, and I want to consider that going forward.

In my case I do not use Dropbox, but I create a sync directory with ResillioSync, manage Git inside it, and put a symbolic link to .zshrc.
Doing it this way means the latest .zshrc is loaded on any machine, which makes management easier

This article has gotten long, so I plan to write a separate article about how to use what I defined in .zshrc

See also