-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_zshrc
162 lines (142 loc) · 3.79 KB
/
my_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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
autoload -U compinit
compinit
autoload colors
colors
zstyle ':completion:*' list-colors 'di=;34;1' 'ln=;36;1' 'so=;32;1' 'ex=32;1' 'bd=46;34' 'cd=43;34'
#zstyle ':completion:*' list-colors ''
#zstyle ':zle:*' word-chars " -~()/:@+|"
#zstyle ':zle:*' word-style unspecified
#autoload -Uz select-word-style
#select-word-style bash
# prompt setting
#export PROMPT="%B%n%b@:%/%{%}/$ "
SPROMPT="%B%{[31m%}%r%b %Bis correct?%b %B%{[31m%}[n,y,a,e]:%{[m%}%b "
setopt prompt_subst
local rbase=$'%{\e[33m%}[%~]%{\e[m%}' lf=$'\n'
RPROMPT="%9(~||$rbase)"
#nprom () {
# setopt prompt_subst
# local rbase=$'%{\e[33m%}[%~]%{\e[m%}' lf=$'\n'
# local pct=$'%0(?||%18(?||%{\e[31m%}))%#%{\e[m%}'
# RPROMPT="%9(~||$rbase)"
# case "$USER" in
# mobile)PROMPT=$'%{\e[$[31]m%}%U%B%m{%n}%b'"$pct%u ";;
# root)PROMPT=$'%{\e[$[31]m%}%U%B%m{%n}%b'"$pct%u ";;
# *)
# local pbase=$'%{\e[$[33]m%}%U%B{%n}%b'"$pct%u "
# PROMPT="%9(~|$rbase$lf|)$pbase"
# ;;
# esac
# [ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
# PROMPT="%B%U%{[32m%}${HOST%%.*}${PROMPT}"
# [[ "$TERM" = "screen" ]] && RPROMPT="[%U%~%u]"
#}
#nprom
function myprom(){
#リモートの場合はホスト名の色を変える
if [ -n "${REMOTEHOST}${SSH_CONNECTION}" ]; then
PROMPT="%{[32m%}%B%U%m"
else
PROMPT="%{[33m%}%B%U%m"
fi
#rootの場合は色を変える
case "$UID" in
0)
PROMPT="${PROMPT}%{[33m%}%u{%U%{[31m%}%n"
;;
*)
PROMPT="${PROMPT}%{[33m%}{%n"
;;
esac
}
myprom
PROMPT="${PROMPT}%{[33m%}}%{[37m%}%#%b%u "
#PROMPT="${PROMPT}%{[36m%}INS%{[33m%}}%{[37m%}%#%b%u "
##zshプロンプトにモード表示####################################
#function zle-line-init zle-keymap-select {
# myprom
# #zsh-viのモード名を表示
# case $KEYMAP in
# vicmd)
# PROMPT="${PROMPT}%{[31m%}NOR%{[33m%}}%{[37m%}%#%b%u "
# ;;
# main|viins)
# PROMPT="${PROMPT}%{[36m%}INS%{[33m%}}%{[37m%}%#%b%u "
# ;;
# esac
# zle reset-prompt
#}
#zle -N zle-line-init
#zle -N zle-keymap-select
# environment variables
PATH=$PATH:$HOME/bin
export PATH
export LANG=ja_JP.UTF-8
export LSCOLORS=exfxcxdxbxegedabagacad
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
#export JAVA_HOME='/usr/lib/jvm/java-1.6.0-openjdk'
# alias
alias ls='ls -hF --color=auto'
alias la='ls -A'
alias ll='ls -l'
alias du='du -hk'
alias vi='vim'
alias rm='rm -frv'
alias df='df -h'
alias exzsh='exec zsh'
alias grep='grep --color'
alias tmux='tmux -2'
alias mozc-config='/usr/lib/mozc/mozc_tool --mode=config_dialog'
eval "`dircolors ~/.dir_colors`"
[ -f ~/.zshrc_aliases ] && source ~/.zshrc_aliases
# history
HISTFILE=~/.bash_history
HISTSIZE=10000000
SAVEHIST=10000000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
# key bind
bindkey -e
# history with C-p C-n
#autoload history-search-end
#zle -N history-beginning-search-backward-end history-search-end
#zle -N history-beginning-search-forward-end history-search-end
#bindkey "^P" history-beginning-search-backward-end
#bindkey "^N" history-beginning-search-forward-end
# terminal option
case "${TERM}" in
kterm*|xterm)
precmd() {
echo -ne "\033]0;${USER}@${PWD}\007"
}
;;
esac
# move with directory name
setopt auto_cd
setopt auto_pushd
# other...
setopt correct
setopt list_packed
setopt nolistbeep
setopt no_beep
autoload math functions
setopt complete_aliases
setopt EXTENDED_GLOB
#keyconfig
#xmodmap .Xmodmap
# z
_Z_CMD=j
source ~/.zsh/z.sh
precmd() {
_z --add "$(pwd -P)"
}
# autofu
if [ -f ~/.zsh/auto-fu.zsh ]; then
source ~/.zsh/auto-fu.zsh
function zle-line-init () {
auto-fu-init
}
zle -N zle-line-init
#zstyle ':completion:*' completer _oldlist _complete
zstyle ':completion:*' completer _oldlist _complete _match _ignored _approximate
fi