dotfiles/.zshrc

117 lines
3.4 KiB
Bash
Raw Normal View History

2022-01-08 16:45:34 +00:00
stty -ixon # Disable ctrl-s and ctrl-q.
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
2021-12-07 16:53:57 +00:00
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# ssh-agent
start_ssh_agent() {
ssh-agent | grep -v \^echo > "$SSH_ENV"
chmod 1600 "$SSH_ENV"
}
SSH_ENV="/tmp/.ssh_env.$USER"
if [ -f "$SSH_ENV" ]; then
. "$SSH_ENV"
ps q $SSH_AGENT_PID > /dev/null || start_ssh_agent
else
start_ssh_agent
fi
. "$SSH_ENV"
# load modules
2019-01-11 20:10:03 +00:00
bgnotify_threshold=0
2019-01-11 19:59:58 +00:00
2021-12-07 16:53:57 +00:00
zinit light zsh-users/zsh-completions
2021-12-22 01:40:33 +00:00
zinit light Aloxaf/fzf-tab
2021-12-07 16:53:57 +00:00
zinit light zsh-users/zsh-autosuggestions
2022-01-08 16:27:40 +00:00
zinit light jeffreytse/zsh-vi-mode
2021-12-07 16:53:57 +00:00
2022-01-08 16:45:34 +00:00
zinit ice depth=1; zinit light romkatv/powerlevel10k
2021-12-07 16:53:57 +00:00
zinit ice wait lucid
zinit light zdharma-continuum/fast-syntax-highlighting
zinit ice wait"1" lucid
zinit light Tarrasch/zsh-autoenv
2020-04-21 02:28:26 +00:00
2021-12-07 16:53:57 +00:00
zinit ice wait"5" lucid
zinit light t413/zsh-background-notify.git
zinit ice wait"1" lucid
zinit light chisui/zsh-nix-shell
zinit snippet https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.zsh
2021-12-07 16:53:57 +00:00
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
2019-05-26 15:03:46 +00:00
# vi key bindings
set -o vi
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
2018-02-01 22:34:24 +00:00
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
}
zstyle ':completion::complete:*' use-cache 1
2019-08-25 09:49:08 +00:00
export HISTFILE=~/.histfile
export HISTSIZE=10000
export SAVEHIST=10000
setopt appendhistory autocd notify histexpiredupsfirst histsavenodups incappendhistorytime histnostore histignorespace
2018-02-01 22:34:24 +00:00
unsetopt beep
bindkey -e
export NIX_BUILD_SHELL=zsh
2020-06-19 12:06:47 +00:00
2019-08-14 15:51:50 +00:00
# vi mode
bindkey -v
export KEYTIMEOUT=1
2019-06-26 21:59:48 +00:00
export FZF_DEFAULT_OPTS="-m --no-mouse"
2021-04-08 01:09:09 +00:00
export FZF_DEFAULT_COMMAND="fd"
2018-02-02 16:12:44 +00:00
alias dots="git --git-dir=$HOME/.dots --work-tree=$HOME"
2019-06-26 21:59:48 +00:00
alias dotmodules="dots submodule update --recursive --remote"
2021-02-28 15:55:31 +00:00
alias venv="source ~/.venvs/venv/bin/activate"
2018-09-10 10:25:43 +00:00
alias top="htop"
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"
2019-08-21 19:16:53 +00:00
[ -f ~/.local_env ] && . ~/.local_env
[ -f ~/.zshrc.local ] && . ~/.zshrc.local
2019-06-23 16:49:02 +00:00
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
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
2022-01-08 16:45:34 +00:00
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[ -f ~/.p10k.zsh ] && source ~/.p10k.zsh