dotfiles/.zshrc

108 lines
3.5 KiB
Bash
Raw Normal View History

2022-01-08 16:45:34 +00:00
stty -ixon # Disable ctrl-s and ctrl-q.
2022-09-06 16:55:22 +00:00
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
mkdir -p "$(dirname $ZINIT_HOME)"
[ -f "$ZINIT_HOME/zinit.zsh" ] || git clone --depth 1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"
2022-09-07 01:09:41 +00:00
# fixes conflict with zsh-autosuggestions
# Do the initialization when the script is sourced (i.e. Initialize instantly)
ZVM_INIT_MODE=sourcing
2022-09-07 01:13:10 +00:00
# avoid showing a syntax highlighting mess
ZVM_VI_INS_LEGACY_UNDO=1
2022-09-07 01:09:41 +00:00
2021-12-07 16:53:57 +00:00
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
2022-03-28 16:17:32 +00:00
zstyle :omz:plugins:ssh-agent lazy yes
zstyle :omz:plugins:ssh-agent quiet yes
# load modules
2021-12-07 16:53:57 +00:00
zinit light zsh-users/zsh-completions
zinit ice has'fzf'; zinit light Aloxaf/fzf-tab
2021-12-07 16:53:57 +00:00
zinit light zsh-users/zsh-autosuggestions
2022-09-07 01:09:41 +00:00
zinit light z-shell/F-Sy-H
2022-09-13 16:19:43 +00:00
[ -z "$NVIM" ] && (zinit ice wait ""; zinit light jeffreytse/zsh-vi-mode)
2021-12-07 16:53:57 +00:00
2022-02-11 10:46:16 +00:00
zinit ice has'ssh-agent' wait silent; zinit snippet OMZP::ssh-agent
2022-02-06 15:48:46 +00:00
2022-10-20 15:51:20 +00:00
zinit as"program" has'go' atclone'make && ./direnv hook zsh > zhook.zsh' \
2022-02-06 15:28:12 +00:00
atpull'%atclone' pick"direnv" src"zhook.zsh" for \
direnv/direnv
2020-04-21 02:28:26 +00:00
2021-12-07 16:53:57 +00:00
zinit ice wait"1" lucid
zinit light chisui/zsh-nix-shell
2022-02-06 17:12:25 +00:00
zinit ice has'fzf' wait lucid; zinit snippet https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.zsh
zinit ice has'fzf' wait lucid; zinit snippet https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh
2021-12-09 20:23:54 +00:00
zinit ice wait"1" lucid
zinit snippet https://raw.githubusercontent.com/hkbakke/bash-insulter/master/src/bash.command-not-found
2021-12-07 16:53:57 +00:00
2022-09-13 16:34:01 +00:00
if command -v starship 2>&1 > /dev/null; then
source <(starship init zsh --print-full-init)
2022-09-13 17:07:00 +00:00
else
autoload -Uz promptinit
promptinit; prompt gentoo
2022-09-13 16:34:01 +00:00
fi
2022-02-06 16:59:45 +00:00
# completion settings
2018-02-01 22:34:24 +00:00
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**'
zstyle ':completion:*' max-errors 2
zstyle ':completion:*' menu select=1
2019-06-26 21:59:48 +00:00
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle :compinstall filename "${HOME}/.zshrc" zstyle ':completion:*' rehash true
2022-02-06 16:39:29 +00:00
zstyle ':completion::complete:*' use-cache 1
2018-02-01 22:34:24 +00:00
2022-02-06 16:59:45 +00:00
# root commands completion for sudo/doas
2018-05-19 17:39:06 +00:00
[[ $UID -eq 0 ]] || () {
local i
local -T SUDO_PATH sudo_path
local -U sudo_path
sudo_path=($path {,/usr{,/local}}/sbin(N-/))
2019-06-26 22:10:41 +00:00
for i in sudo{,x} su{,x} doas{,x}
2018-05-19 17:39:06 +00:00
do zstyle ":completion:*:$i:*" environ PATH="$SUDO_PATH"
done
}
2022-02-06 16:59:45 +00:00
# history file settings
2019-08-25 09:49:08 +00:00
export HISTFILE=~/.histfile
2022-01-17 17:11:09 +00:00
export HISTSIZE=100000
export SAVEHIST=100000
2022-09-23 14:49:32 +00:00
setopt appendhistory notify histexpiredupsfirst histsavenodups \
incappendhistorytime histnostore histignorespace share_history
2022-02-06 16:59:45 +00:00
2018-02-01 22:34:24 +00:00
unsetopt beep
2022-02-06 16:04:06 +00:00
export FZF_DEFAULT_OPTS="-m"
2022-09-06 17:15:45 +00:00
2022-02-06 16:04:06 +00:00
command -v fd > /dev/null && export FZF_DEFAULT_COMMAND="fd"
2021-02-28 15:55:31 +00:00
alias venv="source ~/.venvs/venv/bin/activate"
2021-12-08 18:46:06 +00:00
alias ytdl="yt-dlp"
2021-04-08 01:22:34 +00:00
alias ag="ag --nogroup"
2020-01-30 20:05:57 +00:00
alias s="vi ~/.local/bin/\$(stest -lx ~/.local/bin | fzf --tac -e)"
alias ffmpeg="ffmpeg -hide_banner"
2020-04-04 00:50:38 +00:00
alias ffprobe="ffprobe -hide_banner"
2022-06-14 13:39:16 +00:00
alias fd="fd --hidden"
2022-09-21 07:41:08 +00:00
alias ls="ls --color=auto"
2022-11-30 13:04:08 +00:00
alias dns="dig +short"
2022-12-01 20:37:50 +00:00
alias mpvp="mpv_playlists"
2022-09-13 17:21:27 +00:00
export NEOVIDE_MULTIGRID=1
2022-09-13 16:08:33 +00:00
alias neovide="neovide --nofork"
2022-11-07 13:57:51 +00:00
export PIPX_DEFAULT_PYTHON=/usr/bin/python3.11
2022-10-13 23:20:26 +00:00
export GPG_TTY=$(tty)
[ -n "$SSH_CONNECTION" ] && export PINENTRY_USER_DATA="USE_CURSES=1"
2022-10-13 23:20:26 +00:00
[ -f ~/.zshrc.local ] && . ~/.zshrc.local
2021-12-07 16:53:57 +00:00
fpath+=~/.zfunc
2021-12-07 16:53:57 +00:00
autoload -Uz compinit && compinit
autoload -U +X bashcompinit && bashcompinit && complete -o bashdefault -o default -o nospace -C qpdf qpdf
zinit cdreplay -q