-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
100 lines (88 loc) · 2.06 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
# Set terminfo
export TERM=xterm-256color
# Vim bind
bindkey -v
if which vim > /dev/null; then
export EDITOR=vim
fi
# Completion
autoload -Uz compinit
compinit
# History
HISTFILE=$HOME/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt extended_history
setopt share_history
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey '^P' history-beginning-search-backward-end
bindkey '^N' history-beginning-search-forward-end
bindkey '^R' history-incremental-search-backward
# Prompts
PROMPT_COLOR_LEFT='69'
PROMPT_COLOR_USER='69'
PROMPT_COLOR_HOSTNAME='69'
PROMPT_COLOR_PWD='220'
# In SSH
if [ ! -z $SSH_CLIENT ]
then
PROMPT_COLOR_LEFT='green'
PROMPT_COLOR_USER='green'
PROMPT_COLOR_HOSTNAME='green'
fi
# When root
if [ `id -u` -eq 0 ]
then
PROMPT_COLOR_LEFT='red'
PROMPT_COLOR_USER='red'
PROMPT_COLOR_HOSTNAME='red'
fi
PROMPT="%F{${PROMPT_COLOR_LEFT}}[%n-%*]%f "
RPROMPT="[%F{${PROMPT_COLOR_HOSTNAME}}%m%f:%F{${PROMPT_COLOR_PWD}}%~%f]"
# Aliases
alias c='cd'
alias l='ls'
alias ll='ls -lh'
alias la='ls -a'
alias lla='ls -lha'
alias lal='ls -lha'
alias v='vim'
alias vr='vim -R'
alias vimr='vim -R'
alias g='git'
alias be='bundle exec'
alias tm='tmux'
alias reload='source $HOME/.zshrc'
if which colordiff &> /dev/null
then
alias diff='colordiff -u'
fi
# OS-specific configuration
case $OSTYPE in
darwin*)
export LSCOLORS=gxfxcxdxbxegedabagacad
alias ls='ls -G';;
linux-gnu)
export LS_COLORS='di=00;36:ln=00;35'
alias ls='ls --color=auto';;
esac
# cd
setopt auto_cd
chpwd(){ls}
# Directory stack with completion
DIRSTACKSIZE=100
setopt AUTO_PUSHD
zstyle ':completion:*' menu select
zstyle ':completion:*:cd:*' ignore-parents parent pwd
zstyle ':completion:*:descriptions' format '%BCompleting%b %U%d%u'
# Match case-insensitively
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# Syntax highlighting
source $HOME/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Run
ls