Skip to content

Instantly share code, notes, and snippets.

@kvnxiao
Last active November 2, 2023 10:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvnxiao/618da3b8afc07e361a222a15ad1e334e to your computer and use it in GitHub Desktop.
Save kvnxiao/618da3b8afc07e361a222a15ad1e334e to your computer and use it in GitHub Desktop.
.zshrc using zgenom
# Aliases
export PATH="$HOME/.local/bin:/opt/rust/bin:$PATH"
alias ls="lsd -a"
alias fd="fdfind"
alias vi="nvim"
alias vim="nvim"
alias ztop="zenith"
alias ljd="python3 $HOME/github/luajit-decompiler/main.py"
setopt histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Load zgenom
if [[ ! -f "$HOME/.zgenom/zgenom.zsh" ]]; then
git clone https://github.com/jandamm/zgenom.git "${HOME}/.zgenom"
fi
source "$HOME/.zgenom/zgenom.zsh"
# Check for plugin and zgenom updates every 7 days
# This does not increase the startup time.
zgenom autoupdate
if ! zgenom saved; then
echo "Creating a zgenom save"
zgenom load zsh-users/zsh-autosuggestions
zgenom load zdharma-continuum/fast-syntax-highlighting
zgenom load zsh-users/zsh-history-substring-search
zgenom load zsh-users/zsh-completions
# save all to init script
zgenom save
# Compile zsh files
zgenom compile "$HOME/.zshrc"
fi
# Fuzzy finder
if [[ ! -f "$HOME/.fzf.zsh" ]]; then
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
fi
source "$HOME/.fzf.zsh"
eval "$(zoxide init zsh)"
# Keybinds
bindkey '^[[A' history-substring-search-up # UP
bindkey '^[[B' history-substring-search-down # DOWN
bindkey '^[[1;5D' backward-word # CTRL+LEFT
bindkey '^[[1;5C' forward-word # CTRL+RIGHT
bindkey '\b' backward-kill-word # CTRL+BACKSPACE for Konsole
bindkey '^[[3;5~' kill-word # CTRL+DELETE
bindkey '^[[1~' beginning-of-line # HOME
bindkey '^[[4~' end-of-line # END
bindkey '^[[3~' delete-char # DELETE
eval "$(starship init zsh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment