-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
128 lines (97 loc) · 2.66 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
# ==================
# Bash configuration
# ==================
export PATH=/usr/local/bin:$PATH
# ---------
# Functions
# ---------
# Git: show branch
autoload -Uz vcs_info
zstyle ':vcs_info:git*' formats "(%b) %m%u%c "
precmd() {
vcs_info
}
# Git: branch tab completion
zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
fpath=(~/.zsh $fpath)
autoload -Uz compinit && compinit
# Autocomplete zsh for kitty
kitty + complete setup zsh | source /dev/stdin
# Ruby: check version
function ruby_version() {
if which ruby &> /dev/null && ruby -v &> /dev/null; then
ruby -v | cut -d' ' -f2
elif which jruby &> /dev/null && jruby -v &> /dev/null; then
echo "jruby $(jruby -v | cut -d' ' -f2)"
else
echo none
fi
}
# Python: check version
function python_version() {
if which python &> /dev/null; then
python --version 2>&1 | cut -d' ' -f2
else
echo none
fi
}
function __version() {
echo "Python v$(python_version) :: Ruby v$(ruby_version)"
}
# --------------
# Command prompt
# --------------
# load modules for git branch display
setopt prompt_subst
# make some aliases for the colours: (coud use normal escap.seq's too)
autoload -U colors && colors
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$fg[${(L)color}]%}'
done
PR_NO_COLOR="%{$terminfo[sgr0]%}"
# Set up cute emoticon prompt
pr_user() {
echo "%(!.${PR_RED}.${PR_WHITE})%(!.[! %n !].%n)${PR_NO_COLOR}"
}
function pr_user_op() {
local PR_PRIV='%(!.#.>)'
local PR_ART_IDLE='( ᵕ‿ᵕ%)つ━★ ༓・*˚⁺‧'
local PR_ART_ERR='ᵒʰ( ⑉・̆⌓・̆⑉%)ɴᴏ_・⌒‧'
local PR_ART="%(0?.${PR_MAGENTA}${PR_ART_IDLE}.${PR_RED}${PR_ART_ERR})"
echo "${PR_ART}${PR_PRIV}${PR_NO_COLOR}"
}
# Check if we are on SSH or not
# set the prompt
PS1=$'\n''${PR_BLUE}%~ ${PR_GREEN}${vcs_info_msg_0_} '$'\n''$(pr_user_op)${PR_NO_COLOR} '
PS2=$'%_❥'
RPROMPT=$'%!'
# --------------------
# Environment settings
# --------------------
# Set ssh
eval $(ssh-agent -s) > /dev/null
# -------
# Aliases
# -------
# Bash aliases
alias l="ls -la" # List in long format, include dotfiles
alias ld="ls -ld */" # List in long format, only directories
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# Ruby and related aliases
alias be="bundle exec"
alias serve="bundle exec jekyll serve"
# Sublime Test
alias sublime="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
# Git aliases found in .gitconfig_global
# ---------
# Say stuff
# ---------
__version
# -------
# Lastly,
# -------
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
source $HOME/.rvm/scripts/rvm
export PATH="$PATH:$HOME/.rvm/bin"