-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
70 lines (57 loc) · 1.62 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
### Start the zshrc
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd extendedglob
unsetopt beep
bindkey -e
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
zstyle :compinstall filename '/Users/blairezhang/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# System zshrc for various things.
ZSH_RC="/etc/zshrc"
ZSH_SUGGESTIONS="/opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
if [ -f $ZSH_RC ]; then
source $ZSH_RC
fi
if [ -f $ZSH_SUGGESTIONS ]; then
source $ZSH_SUGGESTIONS
fi
# Open new tabs in same directory
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
function chpwd {
printf '\e]7;%s\a' "file://$HOSTNAME${PWD// /%20}"
}
chpwd
fi
# Correct key mappings
bindkey -e
bindkey '[C' forward-word
bindkey '[D' backward-word
# Various environment variables
export CLICOLOR=1
# Find and set branch name var if in git repository.
function git_branch_name()
{
branch=$(git branch --show-current 2> /dev/null)
if [[ $branch == "" ]];
then
echo '<not a git repo>'
else
echo ''$branch''
fi
}
# Enable substitution in the prompt.
setopt prompt_subst
# PATH specifics
export PATH=/opt/homebrew/bin:$PATH
# PROMPT specifics
export PROMPT='%F{magenta}%n%f%F{white} at %f%F{cyan}%m%f%F{white} in %f%B%F{green}%1~%f%b%F{white} on %B%F{yellow}$(git_branch_name) %b%f%# '
export RPROMPT='👩🏻💻%t'
alias gswitch='git checkout $(git branch | fzf --height 20% | xargs)'
# end
autoload -U +X bashcompinit && bashcompinit