-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathzshrc
89 lines (70 loc) · 2.22 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
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
setopt hist_ignore_all_dups inc_append_history
HISTFILE=~/.zhistory
HISTSIZE=4096
SAVEHIST=4096
export ERL_AFLAGS="-kernel shell_history enabled"
# extended completions
if [ -d ~/.zsh/completion/src ]; then
fpath=(~/.zsh/completion/src $fpath)
fi
autoload -Uz compinit
compinit
# makes color constants available
autoload -U colors
colors
export CLICOLOR=1
# Bash behavior for alt-left right arrows and alt-b(back word) alt-f(forward
# word)
autoload -U select-word-style
select-word-style bash
bindkey -e
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[1;3C" forward-word
bindkey "^[[1;3D" backward-word
# Prompt Code
# modify the prompt to contain git branch name if applicable
git_prompt_info() {
current_branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')
if [[ -n $current_branch ]]; then
echo "%{$fg_bold[yellow]%}$current_branch%{$reset_color%}"
fi
}
setopt promptsubst
# Allow exported PS1 variable to override default prompt.
if ! env | grep -q '^PS1='; then
PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[red]%}%c%{$reset_color%}$(git_prompt_info) # '
fi
# awesome cd movements from zshkit
setopt autocd autopushd pushdminus pushdsilent pushdtohome cdablevars
DIRSTACKSIZE=5
# Enable extended globbing
setopt extendedglob
# Allow [ or ] whereever you want
unsetopt nomatch
# global envs
export VISUAL=vim
export EDITOR=$VISUAL
g() {
if [[ $# -gt 0 ]]; then
git "$@"
else
git status
fi
}
compdef g=git
export PATH="$HOME/bin:$PATH"
# for mac systems this will pickup homebrew, otherwise nice to have.
export PATH="/usr/local/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
# add path for python user directory binaries
export PATH="${PATH}:$(python3 -c 'import site; print(site.USER_BASE)')/bin"
# nvm
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# yarn
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# NOTE: You may place your own configurations in ~/.zshrc.user
[[ -f ~/.zshrc.user ]] && source ~/.zshrc.user