-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc.local
63 lines (53 loc) · 2.06 KB
/
zshrc.local
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
# change iterm2 profiles
# use with the name of a profile `use home`
# helpful for having different profiles w/text sizes for different screen sizes
function use() { echo -e "\033]50;SetProfile=$1\a" }
# machine specific configs should live in this file, like rbenv stuff
[[ -f ~/.zshrc.machine-local ]] && source ~/.zshrc.machine-local
# add dirs to cd into their contents from anywhere directly
# CDPATH=:~:~/workspace
# highlighting for tab completion
zstyle ':completion:*' list-colors "no=00" "fi=00"
zstyle ':completion:*:*:*:*:*' menu select
# prompt config
# stolen from oh-my-zsh + robbyrussell theme without all the other stuff
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
# Checks if working tree is dirty
function parse_git_dirty() {
local STATUS=''
local -a FLAGS
FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
FLAGS+='--ignore-submodules=dirty'
fi
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
fi
if [[ -n $STATUS ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}
# run tests over and over for flakiness
# rep_til_failure bin/rails test test/path
function rep_til_failure() {
while $*; do : ; done
}
# Outputs current branch info in prompt format
function git_prompt_info() {
local ref
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
CDPATH=:~:~/code/ezcater