98 lines
3.0 KiB
Bash
98 lines
3.0 KiB
Bash
### Added by Zinit's installer
|
|
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
|
|
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
|
|
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
|
|
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
|
|
print -P "%F{33} %F{34}Installation successful.%f%b" || \
|
|
print -P "%F{160} The clone has failed.%f%b"
|
|
fi
|
|
|
|
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
|
|
autoload -Uz _zinit
|
|
(( ${+_comps} )) && _comps[zinit]=_zinit
|
|
|
|
# Load a few important annexes, without Turbo
|
|
# (this is currently required for annexes)
|
|
zinit light-mode for \
|
|
zdharma-continuum/zinit-annex-as-monitor \
|
|
zdharma-continuum/zinit-annex-bin-gem-node \
|
|
zdharma-continuum/zinit-annex-patch-dl \
|
|
zdharma-continuum/zinit-annex-rust
|
|
|
|
### End of Zinit's installer chunk
|
|
|
|
zinit light zsh-users/zsh-completions
|
|
zinit light zsh-users/zsh-syntax-highlighting
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
zinit light zsh-users/zsh-history-substring-search
|
|
zinit light Aloxaf/fzf-tab
|
|
zinit light hlissner/zsh-autopair
|
|
|
|
zinit snippet OMZL::git.zsh
|
|
zinit snippet OMZP::git
|
|
zinit snippet OMZP::sudo
|
|
zinit snippet OMZP::archlinux
|
|
zinit snippet OMZP::command-not-found
|
|
|
|
autoload -Uz compinit && compinit
|
|
|
|
zinit cdreplay -q
|
|
|
|
# History
|
|
HISTSIZE=5000
|
|
HISTFILE=~/.zsh_history
|
|
SAVEHIST=$HISTSIZE
|
|
HISTDUP=erase
|
|
setopt APPEND_HISTORY
|
|
setopt SHARE_HISTORY
|
|
setopt HIST_IGNORE_SPACE
|
|
setopt HIST_SAVE_NO_DUPS
|
|
setopt HIST_FIND_NO_DUPS
|
|
setopt HIST_IGNORE_DUPS
|
|
setopt HIST_IGNORE_ALL_DUPS
|
|
|
|
alias cd='z'
|
|
alias c='clear'
|
|
alias ls='eza --color=always'
|
|
alias la='eza -laghm@ --all --icons --git --color=always'
|
|
|
|
export WORDCHARS="${WORDCHARS//-}"
|
|
export WORDCHARS="${WORDCHARS//\/}"
|
|
|
|
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
|
|
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
|
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
_fzf_compgen_path() {
|
|
fd --hidden --exclude .git . "$1"
|
|
}
|
|
|
|
show_file_or_dir_preview="if [ -d {} ]; then eza --tree --color=always {} | head -200; else bat -n --color=always --line-range :500 {}; fi"
|
|
|
|
export FZF_CTRL_T_OPTS="--preview '$show_file_or_dir_preview'"
|
|
export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'"
|
|
|
|
_fzf_comprun() {
|
|
local command=$1
|
|
shift
|
|
|
|
case "$command" in
|
|
cd) fzf --preview 'eza --tree --color=always {} | head -200' "$@" ;;
|
|
export|unset) fzf --preview "eval 'echo \${}'" "$@" ;;
|
|
ssh) fzf --preview 'dig {}' "$@" ;;
|
|
*) fzf --preview "$show_file_or_dir_preview" "$@" ;;
|
|
esac
|
|
}
|
|
|
|
bindkey "^[[A" history-substring-search-up # Up
|
|
bindkey "^[[B" history-substring-search-down # Down
|
|
bindkey "^[[1;5C" forward-word
|
|
bindkey "^[[1;5D" backward-word
|
|
bindkey '^H' backward-kill-word
|
|
|
|
eval "$(zoxide init zsh)"
|
|
eval "$(starship init zsh)"
|
|
eval "$(fzf --zsh)"
|