-
Notifications
You must be signed in to change notification settings - Fork 3
/
.zshrc
124 lines (104 loc) · 3.62 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# ---[ Completion ] {{{
# :completion:<func>:<completer>:<command>:<argument>:<tag>
# Expansion options
zstyle ':completion:*' completer _complete _prefix
zstyle ':completion::prefix-1:*' completer _complete
zstyle ':completion:incremental:*' completer _complete _correct
zstyle ':completion:predict:*' completer _complete
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Expand partial paths
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*' squeeze-slashes 'yes'
zstyle ':completion:*' menu select=1 _complete _ignored _approximate
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
# Separate matches into groups
zstyle ':completion:*:matches' group 'yes'
# Describe each match group.
zstyle ':completion:*:descriptions' format "==[ %d%b ]"
# Messages/warnings format
zstyle ':completion:*:messages' format '==[ %d%u%b ]'
zstyle ':completion:*:warnings' format '==[ no match for: %d%u%b ]'
# Describe options in full
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
# }}}
# ---[ misc options ] {{{
# General
setopt ALWAYS_TO_END NO_BEEP CLOBBER
setopt AUTO_CD CD_ABLE_VARS MULTIOS CORRECT_ALL
# Job Control
setopt CHECK_JOBS NO_HUP
# History
setopt INC_APPEND_HISTORY EXTENDED_HISTORY HIST_IGNORE_ALL_DUPS HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS HIST_SAVE_NO_DUPS HIST_IGNORE_SPACE
setopt HIST_EXPIRE_DUPS_FIRST
# Stay compatible to sh and IFS
setopt SH_WORD_SPLIT
setopt notify globdots pushdtohome
setopt longlistjobs
setopt autoresume pushdsilent
setopt autopushd pushdminus extendedglob rcquotes mailwarning
unsetopt BG_NICE HUP autoparamslash
autoload -Uz compinit complist zutil
compinit
# }}}
# ---[ exports ] {{{
export HISTFILE=~/.zsh_history
export BROWSER="firefox"
export EDITOR="vim"
export PAGER="less -winm"
export HISTSIZE=5000
export SAVEHIST=5000
export VISUAL=$EDITOR
export PATH=$HOME/.bin:$PATH
export STARDICT_DATA_DIR=${HOME}/.stardict
# for colored man pages
export LESS_TERMCAP_mb=$'\E[1;31m'
export LESS_TERMCAP_md=$'\E[1;31m'
export LESS_TERMCAP_me=$'\E[1;37m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[1;34m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[1;32m'
# }}}
# ---[ sourced files ] {{{
source ~/.zsh/aliases
source ~/.zsh/colors
source ~/.zsh/functions
# eval $(dircolors -b $HOME/.dircolors)
# }}}
# ---[ keybindings ] {{{
bindkey -v
bindkey '^[Oc' forward-word #for normal shell
bindkey '^[Od' backward-word
bindkey '^[OC' forward-word #for tmux
bindkey '^[OD' backward-word
bindkey '^[[1~' beginning-of-line #for screen
bindkey '^[[4~' end-of-line
bindkey '^[[7~' beginning-of-line #for rxvt
bindkey '^[[8~' end-of-line
bindkey '^[[3~' delete-char
bindkey '^[[2~' overwrite-mode
bindkey '^r' .history-incremental-pattern-search-backward
bindkey '^?' backward-delete-char
bindkey '^[' vi-cmd-mode
bindkey '^b' clear-screen
bindkey '^k' kill-whole-line
bindkey '^y' .vi-yank-whole-line
bindkey '^[[5~' .undefined-key
bindkey '^[[6~' .undefined-key
# }}}
#---[ PROMPT ] {{{
precmd () {
[[ $? -eq 0 ]] && color="`tput setaf 2`" || color="`tput setaf 1`"
export PROMPT="`tput bold`${color}-=-=-`tput sgr0` %l `tput bold``tput setaf 4`%/ ${color}-=-=-`tput sgr0`
>> "
[[ -n "$RANGER_LEVEL" ]] && export RPROMPT="(in ranger; level=$RANGER_LEVEL)"
}
# }}}
# ---[ login manager ] {{{
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]] { exec startx -- vt1 &> /dev/null }
# }}}
# ---[ start tmux ] {{{
# if [[ $(tty) = /dev/pts/0 ]] && [[ -z "$TMUX" ]] { exec tmux }
# }}}