dotfiles/.zshrc

94 lines
2.7 KiB
Bash
Raw Normal View History

2020-02-18 10:26:51 +00:00
stty -ixon # Disable ctrl-s and ctrl-q.
# 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-10-08 13:06:52 +00:00
for i in ~/.zsh/*/*.plugin.zsh; do
2019-01-11 20:10:03 +00:00
source "$i"
done
2019-01-11 19:59:58 +00:00
2019-01-11 20:10:03 +00:00
source ~/.zsh/omz/oh-my-zsh/lib/spectrum.zsh
source ~/.zsh/omz/oh-my-zsh/plugins/history-substring-search/history-substring-search.zsh
2020-04-21 02:28:26 +00:00
source ~/.zsh/command-not-found
2020-07-24 20:51:30 +00:00
source ~/.vim/fzf/shell/completion.zsh
source ~/.vim/fzf/shell/key-bindings.zsh
2020-02-22 21:31:02 +00:00
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
2019-01-11 19:59:58 +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
}
2018-12-29 18:14:14 +00:00
autoload -Uz compinit && compinit
2021-04-05 20:48:40 +00:00
autoload -U +X bashcompinit && bashcompinit && complete -o bashdefault -o default -o nospace -C qpdf qpdf
2018-05-19 17:39:06 +00:00
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
2018-12-29 18:14:14 +00:00
# Prompt
autoload -U colors && colors
PROMPT="%B%{$FG[081]%}%n%{$reset_color%}%b%{$FG[245]%}@%{$reset_color%}%B%{$FG[206]%}%m%{$reset_color%}%b %{$fg[245]%}%B%c%b %(!.%{$FG[001]%}#.%{$FG[081]%}$)%{$reset_color%} "
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-04-05 21:30:23 +00:00
alias dotupdate="dots pull && vi --headless -c 'call ConfUpdate()'"
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"
2018-12-02 14:34:01 +00:00
alias ytdl="youtube-dl"
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