-
Notifications
You must be signed in to change notification settings - Fork 0
/
shrc
95 lines (81 loc) · 2.38 KB
/
shrc
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
## On .bashrc or .zshrc,
# if [ -f ~/dotfiles/shrc ] ; then
# . ~/dotfiles/shrc
# fi
if [ -n "$ZSH_VERSION" ] ; then
autoload -Uz add-zsh-hook compinit colors
compinit
colors
fpath=(~/.zsh $fpath)
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${LS_COLORS}"
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
setopt completealiases
fi
export LANG=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
export LSCOLORS='gxfxcxdxbxegedabagacad'
export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32'
if [[ ${PATH} != *${HOME}/bin* ]]; then
export PATH=${HOME}/bin:${PATH}
fi
case $OSTYPE in
linux*) alias ls='ls -F --color=auto'
alias rm='\mv -f --backup=numbered --target-directory ~/.mytrash'
;;
darwin*) alias ls='ls -FG'
# https://github.com/sindresorhus/trash-cli
alias rm='trash'
;;
esac
alias gs='git status'
alias gd='git diff'
alias mv='mv -i'
alias grep='grep --color=auto'
# git-completion
if [ -n "$BASH_VERSION" ] && [ -f ~/git-completion/git-completion.bash ] ; then
. ~/git-completion/git-completion.bash
fi
# git-prompt
if [ -f ~/git-completion/git-prompt.sh ] ; then
. ~/git-completion/git-prompt.sh
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
if [ -n "$BASH_VERSION" ] ; then
#export PS1='\u@\h \w\[\033[1;31m\]$(__git_ps1)\[\033[00m\] $ '
PROMPT_COMMAND="__git_ps1 '\u@\h \w' ' \\\$ '"
elif [ -n "$ZSH_VERSION" ] ; then
function gitps1() {
__git_ps1 '%n@%m %~' ' $ '
}
add-zsh-hook precmd gitps1
fi
else
if [ -n "$BASH_VERSION" ] ; then
export PS1='\u@\h \w $ '
elif [ -n "$ZSH_VERSION" ] ; then
export PROMPT='%n@%m %~ $ '
fi
fi
# previous command status
function prev_status() {
s="$?"
if [ $s -eq 0 ] ; then
# echo ''
else
echo "[$s] 🤬🤬🤬🤬🤬🤬💢💢💢💢💢💢"
fi
unset s
}
if [ -n "$ZSH_VERSION" ] ; then
add-zsh-hook precmd prev_status
fi
# nodenv
if [ -d ${HOME}/.nodenv ]; then
if [ -d ${HOME}/.nodenv/bin ]; then
if [[ ${PATH} != *${HOME}/.nodenv/bin* ]]; then
export PATH=${HOME}/.nodenv/bin:${PATH}
fi
fi
eval "$(nodenv init -)"
fi