Skip to content

Instantly share code, notes, and snippets.

@ksqsf
Last active January 15, 2024 17:58
Show Gist options
  • Save ksqsf/10aaed1be0f5faf706df82433e3bcb81 to your computer and use it in GitHub Desktop.
Save ksqsf/10aaed1be0f5faf706df82433e3bcb81 to your computer and use it in GitHub Desktop.
My zsh config
# Kitchen-sink for setting PATHs and other environmental variables.
# Also read by Emacs's exec-path-from-shell, so it has to be very short and fast.
export HOMEBREW_NO_INSTALL_FROM_API=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
export WORKON_HOME="$HOME/.virtualenvs/"
export RUST_SRC_PATH=$HOME/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src
export NVM_DIR="$HOME/.nvm"
eval "$(/usr/libexec/path_helper)"
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="./node_modules/.bin:$PATH"
export PATH="/usr/local/anaconda3/bin:$PATH"
export PATH="$HOME/.emacs.d/bin:$PATH"
export PATH="$HOME/.docker/bin:$PATH"
export PATH="$HOME/.ghcup/bin:$PATH"
[ -f ~/.nix-profile/etc/profile.d/nix.sh ] && source ~/.nix-profile/etc/profile.d/nix.sh
[ -f ~/.opam/opam-init/init.zsh ] && source ~/.opam/opam-init/init.zsh
[ -f ~/.xmake/profile ] && source ~/.xmake/profile
export PAGER=bat
export BAT_THEME=Catppuccin-mocha
# This is a recent (2024) version of my dot zsh file.
# It's fast, displays a cute Nyan cat, and has reasonable defaults and functions.
# There is ZERO plugin framework. Say goodbye to OMZ, zinit, zplug, ....
#
# NOTE: Require installing system packages.
# Search for 'SYSTEM' to find the required packages (using Homebrew package name).
### Welcome Message: The NyanCat
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
CYAN="$(tput setaf 6)"
WHITE="$(tput setaf 7)"
BOLD="$(tput bold)"
NOCOLOR="$(tput sgr0)"
echo
echo -en $RED'-_-_-_-_-_-_-_'
echo -e $NOCOLOR$BOLD$WHITE',------,'$NOCOLOR
echo -en $YELLOW'_-_-_-_-_-_-_-'
echo -e $NOCOLOR$BOLD$WHITE'| /\_/\\'$NOCOLOR ' HAPPY'
echo -en $GREEN'-_-_-_-_-_-_-'
echo -e $NOCOLOR$BOLD$WHITE'~|__( ^ .^)'$NOCOLOR ' HACKING!'
echo -en $CYAN'-_-_-_-_-_-_-'
echo -e $NOCOLOR$BOLD$WHITE'"" ""'$NOCOLOR
echo
### Appearance
export CLICOLOR=1
### Aliases and Commands
alias p="proxychains4"
alias ssh="ssh -Y"
alias sage="/Applications/SageMath-9.1.app/sage"
alias ghcdump="ghc -fforce-recomp -ddump-simpl -ddump-stg -ddump-cmm -ddump-to-file -dsuppress-all -dsuppress-uniques "
alias ghcdumpO2="ghc -O2 -fforce-recomp -ddump-simpl -ddump-stg -ddump-cmm -ddump-to-file -dsuppress-all -dsuppress-uniques "
alias ghcdumpO1="ghc -O1 -fforce-recomp -ddump-simpl -ddump-stg -ddump-cmm -ddump-to-file -dsuppress-all -dsuppress-uniques "
alias hb="hadrian/build -j"
alias hbq="hb --flavour=Quick --freeze1"
alias gc="git clone --depth=1"
alias cd=z
alias et="emacsclient -t"
ldd() { echo "use otool -L plz" }
unproxy() { unset all_proxy http_proxy https_proxy }
proxy() { export https_proxy=http://127.0.0.1:7890;export http_proxy=http://127.0.0.1:7890;export all_proxy=socks5://127.0.0.1:7890 }
[[ -o interactive ]] && proxy
### zsh modules
autoload zcalc
autoload zmv
### Customize ^W
my-backward-delete-word() {
local WORDCHARS=${WORDCHARS/\//}
local WORDCHARS=${WORDCHARS/-/}
local WORDCHARS=${WORDCHARS/\(/}
zle backward-delete-word
}
zle -N my-backward-delete-word
bindkey '^W' my-backward-delete-word
### Integration
eval "$(zoxide init zsh)" # SYSTEM: zoxide
eval "$(starship init zsh)" # SYSTEM: starship
source ~/.zsh/iterm2.zsh
source ~/.zsh/vterm.zsh
### Plugins
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/local/Cellar/fzf/*/shell/key-bindings.zsh
source /usr/local/Cellar/fzf/*/shell/completion.zsh
# source /usr/local/share/zsh-you-should-use/you-should-use.plugin.zsh
# source /usr/local/opt/zsh-fast-syntax-highlighting/share/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=102' # Make autosuggestions clearer in Emacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment