73 lines
1.7 KiB
Bash
73 lines
1.7 KiB
Bash
#!/bin/zsh
|
|
|
|
#
|
|
# .void.zshrc
|
|
#
|
|
|
|
# If not running interactively, don't do anything
|
|
[[ $- != *i* ]] && return
|
|
|
|
# Initialize zinit
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
|
|
|
[ ! -d "$ZINIT_HOME" ] && {
|
|
mkdir -p "$(dirname $ZINIT_HOME)"
|
|
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
|
}
|
|
|
|
source "${ZINIT_HOME}/zinit.zsh"
|
|
|
|
# Load plugins
|
|
autoload -U compinit && compinit
|
|
|
|
zinit light zsh-users/zsh-syntax-highlighting
|
|
zinit light zsh-users/zsh-completions
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
zinit light Aloxaf/fzf-tab
|
|
|
|
# Keybindings
|
|
bindkey -e
|
|
bindkey '^p' history-search-backward
|
|
bindkey '^n' history-search-forward
|
|
bindkey '^[[1;3D' backward-word # ALT LeftArrowKey
|
|
bindkey '^[[1;3C' forward-word # ALT RightArrowKey
|
|
bindkey '^[[1;5D' backward-word # CTRL LeftArrowKey
|
|
bindkey '^[[1;5C' forward-word # CTRL RightArrowKey
|
|
bindkey '^[[3~' delete-char # DEL
|
|
|
|
# Command history
|
|
HISTSIZE=10000
|
|
SAVEHIST=$HISTSIZE
|
|
HISTFILE=~/.zsh_history
|
|
HISTDUP=erase
|
|
setopt appendhistory
|
|
setopt sharehistory
|
|
setopt hist_ignore_space
|
|
setopt hist_ignore_all_dups
|
|
setopt hist_save_no_dups
|
|
setopt hist_ignore_dups
|
|
setopt hist_find_no_dups
|
|
|
|
# FZF
|
|
export FZF_DEFAULT_OPTS='--height 40%'
|
|
|
|
# Completions
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
|
zstyle ':completion:*' menu no
|
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza --tree --level=2 --color=always $realpath'
|
|
# Aliases
|
|
|
|
# Shell integrations
|
|
eval "$(fzf --zsh)"
|
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
command -v direnv &>/dev/null && eval "$(direnv hook zsh)"
|
|
command -v direnv &>/dev/null && eval "$(zoxide init --cmd cd zsh)"
|
|
|
|
# Prompt
|
|
command -v direnv &>/dev/null && eval "$(starship init zsh)"
|
|
|
|
# Alias
|
|
|
|
[[ -r ~/.zalias ]] && source ~/.zalias
|
|
|