-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
123 lines (96 loc) · 2.33 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
# vim: set ts=4 sw=4 expandtab:
if [ -r "$HOME/.zsh/zshrc-functions" ]; then
. "$HOME/.zsh/zshrc-functions"
fi
#
# VARIABLES
#
HISTFILE=~/.zsh_history
SAVEHIST=1000000
HISTSIZE=1000000
#
# EXPORTS
#
export DO_NOT_TRACK=1
export BROWSER=firefox
export EDITOR=vim
export PAGER=less
if [ "$DISPLAY" != "" ]; then
export TERM=xterm-256color
fi
#
# OPTIONS
#
setopt AUTO_CONTINUE
setopt AUTO_PUSHD
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt INC_APPEND_HISTORY
setopt NO_AUTO_MENU
setopt NO_AUTO_REMOVE_SLASH
setopt NO_CHECK_JOBS
setopt NO_CLOBBER
setopt NO_HUP
setopt PUSHD_SILENT
setopt RE_MATCH_PCRE
#
# ZSH MODULES
#
autoload -U colors; colors
autoload -U compinit; compinit
autoload -U bashcompinit; bashcompinit
autoload -U edit-command-line; zle -N edit-command-line
#
# COMPLETION
#
zmodload -i zsh/complist
zstyle ':completion:*' list-colors `dircolors | tr : ' '`
# Case insensitive autocompletion
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
#
# KEYBINDINGS
#
bindkey -e # Set initial keymap to emacs emulation.
bindkey '^[[1~' beginning-of-line # HOME
bindkey '^[[2~' overwrite-mode # INSERT
bindkey '^[[3~' delete-char # DELETE
bindkey '^[[4~' end-of-line # END
bindkey '^[[5~' history-beginning-search-backward # PAGE UP
bindkey '^[[6~' history-beginning-search-forward # PAGE DOWN
bindkey '^[[H' beginning-of-line # HOME
bindkey '^[[F' end-of-line # END
bindkey '^Xe' edit-command-line
# Prepend sudo using Alt-s
function prepend-sudo {
if ! [[ $BUFFER =~ '^ *sudo ' ]]; then
BUFFER="sudo $BUFFER"; CURSOR+=5
fi
}
zle -N prepend-sudo
bindkey "^[s" prepend-sudo
#
# MISC
#
# backward-kill-word to slash or period etc, instead of just space
autoload -U select-word-style
select-word-style bash
#
# DIRCOLORS
#
DIRCOLORS_FILE="$HOME/.dir_colors/dircolors"
if [ -r "$DIRCOLORS_FILE" ]; then
eval $(dircolors "$DIRCOLORS_FILE")
fi
#
# SYNTAX HIGHLIGHTING
#
if [ -f "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then
source "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
fi
#
# INCLUDE CONFIG DIR
#
for file in "$HOME"/.zsh/zshrc.d/*.zsh; do
source "$file"
done