Skip to content

The only configuration guide you need for shell.

Notifications You must be signed in to change notification settings

Liskie/Need4Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Need4Shell

The only configuration guide you need for shell.

GitHub Repo stars GitHub watchers GitHub forks

Steps

  1. Install Oh-My-Zsh

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

    Starship can be installed on Linux and macOS with one simple command:

    curl -k -sS https://starship.rs/install.sh | sh

    Note: Curl's verification of certificate is turned off in this command.

    This command will place the Starship binary in /usr/local/bin by default. If you'd like to place the binary somewhere else, specify the --bin-dir option:

    wget https://starship.rs/install.sh
    sh ./install.sh --bin-dir "your custom bin directory"

    Also, remember to add the custom bin directory to your $PATH variable.

  3. Configure Starship

    By default, you need to create ~/.config/starship.toml first and put in any config you want with:

    vim ~/.config/starship.toml

    Alternatively, you can just copy the starship.toml in this repository to ~/.config/starship.toml:

    cp starship.toml ~/.config/starship.toml

    If you are using our config file, please make sure you have installed any Nerd font in your system. If not, you can download one from here.

    Here is a preview of shell prompt with our configuration file: Prompt Preview

    If you use conda, you may want to disable the default conda prompt change. To do so, just run:

    conda config --set changeps1 False
  4. Configure zsh plugins

    We use a selected minimal set of plugins for zsh. You may edit the zsh config file:

    vim ~/.zshrc

    and replace the default plugins plugins=(git) with the following:

    plugins=(
        git
        extract
        cp
        zsh-autosuggestions
        zsh-syntax-highlighting
        sudo
        tmux
        autojump
    )

    Some of the plugins are not installed by default. You may want to install them first:

    For autojump:

    Install it with sudo apt install autojump on Ubuntu or brew install autojump on macOS.

    For zsh-autosuggestions:

    Install it with sudo apt install zsh-autosuggestions on Ubuntu or brew install zsh-autosuggestions on macOS.

    You can also install it manually:

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

    For zsh-syntax-highlighting:

    Install it with sudo apt install zsh-syntax-highlighting on Ubuntu or brew install zsh-syntax-highlighting on macOS.

    You can also install it manually:

    git clone git@github.com:zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  5. Restart your shell

    After all these changes, you may need to restart your shell to see the changes.

Others

  • We provide a Monokai Pro based color scheme for JetBrains IDEs in this repository.

  • If you develop with Python, you may want to optimize your traceback output with Rich globally. To do so, you should first make sure conda is installed, and run:

    conda activate "your env name"
    pip install rich

    Next, according to the Official Documentation of Rich, you need to modify the sitecustomize.py file. Usually this file is located in your virtual env directory, for example, ~/anaconda3/envs/base/lib/python3.11/site-packages/sitecustomize.py. If you are not sure about where it is, run:

    python -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())"

    This prints the path of the site-packages directory, and you may find the sitecustomize.py file in it. If the file does not exist, just create one.
    Once you find the sitecustomize.py file, you need to add the following code to it:

    try:
       from rich import traceback
       traceback.install(show_locals=True, width=10000)
    except ImportError:
       pass

    It's done! Now you can enjoy the beautiful traceback output with Rich. But notice that these configurations are env-specific, so you need to repeat these steps for every virtual env you have.

  • If you are using hdfs, we recommend setting the following aliases:

    alias hfs='hdfs dfs'
    alias hls='hdfs dfs -ls'
    alias hcat='hdfs dfs -cat'
    alias hput='hdfs dfs -put'
    alias hget='hdfs dfs -get'
    alias hrm='hdfs dfs -rm'
    alias hrmdir='hdfs dfs -rmdir'
    alias hmkdir='hdfs dfs -mkdir'
    alias hdu='hdfs dfs -du'
    alias hmv='hdfs dfs -mv'
    alias hcp='hdfs dfs -cp'
    alias htail='hdfs dfs -tail'
    alias hchmod='hdfs dfs -chmod'
    alias hchown='hdfs dfs -chown'
    alias hchgrp='hdfs dfs -chgrp'
    alias htouchz='hdfs dfs -touchz'

    Copy and paste the above code to your ~/.zshrc file, and source ~/.zshrc, then you can use these aliases in your shell.

Troubleshooting

  1. Zsh is not installed.

    When you install Oh-My-Zsh with the command provided in Install Oh-My-Zsh, you may find the following error:

    Zsh is not installed. Please install zsh first.

    Which means you should first install zsh with: Which means you should first install zsh with:

    sudo apt install zsh # On ubuntu

    or:

    brew install zsh # On macOS

    Then you can run the command again to install Oh-My-Zsh.


If you find this repository useful, please give us a star. Thank you!

About

The only configuration guide you need for shell.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published