Skip to content

Instantly share code, notes, and snippets.

@PainterHalver
Last active April 27, 2024 01:48
Show Gist options
  • Save PainterHalver/fc348d5132252e7bb0acf44fef33d11e to your computer and use it in GitHub Desktop.
Save PainterHalver/fc348d5132252e7bb0acf44fef33d11e to your computer and use it in GitHub Desktop.
.zshrc
source ~/zsh/powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/zsh/.p10k.zsh ]] || source ~/zsh/.p10k.zsh
# Don't consider certain characters part of the word, good for foward/backward-word
WORDCHARS=${WORDCHARS//\/}
# configure key keybindings, stolen from Kali
bindkey -e # emacs key bindings
bindkey ' ' magic-space # do history expansion on space
bindkey '^U' backward-kill-line # ctrl + U
bindkey '^[[3;5~' kill-word # ctrl + Supr
bindkey '^[[3~' delete-char # delete
bindkey '^[[1;5C' forward-word # ctrl + ->
bindkey '^[[1;5D' backward-word # ctrl + <-
bindkey '^H' backward-kill-word # ctrl + backspace
bindkey '^[[5~' beginning-of-buffer-or-history # page up
bindkey '^[[6~' end-of-buffer-or-history # page down
bindkey '^[[H' beginning-of-line # home
bindkey '^[[F' end-of-line # end
bindkey '^[[Z' undo # shift + tab undo last action
# enable completion features
fpath=(/usr/share/zsh/vendor-completions $fpath)
FPATH=/usr/share/zsh/vendor-completions:$FPATH
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
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-zA-Z}={A-Za-z}'
zstyle ':completion:*' rehash true
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# History configurations, this should make it work like Powershell :D
HISTFILE=$ZDOTDIR/.zsh_history
HISTSIZE=1000
SAVEHIST=2000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt INC_APPEND_HISTORY # Save every command to history, not wait until exit session like APPEND_HISTORY
#setopt share_history # share command history data
# Aliases
alias ll='ls -lha'
alias l='ls -CF'
# Plugins
source $ZDOTDIR/zsh-autosuggestions/zsh-autosuggestions.zsh
source $ZDOTDIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment