Skip to content

jin-li/ShellConfig

Repository files navigation

Language : 🇺🇸 | 🇨🇳

Shell Configuration

Configurations for Linux shell and Neovim

Linux Shell Configuration

Shell Appearence

Features

Install

Method 1: Use Installation Script (Recommend)

  1. Download the installation script:

    curl -s https://raw.githubusercontent.com/jin-li/ShellConfig/main/install_OhMyZsh_p10k.sh -o install_OhMyZsh_p10k.sh
  2. Run the script:

    Do NOT run it in root NOR using sudo, just run it as a normal user. When it prompts for password, then enter the root or sudo password.

    chmod +x install_OhMyZsh_p10k.sh
    ./install_OhMyZsh_p10k.sh

Method 2: Manual Install

  1. 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.

  2. Install zsh

    • Ubuntu, Debian & derivatives

      1. Update apt sources

        sudo apt update
      2. Install prerequisite tools (git, wget, python3, pip3)

        sudo apt install wget git python3-dev python3-pip python3-setuptools
      3. Install zsh

        sudo apt install zsh
    • Arch Linux or Manjaro

      sudo pacman -S zsh
    • Fedora

      sudo dnf install zsh
  3. Install oh-my-zsh via wget

    sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  4. Install powerlevel10k

    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  5. 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
  6. Download configuration files and link to home directory

    1. Download ShellConfig from GitHub
      mkdir -p ~/Documents/GitHub
      cd ~/Documents/GitHub
      git clone https://github.com/jin-li/ShellConfig.git 
    2. Backup old configuration files
      mv ~/.bashrc ~/.bashrc_bak
      mv ~/.zshrc ~/.zshrc_bak
    3. 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
  7. Restart terminal

Vim Configuration

Vim Appearance

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)

  1. Download the installation script:

    curl -s https://raw.githubusercontent.com/jin-li/ShellConfig/main/install_LazyVim.sh -o install_LazyVim.sh
  2. Run the script:

    chmod +x install_LazyVim.sh
    ./install_LazyVim.sh

Method 2: Manual Install

  1. 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
  2. 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.

      1. 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
      2. Extract the downloaded file
        sudo tar -C /opt -xzf nvim-linux64.tar.gz
        This will install Neovim to /opt/nvim-linux64 directory.
      3. Create a symbolic link to the Neovim executable
        sudo ln -s /opt/nvim-linux64/bin/nvim /usr/bin/nvim
    • 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
  3. Install LazyVim

    Refer to the official website, we can install LazyVim using the following command:

    1. Install LazyVim

      git clone https://github.com/LazyVim/starter ~/.config/nvim
    2. Remove the .git folder, so you can add it to your own repo later

      rm -rf ~/.config/nvim/.git
    3. First time run nvim will install the plugins automatically. It may take a while to finish.

      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:

LazyVim in macOS Terminal

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:

LazyVim in iTerm2

About

Jin Li's shell/vim configuration for Linux/macOS/WSL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors