-
Notifications
You must be signed in to change notification settings - Fork 0
/
_zshrc
97 lines (79 loc) · 3.06 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
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename $HOME/.zshrc
autoload -Uz compinit
compinit
# End of lines added by compinstall
# ls colors
autoload colors; colors;
if [ "$DISABLE_LS_COLORS" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or BSD
if [[ "$(uname -s)" == "NetBSD" ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
# On OpenBSD, test if "colorls" is installed (this one supports colors);
# otherwise, leave ls as is, because OpenBSD's ls doesn't support -G
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
else
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
fi
fi
# Redirectiion, prompt commands
setopt multios
setopt cdablevarS
setopt prompt_subst
# Grep setting
GREP_OPTIONS="--color=auto"
# ignore .cvs .git etc.
grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
if grep-flag-available --exclude-dir=.cvs; then
for PATTERN in .cvs .git .hg .svn; do
GREP_OPTIONS+=" --exclude-dir=$PATTERN"
done
elif grep-flag-available --exclude=.cvs; then
for PATTERN in .cvs .git .hg .svn; do
GREP_OPTIONS+=" --exclude=$PATTERN"
done
fi
unfunction grep-flag-available
# ignore temporary file
GREP_OPTIONS+=" --exclude=*.*~"
export GREP_OPTIONS="$GREP_OPTIONS"
export GREP_COLOR='1;32'
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}<git:" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=">%{$reset_color%}" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean
#source $HOME/git.zsh
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
# PROMPT Theme
local pre_user_host='%n@%m'
local pre_current_dir=':%~'
local user_host='%{$terminfo[bold]$terminali$fg[green]%}${pre_user_host}%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%}${pre_current_dir}%{$reset_color%}'
local time_host='%{$terminfo[bold]$fg[red]%}[%t]%{$reset_color%}'
local git_branch='$(git_prompt_info)'
local newline=$'\n'
local lineup=$'\e[1A'
local linedown=$'\e[1B'
#PROMPT="╭─${user_host} ${current_dir} ${git_branch} ${newline}╰─►"
PROMPT="${time_host} ${user_host}${current_dir}${git_branch}\
> "
#RPROMPT="%{${lineup}%}${time_host}%{${linedown}%}"
# PATH
export PATH=/Users/sunghan/Applications:/Library/TeX/texbin/:/usr/local/bin:$PATH