Shell Configuration
Here’s how it looks like:
Features
- Shell: oh-my-zsh
- Theme: powerlevel10k
- Plugins: zsh-autosuggestions, zsh-syntax-highlighting
Install
Method 1: Use Installation Script (Recommend)
-
Download the installation script:
1
curl -s https://raw.githubusercontent.com/jin-li/ShellConfig/main/install_OhMyZsh_p10k.sh -o install_OhMyZsh_p10k.sh
-
Run the script:
Do NOT run it in
root
NOR usingsudo
, just run it as a normal user. When it prompts for password, then enter theroot
orsudo
password.1 2
chmod +x install_OhMyZsh_p10k.sh ./install_OhMyZsh_p10k.sh
Method 2: Manual Install
-
Install Meslo Nerd Font
Download these four ttf files:
Double-click on each file and click “Install”. This will make
MesloLGS NF
font available to all applications on your system.For setting up the font in the preference of the terminals, please refer to p10k Font.
-
-
Ubuntu, Debian & derivatives
-
Update
apt
sources1
sudo apt update
-
Install prerequisite tools (git, wget, python3, pip3)
1
sudo apt install wget git python3-dev python3-pip python3-setuptools
-
Install zsh
1
sudo apt install zsh
-
-
Arch Linux or Manjaro
1
sudo pacman -S zsh
-
Fedora
1
sudo dnf install zsh
-
-
Install oh-my-zsh via wget
1
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
-
Install powerlevel10k
1
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
-
Install plugins and tools
- zsh-autosuggestions
1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- zsh-syntax-highlighting
1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- zsh-autosuggestions
-
Download configuration files and link to home directory
- Download ShellConfig from GitHub
1 2 3
mkdir -p ~/Documents/GitHub cd ~/Documents/GitHub git clone https://github.com/jin-li/ShellConfig.git
- Backup old configuration files
1 2
mv ~/.bashrc ~/.bashrc_bak mv ~/.zshrc ~/.zshrc_bak
- Link configuration files to home directory
1 2 3
ln ~/Documents/GitHub/ShellConfig/.bashrc ~/.bashrc ln ~/Documents/GitHub/ShellConfig/.zshrc ~/.zshrc ln ~/Documents/GitHub/ShellConfig/.p10k.zsh ~/.p10k.zsh
- Download ShellConfig from GitHub
-
Restart terminal
Vim Configuration
Motivation
I migrated from vim to Neovim because of the better performance and more features.
LazyVim is a starter-friendly configuration for Neovim with the commonly used plugins. It is easy to install and use.
Method 1: Use Installation Script (Recommend)
-
Download the installation script:
1
curl -s https://raw.githubusercontent.com/jin-li/ShellConfig/main/install_LazyVim.sh -o install_LazyVim.sh
-
Run the script:
1 2
chmod +x install_LazyVim.sh ./install_LazyVim.sh
Method 2: Manual Install
-
Remove vim-tiny or vim-minimal
The default vim in Debian OS is vim-tiny (in Fedora is vim-minimal), which does not support the plugins. Use following command to check your vim version first before using this configuration.
1
vi --version
If there is “Small version without GUI” in the output, it means your vim is vim-tiny or vim-minimal. You can remove it:
- Debian / Ubuntu
1
sudo apt remove vim-tiny
- Fedora
1
sudo dnf remove vim-minimal
- Debian / Ubuntu
-
Install Neovim
Then install Neovim.
-
Debian / Ubuntu
Since LazyVim requires Neovim 0.8 or later, in Ubuntu 22.04, the neovim version is 0.6.1. Therefore, We need to install the newer version of neovim from the official website.
- Download the pre-built binaries of Neovim from the official website
1
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
- Extract the downloaded file
This will install Neovim to /opt/nvim-linux64 directory.
1
sudo tar -C /opt -xzf nvim-linux64.tar.gz
- Create a symbolic link to the Neovim executable
1
sudo ln -s /opt/nvim-linux64/bin/nvim /usr/bin/nvim
- Download the pre-built binaries of Neovim from the official website
-
Fedora
In Fedora 40, the Neovim version is 0.9.5, which is new enough to use LazyVim. So we can install it using dnf directly.
1
sudo dnf install neovim
-
-
Install LazyVim
Refer to the official website, we can install LazyVim using the following command:
-
Install LazyVim
1
git clone https://github.com/LazyVim/starter ~/.config/nvim
-
Remove the
.git
folder, so you can add it to your own repo later1
rm -rf ~/.config/nvim/.git
-
First time run nvim will install the plugins automatically. It may take a while to finish.
1
nvim
-
Replace macOS Terminal
After installing LazyVim, I found that the display effect of LazyVim in macOS Terminal is very poor, with dim colors and low contrast:
The reason is that the macOS Terminal’s color scheme does not support 256 true colors, while LazyVim defaults to a 256-color color scheme. I heard that iTerm2 supports 256 true colors, so I decided to migrate from the macOS built-in terminal to iTerm2. After installing iTerm2, you need to set iTerm2 to use the Meslo Nerd font you downloaded and installed earlier. Then open LazyVim in iTerm2, it looks much better now: