💾 Archived View for tilde.club › ~filip › tech › dotfiles › .zshrc captured on 2022-07-16 at 15:37:01.

View Raw

More Information

-=-=-=-=-=-=-

# .ZSHRC: SET THE ENVIRONMENT FOR INTERACTIVE SHELLS. LOAD AFTER ZPROFILE.

# TERM AND PROMPT
autoload -U colors && colors
PS1="%{$fg[blue]%}[%{$fg[cyan]%}%Th ~ %1~%{$fg[blue]%}]%{$reset_color%} "
[ -n "$TMUX" ] && export TERM="screen-256color" || export TERM="xterm-256color"
[ -r "$HOME/.config/nord.dircolors" ] && eval "$(dircolors "$HOME/.config/nord.dircolors")"

# CURSOR
echo -ne '\e[2 q'
preexec() { echo -ne '\e[2 q' ;}

# HISTORY
HISTSIZE=10000
SAVEHIST=10000
HISTFILE="$HOME/.cache/zsh/history"
setopt BANG_HIST              # treat the '!' character specially during expansion
setopt EXTENDED_HISTORY       # write the history file in the ":start:elapsed;command" format
setopt INC_APPEND_HISTORY     # write to the history file immediately, not when the shell exits
setopt SHARE_HISTORY          # share history between all sessions
setopt HIST_EXPIRE_DUPS_FIRST # expire duplicate entries first when trimming history
setopt HIST_IGNORE_DUPS       # don't record an entry that was just recorded again
setopt HIST_IGNORE_ALL_DUPS   # delete old recorded entry if new entry is a duplicate
setopt HIST_FIND_NO_DUPS      # do not display a line previously found
setopt HIST_IGNORE_SPACE      # don't record an entry starting with a space
setopt HIST_SAVE_NO_DUPS      # don't write duplicate entries in the history file
setopt HIST_REDUCE_BLANKS     # remove superfluous blanks before recording entry
setopt HIST_VERIFY            # don't execute immediately upon history expansion

# LOADS ALIASES
[ -f "$HOME/.config/.aliasrc" ] && source "$HOME/.config/.aliasrc"

# BASIC AUTO/TAB COMPLETION
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
comp_options+=(globdots) # includes hidden files.

# NAVIGATION
setopt autocd
mkc(){
	mkdir -p "$@" && cd "$@"
}

# VI MODE
bindkey -v
export KEYTIMEOUT=1
## VIM KEYS IN TAB COMPLETE MENU
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# EDIT COMMAND LINE IN VIM WITH Ctrl-e
autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line