2023-11-23 12:18:23 +08:00
|
|
|
|
# Install zinit if no zinit is present
|
2022-06-25 21:26:38 +08:00
|
|
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
|
|
|
|
if [[ ! -f $ZINIT_HOME/zinit.zsh ]]; then
|
2023-11-23 12:18:23 +08:00
|
|
|
|
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
|
|
|
|
|
mkdir -p "$(dirname $ZINIT_HOME)"
|
|
|
|
|
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
|
|
|
|
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
|
|
|
|
|
print -P "%F{160}▓▒░ The clone has failed.%f%b"
|
2022-06-25 21:26:38 +08:00
|
|
|
|
fi
|
|
|
|
|
source "$ZINIT_HOME/zinit.zsh"
|
|
|
|
|
|
2023-11-23 12:18:23 +08:00
|
|
|
|
# Zinit packages
|
|
|
|
|
|
2023-12-03 13:36:10 +08:00
|
|
|
|
zinit ice compile'(pure|async).zsh' pick'async.zsh' src'pure.zsh'
|
|
|
|
|
zinit light sindresorhus/pure
|
|
|
|
|
|
2023-11-23 12:18:23 +08:00
|
|
|
|
zinit wait lucid for \
|
|
|
|
|
zdharma-continuum/fast-syntax-highlighting \
|
|
|
|
|
agkozak/zsh-z \
|
2023-12-07 11:31:31 +08:00
|
|
|
|
zpm-zsh/colors \
|
2023-11-23 12:18:23 +08:00
|
|
|
|
zpm-zsh/colorize \
|
2024-03-06 19:58:57 +08:00
|
|
|
|
rywng/shortify.zsh
|
2023-11-23 12:18:23 +08:00
|
|
|
|
|
2024-03-06 21:30:43 +08:00
|
|
|
|
zinit ice wait lucid atinit"bindkey '^ ' autosuggest-execute" atload'_zsh_autosuggest_start'
|
2022-06-25 21:26:38 +08:00
|
|
|
|
zinit light zsh-users/zsh-autosuggestions
|
2023-12-09 19:36:58 +08:00
|
|
|
|
|
2023-07-17 21:04:25 +08:00
|
|
|
|
zinit light zsh-users/zsh-completions
|
2022-06-25 21:26:38 +08:00
|
|
|
|
|
2023-12-07 11:31:31 +08:00
|
|
|
|
# Software
|
2024-01-10 11:38:39 +08:00
|
|
|
|
if ! command -v bat &> /dev/null ; then
|
2024-03-21 10:36:33 +08:00
|
|
|
|
zinit ice as"command" from"gh-r" mv"bat* -> bat" pick"bat/bat"
|
|
|
|
|
zinit light sharkdp/bat
|
2024-01-10 11:38:39 +08:00
|
|
|
|
fi
|
2023-12-07 11:31:31 +08:00
|
|
|
|
|
2024-03-21 10:36:33 +08:00
|
|
|
|
zinit from"gh-r" as"program" mv"direnv* -> direnv" \
|
|
|
|
|
atclone'./direnv hook zsh > zhook.zsh' atpull'%atclone' \
|
|
|
|
|
pick"direnv" src="zhook.zsh" for \
|
|
|
|
|
direnv/direnv
|
2023-12-07 11:31:31 +08:00
|
|
|
|
|
2022-06-25 21:26:38 +08:00
|
|
|
|
autoload -Uz _zinit
|
|
|
|
|
(( ${+_comps} )) && _comps[zinit]=_zinit
|
|
|
|
|
|
2023-12-09 19:36:58 +08:00
|
|
|
|
test -n "$LS_COLORS" || eval $(dircolors) || echo 'Warning: Unable to set LS_COLORS'
|
2024-03-06 21:30:43 +08:00
|
|
|
|
|
2022-06-25 21:26:38 +08:00
|
|
|
|
# The following lines were added by compinstall
|
|
|
|
|
|
|
|
|
|
zstyle ':completion:*' auto-description '%F{green}Specify%f: %F{cyan}%d%f'
|
|
|
|
|
zstyle ':completion:*' completer _oldlist _expand _complete _ignored _match _correct _approximate _prefix
|
|
|
|
|
zstyle ':completion:*' completions 1
|
|
|
|
|
zstyle ':completion:*' expand prefix suffix
|
2022-09-20 13:03:40 +08:00
|
|
|
|
zstyle ':completion:*' file-sort name
|
2022-06-25 21:26:38 +08:00
|
|
|
|
zstyle ':completion:*' format '%F{green}Completing%f %F{yellow}%d%f'
|
|
|
|
|
zstyle ':completion:*' glob 1
|
|
|
|
|
zstyle ':completion:*' group-name ''
|
2024-03-06 21:30:43 +08:00
|
|
|
|
zstyle ':completion:*' ignore-parents parent pwd .. directory
|
2022-06-25 21:26:38 +08:00
|
|
|
|
zstyle ':completion:*' insert-unambiguous true
|
|
|
|
|
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
2024-03-06 21:30:43 +08:00
|
|
|
|
zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*'
|
|
|
|
|
zstyle ':completion:*' max-errors 2
|
2022-06-25 21:26:38 +08:00
|
|
|
|
zstyle ':completion:*' menu select=1
|
|
|
|
|
zstyle ':completion:*' original false
|
|
|
|
|
zstyle ':completion:*' preserve-prefix '//[^/]##/'
|
|
|
|
|
zstyle ':completion:*' prompt '%F{green}Completing%f, with %F{red}%e%f errors'
|
2024-03-06 21:30:43 +08:00
|
|
|
|
zstyle ':completion:*' select-prompt '%S%F{green}Scrolling%f active: current selection at %F{blue}%p%f%s'
|
|
|
|
|
zstyle ':completion:*' substitute 0
|
|
|
|
|
zstyle ':completion:*' verbose true
|
|
|
|
|
zstyle :compinstall filename '/home/ryan/.zshrc'
|
2022-06-25 21:26:38 +08:00
|
|
|
|
|
|
|
|
|
autoload -Uz compinit
|
|
|
|
|
compinit
|
|
|
|
|
# End of lines added by compinstall
|
|
|
|
|
# Lines configured by zsh-newuser-install
|
|
|
|
|
HISTFILE=~/.cache/zhistory
|
2024-05-29 13:34:13 +08:00
|
|
|
|
HISTSIZE=16384
|
|
|
|
|
SAVEHIST=16384
|
|
|
|
|
setopt autocd autopushd extendedglob nomatch inc_append_history hist_ignore_dups
|
2024-03-06 21:30:43 +08:00
|
|
|
|
unsetopt beep notify
|
2023-12-09 19:36:58 +08:00
|
|
|
|
bindkey -e
|
2022-06-25 21:26:38 +08:00
|
|
|
|
# End of lines configured by zsh-newuser-install
|
|
|
|
|
|
2023-12-03 13:36:10 +08:00
|
|
|
|
# Pure prompt
|
|
|
|
|
zstyle ':prompt:pure:git:stash' show yes
|
|
|
|
|
zstyle ':prompt:pure:prompt:success' color default
|
|
|
|
|
|
2022-06-25 21:26:38 +08:00
|
|
|
|
#edit in vim
|
2023-12-28 22:02:02 +08:00
|
|
|
|
autoload -Uz edit-command-line
|
2022-06-25 21:26:38 +08:00
|
|
|
|
zle -N edit-command-line
|
2023-12-09 19:36:58 +08:00
|
|
|
|
bindkey '' edit-command-line
|
2022-06-25 21:26:38 +08:00
|
|
|
|
|
2023-12-28 22:02:02 +08:00
|
|
|
|
# better CTRL-w
|
|
|
|
|
autoload -Uz select-word-style
|
|
|
|
|
select-word-style bash
|
|
|
|
|
|
2022-06-25 21:26:38 +08:00
|
|
|
|
bindkey ' ' magic-space
|
|
|
|
|
|
2024-01-13 11:38:48 +08:00
|
|
|
|
# config & cache location
|
|
|
|
|
export GOPATH=$HOME/.cache/go
|
2022-06-25 21:26:38 +08:00
|
|
|
|
export LESSHISTFILE=/dev/null
|
|
|
|
|
export LYNX_CFG=$HOME/.config/lynx/lynxrc
|
|
|
|
|
export XDG_CACHE_HOME=$HOME/.cache
|
|
|
|
|
export XDG_CONFIG_HOME=$HOME/.config
|
2024-06-11 11:20:05 +08:00
|
|
|
|
export XDG_DATA_HOME=$HOME/.local/share
|
2024-01-13 11:38:48 +08:00
|
|
|
|
export ZSHZ_DATA=$HOME/.cache/z
|
2022-06-25 21:26:38 +08:00
|
|
|
|
|
2024-01-13 11:38:48 +08:00
|
|
|
|
# settings for software
|
|
|
|
|
export BAT_THEME="base16"
|
2022-06-25 21:26:38 +08:00
|
|
|
|
export FZF_DEFAULT_OPTS="--reverse --cycle --height=40% --border sharp --prompt=🔎"
|
|
|
|
|
export GPG_TTY=$(tty) # fixes gpg
|
2024-03-06 21:30:43 +08:00
|
|
|
|
export LESS="-i $LESS"
|
2023-12-12 10:32:40 +08:00
|
|
|
|
export MANROFFOPT="-c"
|
2024-01-13 11:38:48 +08:00
|
|
|
|
export MANWIDTH=${MANWIDTH:-78}
|
|
|
|
|
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket
|
2023-12-12 10:32:40 +08:00
|
|
|
|
|
2024-01-13 11:38:48 +08:00
|
|
|
|
# local path
|
2022-06-25 21:26:38 +08:00
|
|
|
|
export MANPATH="${MANPATH}:${HOME}/.local/share/man"
|
2024-07-20 11:36:08 +08:00
|
|
|
|
export PATH="${PATH}:${HOME}/.local/bin:${HOME}/.scripts:${HOME}/.cache/go/bin:${HOME}/.cache/cargo/bin:${HOME}/.local/share/nvim/mason/bin"
|
2024-05-20 13:04:29 +08:00
|
|
|
|
export PATH="/usr/lib/ccache/bin${PATH:+:}$PATH" # ccache support
|