diff options
author | ZachIR <zachir@librem.one> | 2025-01-18 23:39:25 -0600 |
---|---|---|
committer | ZachIR <zachir@librem.one> | 2025-01-18 23:45:39 -0600 |
commit | 44fbfc95f779e5d6bbdaaf250ada4dfcdae5cb2a (patch) | |
tree | e2fb9b34f28d7833213f90efcae7f81e5ccb2cf2 /zsh/zshrc | |
parent | 2b9df77bbc5fa85f94b15b043c659168a606d1db (diff) |
Cleanup zsh configs + add zplug
Just a couple plugins for syntax highlighting and history searching,
removing a bunch of old unused files, and changing to just accept the
standard of using dotfiles in the home directory.
Diffstat (limited to 'zsh/zshrc')
-rw-r--r-- | zsh/zshrc | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..fb5b167 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,72 @@ +#zmodload zsh/zprof +if [ -d "$HOME/.zplug" ]; then + export ZPLUG_INSTALLED="y" + source "$HOME/.zplug/init.zsh" +fi +HISTFILE="$XDG_CONFIG_HOME/zsh/hist" +SAVEHIST=1000 +HISTSIZE=1000 +setopt APPEND_HISTORY +setopt HIST_FIND_NO_DUPS +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_VERIFY +setopt HIST_IGNORE_DUPS +setopt INC_APPEND_HISTORY +setopt HIST_REDUCE_BLANKS +setopt COMPLETE_ALIASES +setopt AUTO_CD + +_SH="zsh" + +if [ -f "$XDG_CONFIG_HOME"/sh/aliases ]; then + source "$XDG_CONFIG_HOME"/sh/aliases +fi +if [ -f "$XDG_CONFIG_HOME"/sh/functions ]; then + source "$XDG_CONFIG_HOME"/sh/functions +fi + +if [ -f "$XDG_CONFIG_HOME/zsh/zshrc" ]; then + alias e='source "$XDG_CONFIG_HOME/zsh/zshrc"' +elif [ -f "$XDG_CONFIG_HOME/zshrc" ]; then + alias e='source "$XDG_CONFIG_HOME/zshrc"' +elif [ -f "$HOME"/.zshrc ]; then + alias e='source ~/.zshrc' +fi + +bindkey -v + +MYPROMPT=$'%B%S%F{002}[%n@%m]%s\UE0B0%F{015}%~%S%F{002}\UE0B0%#%s\UE0B0%f%k%b ' +function zle-line-init zle-keymap-select { + VIM_PROMPT=$'%B%S%F{012}[%n@%m]%s\UE0B0%F{015}%~%S%F{012}\UE0B0%#%s\UE0B0%f%k%b ' + PS1="${${KEYMAP/vicmd/$VIM_PROMPT}/main/$MYPROMPT}" + zle reset-prompt +} + +zle -N zle-line-init +zle -N zle-keymap-select +export KEYTIMEOUT=1 + +fpath+="$XDG_CONFIG_HOME/zsh/zfunc" + +if [ -n "$ZPLUG_INSTALLED" ]; then + # zsh history substring search + zplug "zsh-users/zsh-history-substring-search", as:plugin + + bindkey '^[[A' history-substring-search-up + bindkey '^[[B' history-substring-search-down + bindkey -M vicmd '^[[A' history-substring-search-up + bindkey -M vicmd '^[[B' history-substring-search-down + bindkey -M vicmd 'k' history-substring-search-up + bindkey -M vicmd 'j' history-substring-search-down + + # zsh syntax highlighting + zplug "zsh-users/zsh-syntax-highlighting", defer:2 + + # load zsh plugins + zplug load +fi + +autoload -Uz compinit +compinit + +#zprof |