forked from ricbra/zsh-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
127 lines (109 loc) · 3.9 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
125
126
127
# Common ENV variables
export EDITOR='vim'
export GIT_EDITOR='vim'
export SHELL='/bin/zsh'
export NVM_DIR='/usr/local/opt/nvm'
# Fix Locale
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# History
export HISTSIZE=500000
export HISTFILE="$HOME/.history"
export SAVEHIST=$HISTSIZE
# Remove superfluous blanks from each command line being added to the history
# list
setopt histreduceblanks
# Remove command lines from the history list when the first character on the
# line is a space, or when one of the expanded aliases contains a leading space
setopt histignorespace
# Do not enter command lines into the history list if they are duplicates of the
# previous event.
setopt histignorealldups
# Switching directories for lazy people
setopt autocd
# See: http://zsh.sourceforge.net/Intro/intro_6.html
setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
# Don't kill background jobs when I logout
setopt nohup
# See: http://zsh.sourceforge.net/Intro/intro_2.html
setopt extendedglob
# Do not require a leading '.' in a filename to be matched explicitly
setopt globdots
# Use vi key bindings in ZSH
setopt vi
# Causes field splitting to be performed on unquoted parameter expansions
setopt shwordsplit
# Automatically use menu completion after the second consecutive request for
# completion
setopt automenu
# If the argument to a cd command (or an implied cd with the AUTO_CD option set)
# is not a directory, and does not begin with a slash, try to expand the
# expression as if it were preceded by a '~'
setopt cdablevars
# Try to make the completion list smaller (occupying less lines) by printing
# the matches in columns with different widths
setopt listpacked
# Don't show types in completion lists
setopt nolisttypes
# If a completion is performed with the cursor within a word, and a full
# completion is inserted, the cursor is moved to the end of the word
setopt alwaystoend
# Try to correct the spelling of commands
setopt correct
# https://github.com/robbyrussell/oh-my-zsh/issues/449
setopt no_nomatch
# Disable annoying confirm
setopt rmstarsilent
# case-insensitive (uppercase from lowercase) completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# process completion
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"
# zstyle
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*:descriptions' format '%U%F{yellow}%d%f%u'
zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
# Functions Autoloading
fpath=(~/.zsh $fpath)
# Completion
autoload -U promptinit && promptinit
autoload -U compinit compdef && compinit
# Prompt
prompt pure
# Reverse search
bindkey -e
# Autosuggest
source ~/.zsh/zsh-autosuggestions
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=0162'
if [ `uname` = 'Linux' ]; then
eval `dircolors ~/.dir_colors`
export LS_OPTIONS='--color=auto'
else
export LS_OPTIONS='-G'
fi
# alias
alias ls='ls $LS_OPTIONS -hF'
alias ll='ls $LS_OPTIONS -lAhF'
alias cd..="cd .."
alias ..="cd .."
alias projects="cd ~/projects/"
alias dig='dig +short +noshort'
alias dm='docker-machine'
alias dc='docker-compose'
alias current='git rev-parse --abbrev-ref HEAD'
alias git-initial='CURRENT=$(current) && git checkout --orphan newBranch;git add -A;git commit -m "Initial commit";git branch -D $CURRENT;git branch -m $CURRENT;'
# key bindings
bindkey "\e[3~" delete-char # Delete
bindkey "^[^[[D" backward-word # Word backup
bindkey "^[^[[C" forward-word # Word forward
# NVM Stuff
if [[ -s "$NVM_DIR/nvm.sh" ]]; then
. "$NVM_DIR/nvm.sh"
fi
### PATH
export PATH=/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
source ~/.zsh/zsh-autosuggestions