-
Notifications
You must be signed in to change notification settings - Fork 3
/
zshrc
74 lines (61 loc) · 1.75 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
# Init
autoload -Uz compinit promptinit vcs_info
compinit
promptinit
precmd() {
vcs_info
}
setopt autocd
setopt extendedglob
# History
HISTSIZE=50000
SAVEHIST=10000
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt extended_history
setopt hist_verify
setopt inc_append_history
setopt share_history
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
# Git info
setopt prompt_subst
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' get-revision false
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:git*' formats " %b %u%c%m"
zstyle ':vcs_info:git*' actionformats " %b %a %u%c%m"
zstyle ':vcs_info:*' stagedstr '%F{green}+%f'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}*%f'
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
+vi-git-untracked() {
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
git status --porcelain | grep -m 1 '^??' &>/dev/null
then
hook_com[misc]='%F{red}?%f'
fi
}
# EMacs mode
bindkey -e
# Completion tweaks
zstyle ':completion:*' menu select
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
# PS1
NEWLINE=$'\n' # Used as ${NEWLINE}
PROMPT='%B%F{red}%m%f %F{green}%n%f %F{cyan}%(5~|…/%3~|%~)%f%F{yellow}${vcs_info_msg_0_}%f${NEWLINE}%(?.%F{green}%#.%F{red}%#)%f%b '
# Colored grep
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
# Colored ls
# BSD
export LSCOLORS="gxhxcxdxbxegedabagacad"
# Linux
#export LSCOLORS="di=36:ln=37:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
alias ls="ls -GF"
alias l="ls -GF"
alias la="ls -alGF"
# Misc
alias cd..='cd ..'
alias ..='cd ..'