1
Fork 0
dots/zsh/dot-zshrc

114 lines
3.2 KiB
Text
Raw Normal View History

2023-08-21 09:56:16 +00:00
function create_dir() [ ! -d "$1" ] && mkdir -p "$1"
function safe_source() [ -f "$1" ] && source "$1"
2023-08-30 02:00:57 +00:00
function zsh_add_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
[ ! -d "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME" ] &&
git clone "https://github.com/$1.git" "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME"
safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
}
2023-08-21 09:56:16 +00:00
2024-11-12 23:34:44 +00:00
if (( $+commands[starship] )); then
source <(starship init zsh)
else
[ ! -d "$HOME/.local/share/zsh/plugins/pure" ] &&
git clone "https://github.com/sindresorhus/pure" "$HOME/.local/share/zsh/plugins/pure"
fpath+="$HOME/.local/share/zsh/plugins/pure"
safe_source "$HOME/.local/share/zsh/plugins/pure/pure.zsh"
fi
zsh_add_plugin "mattmc3/ez-compinit"
zstyle ":completion:*" list-colors ${(s.:.)LS_COLORS}
zstyle ":completion:*" matcher-list "m:{a-z}={A-Za-z}"
zstyle ":completion:*" menu no
zstyle ":completion:*:descriptions" format "[%d]"
zstyle ":completion:*:git-checkout:*" sort false
zstyle ":fzf-tab:complete:cd:*" fzf-preview "eza -1 --color=always $realpath"
create_dir "$HOME/.local/state/zsh"
HISTFILE="$HOME/.local/state/zsh/history"
HISTSIZE=65536
SAVEHIST=$HISTSIZE
setopt AUTO_CD
setopt HIST_IGNORE_DUPS
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt MULTIOS
setopt NO_BEEP
setopt RM_STAR_SILENT
stty stop undef
zle_highlight=("paste:none")
2023-08-21 09:56:16 +00:00
zsh_add_plugin "Aloxaf/fzf-tab"
zsh_add_plugin "zdharma-continuum/fast-syntax-highlighting"
zsh_add_plugin "zsh-users/zsh-autosuggestions"
zsh_add_plugin "zsh-users/zsh-completions"
2024-11-12 23:34:44 +00:00
ZVM_INIT_MODE=sourcing
ZVM_VI_INSERT_ESCAPE_BINDKEY=jk
zsh_add_plugin "jeffreytse/zsh-vi-mode"
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
export VISUAL="nvim"
export EDITOR="nvim"
if (( $+commands[pyenv] )); then
source <(pyenv init -)
fi
if (( $+commands[fzf] )); then
source <(fzf --zsh)
fi
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^V" edit-command-line
bindkey "^Y" autosuggest-execute
bindkey "^F" fzf-cd-widget
###############################################################################
# FUNCTIONS #
###############################################################################
function cc() python -c "from math import *; print($*)"
alias cc="noglob cc"
###############################################################################
# ALIASES #
###############################################################################
if [[ -f /etc/os-release ]]; then
source /etc/os-release
if [[ "$ID_LIKE" == *"arch"* ]]; then
alias p="sudo pacman -S"
alias pu="sudo pacman -Syu"
elif [[ "$ID" == "debian" || "$ID_LIKE" == *"debian"* ]]; then
alias p="sudo apt install"
alias pu="sudo apt update && sudo apt upgrade"
fi
fi
alias vi="nvim"
alias l="eza -x --group-directories-first --icons"
alias la="l -a"
alias ll="l -lbh --git --no-time"
alias lla="ll -a"
alias lt="ll --tree"
alias lta="lt -a --ignore-glob=".git""
alias s="kitty +kitten ssh"
2023-08-21 09:56:16 +00:00
# vim: filetype=zsh