Language : 🇺🇸 | 🇨🇳
Configurations for Linux shell and Neovim
- Shell: oh-my-zsh
- Theme: powerlevel10k
- Plugins: zsh-autosuggestions, zsh-syntax-highlighting
-
Download the installation script:
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
rootNOR usingsudo, just run it as a normal user. When it prompts for password, then enter therootorsudopassword.chmod +x install_OhMyZsh_p10k.sh ./install_OhMyZsh_p10k.sh
-
Install Meslo Nerd Font
Download these four ttf files:
Double-click on each file and click "Install". This will make
MesloLGS NFfont 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
aptsourcessudo apt update
-
Install prerequisite tools (git, wget, python3, pip3)
sudo apt install wget git python3-dev python3-pip python3-setuptools
-
Install zsh
sudo apt install zsh
-
-
Arch Linux or Manjaro
sudo pacman -S zsh
-
Fedora
sudo dnf install zsh
-
-
Install oh-my-zsh via wget
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -
Install powerlevel10k
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
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions - fast-syntax-highlighting
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
- zsh-autosuggestions
-
Download configuration files and link to home directory
- Download ShellConfig from GitHub
mkdir -p ~/Documents/GitHub cd ~/Documents/GitHub git clone https://github.com/jin-li/ShellConfig.git
- Backup old configuration files
mv ~/.bashrc ~/.bashrc_bak mv ~/.zshrc ~/.zshrc_bak
- Link configuration files to home directory
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
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.
-
Download the installation script:
curl -s https://raw.githubusercontent.com/jin-li/ShellConfig/main/install_LazyVim.sh -o install_LazyVim.sh
-
Run the script:
chmod +x install_LazyVim.sh ./install_LazyVim.sh
-
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.
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
sudo apt remove vim-tiny
- Fedora
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
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.
sudo tar -C /opt -xzf nvim-linux64.tar.gz
- Create a symbolic link to the Neovim executable
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.
sudo dnf install neovim
-
-
Install LazyVim
Refer to the official website, we can install LazyVim using the following command:
-
Install LazyVim
git clone https://github.com/LazyVim/starter ~/.config/nvim -
Remove the
.gitfolder, so you can add it to your own repo laterrm -rf ~/.config/nvim/.git -
First time run nvim will install the plugins automatically. It may take a while to finish.
nvim
-
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:



