-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathzshrc
90 lines (77 loc) · 2.31 KB
/
zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Load modules.
autoload -Uz colors && colors
autoload -Uz compinit && compinit
autoload -Uz vcs_info
autoload -Uz zmv
# Rehash zsh's completion on miss.
zstyle ':completion:*' rehash true
# Enable zsh history.
setopt append_history
setopt extended_glob
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt share_history
HISTFILE=~/.zsh_history
HISTSIZE=100000
REPORTTIME=1
SAVEHIST=1000000
# Set up the environment.
export EDITOR='vim'
export GOPATH=$HOME/.config/go
export NETHACKOPTIONS='autodig,boulder=0,color,decgraphics,hilite_pile,hilite_status:hitpoints/100%/brightgreen,hilite_status:hitpoints/<100%/green,hilite_status:hitpoints/<60%/yellow,hilite_status:hitpoints/<40%/red,hilite_status:power/100%/brightgreen,hilite_status:power/<100%/green,hilite_status:power/<60%/yellow,hilite_status:power/<40%/red,hitpointbar,lit_corridor,nopet,pickup_types=$,statushilites,time'
# Enable prompt variable use and configure the VCS prompt.
setopt prompt_subst
zstyle ':vcs_info:*' formats '%F{green}%b'
zstyle ':vcs_info:*' actionformats '%F{green}%b%F{blue}«%F{green}%a'
TIMEFMT="$fg[cyan]%J$reset_color user $fg[yellow]%*U$reset_color sys $fg[yellow]%*S $fg[blue]%*E"
precmd () {
vcs_info
}
preexec () {
echo -ne "\e[0m
"
}
# Set vim key mode and bindings.
bindkey -v
bindkey -M viins 'jk' vi-cmd-mode
bindkey '^a' beginning-of-line
bindkey '^e' end-of-line
bindkey '^r' history-incremental-search-backward
bindkey '^w' backward-kill-word
bindkey "^?" backward-delete-char
# Change ls flags if running on OSX.
if [[ "$(uname -s)" == 'Darwin' ]]; then
alias ls='ls -GT'
else
alias ls='ls --color=auto'
fi
PROMPT='
╭ %* %B%F{blue}%1~%b${vcs_info_msg_0_}%f
%B'
# Set up common aliases.
alias dr='screen -T screen-256color -DR'
alias dl='screen -ls'
alias grep='grep --color=auto'
alias l='ls -lAh'
# Set additional zsh options.
setopt rm_star_silent
# Handle conditional shortcuts.
if [ -d "$HOME/Documents" ]; then
d(){cd "$HOME/Documents/$1"; ls}
compctl -W "$HOME/Documents" -/ d
fi
if [ -d "$HOME/Play" ]; then
p(){cd "$HOME/Play/$1"; ls}
compctl -W "$HOME/Play" -/ p
fi
if [ -d "$HOME/.local/bin" ]; then
export PATH=$HOME/.local/bin:$PATH
fi
# Use ripgrep with sed if installed.
if [ -x "$(command -v rg)" ]; then
rgs(){
rg -l $1 | xargs sed -i '' "s$1$2g"
}
fi
alias q='noglob q'