-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
110 lines (85 loc) · 2.35 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
# history
HISTFILE=~/.zsh_history
HISTSIZE=5000
SAVEHIST=100000
setopt share_history
# settings
# setopt correct_all
setopt autocd
setopt hist_ignore_dups
unsetopt nomatch
export EDITOR='mvim -v'
# paths
export PATH=/usr/local/bin:$HOME/dotfiles/bin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
typeset -U path # fix any path dupes
# keybindings (emac-style)
# bindkey -e
# colors
export CLICOLOR=1
autoload colors && colors
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
for COLOR in RED GREEN YELLOW WHITE BLACK CYAN; do
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
PR_RESET="%{${reset_color}%}";
# aliases
if ls -F --color=auto >&/dev/null; then
alias ls="ls --color=auto -F"
else
alias ls="ls -F"
fi
alias cd..='cd ..'
alias fu='sudo $( fc -ln -1)'
alias grep='grep --color=auto'
alias soywiki='SOYWIKI_VIM=mvim soywiki'
alias diff='diff -u'
alias be='bundle exec'
alias vim='mvim -v'
alias cdf='cd `posd`'
# tab completion
autoload -U compinit && compinit
# prompt
setopt prompt_subst
# autoload -U promptinit && promptinit
. ~/dotfiles/bin/z.sh
# set window title
function precmd {
print -Pn "\e]0;%n@%m: %~\a"
vcs_info 'prompt'
lprompt
}
# git repositories
autoload -Uz vcs_info && vcs_info
# %b - branchname
# %u - unstagedstr (see below)
# %c - stangedstr (see below)
# %a - action (e.g. rebase-i)
# %R - repository path
# %S - path in the repository
FMT_BRANCH="${PR_GREEN}%b%u${PR_RESET}"
FMT_ACTION="(${PR_CYAN}%a${PR_RESET})"
FMT_PATH="%R${RP_YELLOW}/%S"
zstyle ':vcs_info:*:prompt:*' check-for-changes true
zstyle ':vcs_info:*:prompt:*' unstagedstr '1'
zstyle ':vcs_info:*:prompt:*' stagedstr '2'
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
function prompt_char {
git branch >/dev/null 2>/dev/null && echo 'ʭ' && return
echo '$'
}
function lprompt {
local current_path=${(%):-%~}
PROMPT="
${PR_CYAN}${current_path//\//${PR_WHITE}/${PR_RESET}${PR_CYAN}}${PR_RESET} $vcs_info_msg_0_$(prompt_char) "
#RPROMPT="[${PR_YELLOW}%n@%m${PR_RESET}]"
}
lprompt
unsetopt extended_glob
# rvm / vim+rvm
SHELL=/bin/zsh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"