diff --git a/zsh/.zshrc b/zsh/.zshrc index 5314051..0a50edc 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -15,60 +15,112 @@ export SUDO_EDITOR=nvim export GOPATH="$HOME/.local/go" -export HISTSIZE=10000 -export SAVEHIST=10000 -export HISTFILE="$HOME/.cache/zsh/history" - -setopt append_history -setopt inc_append_history -setopt share_history -setopt interactive_comments -setopt autocd -setopt auto_param_slash -setopt dot_glob -setopt extended_glob - export PATH="$HOME/.local/bin:$HOME/.local/go/bin:$HOME/opt/bin:$HOME/.cargo/bin:$PATH" export LD_LIBRARY_PATH="$HOME/opt/lib:${LD_LIBRARY_PATH:-}" -alias ls='ls --color=auto' -alias ll='ls -lah' -alias gg='lazygit' -alias v='nvim' -alias rr='russ read' -alias cp='cp -v' -alias sd='st -d "$(pwd)" > /dev/null 2>&1 & disown' +ZAP_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zap" +[ -f "$ZAP_DIR/zap.zsh" ] && source "$ZAP_DIR/zap.zsh" -take() { - mkdir -p -- "$1" && cd -- "$1" -} - -bindkey -e - -autoload -Uz compinit colors -autoload -U bashcompinit - -colors -compinit -bashcompinit - -PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " - -if [ -f "$HOME/.zprofile" ]; then - source "$HOME/.zprofile" -fi +[ -f "$HOME/.zprofile" ] && source "$HOME/.zprofile" if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" fi -ZAP_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zap" +HISTFILE="${ZDOTDIR:-$HOME}/.zsh_history" +HISTSIZE=50000 +SAVEHIST=50000 -if [ -f "$ZAP_DIR/zap.zsh" ]; then - source "$ZAP_DIR/zap.zsh" +setopt APPEND_HISTORY +setopt INC_APPEND_HISTORY +setopt SHARE_HISTORY + +setopt EXTENDED_HISTORY +setopt BANG_HIST +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_FIND_NO_DUPS +setopt HIST_IGNORE_SPACE +setopt HIST_SAVE_NO_DUPS +setopt HIST_REDUCE_BLANKS +setopt HIST_VERIFY + +setopt AUTO_CD +setopt AUTO_PARAM_SLASH +setopt GLOB_DOTS +setopt EXTENDED_GLOB +setopt INTERACTIVE_COMMENTS +setopt MENU_COMPLETE +setopt NOMATCH +unsetopt BEEP + +autoload -Uz compinit colors bashcompinit +zmodload zsh/complist + +zstyle ':completion:*' menu yes select +zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=*' +_comp_options+=(globdots) +zle_highlight=('paste:none') + +if [[ -f "${ZDOTDIR:-$HOME}/.zcompdump" ]]; then + compinit -C +else + compinit fi +bashcompinit + +autoload -Uz colors && colors +PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " + +bindkey -e +bindkey -s '^x' '^usource $ZSHRC\n' +bindkey -M menuselect '?' history-incremental-search-forward +bindkey -M menuselect '/' history-incremental-search-backward +bindkey '^H' backward-kill-word + +autoload -U up-line-or-beginning-search +autoload -U down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search + +alias cat='bat' +alias gg='lazygit' +alias v='nvim' +alias cp='cp -v' + +take() { + mkdir -p -- "$1" && cd -- "$1" +} + +if (( $+commands[eza] )); then + alias ls='eza --group-directories-first --icons=auto' + if eza --version | grep -q '+git'; then + alias ll='ls -lh --git' + else + alias ll='ls -lh' + fi + alias la='ll -a' + alias tree='ll --tree --level=2' +else + alias ls='ls --group-directories-first' + alias ll='ls -lh' + alias la='ll -a' +fi + +if ! command -v zap >/dev/null 2>&1; then + printf 'Installing zap (release-v1)...\n' + zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) --keep --branch release-v1 + if [ -f "${ZDOTDIR:-$HOME}/.zshrc" ]; then + source "${ZDOTDIR:-$HOME}/.zshrc" + fi +fi + +autoload -Uz plug plug "zsh-users/zsh-autosuggestions" plug "zsh-users/zsh-syntax-highlighting" -plug "zap-zsh/sudo" plug "Aloxaf/fzf-tab" + +: "${XDG_DATA_HOME:=$HOME/.local/share}" +: "${XDG_CONFIG_HOME:=$HOME/.config}"