-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.zshrc
136 lines (108 loc) · 4.32 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
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
#Bind so that the color red is show when in command mode and grey in insert mode.
zle-keymap-select () {
if [ $TERM = "xterm" ]; then
if [ $KEYMAP = vicmd ]; then
echo -ne "\033]12;Red\007"
else
echo -ne "\033]12;Grey\007"
fi
fi
}
zle -N zle-keymap-select
zle-line-init () {
zle -K viins
if [ $TERM = "xterm" ]; then
echo -ne "\033]12;Grey\007"
fi
}
zle -N zle-line-init
#Set to vi mode
bindkey -v
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory nomatch notify
unsetopt autocd beep extendedglob
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/martin/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -A key
key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init () {
printf '%s' "${terminfo[smkx]}"
}
function zle-line-finish () {
printf '%s' "${terminfo[rmkx]}"
}
zle -N zle-line-init
zle -N zle-line-finish
fi
# Auto load the prompt
autoload -U promptinit
promptinit
prompt redhat
#Show available promt themes
#$ promt -p
### ####################################
### Version Control Information
#
# http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information
# https://github.com/zsh-users/zsh/blob/master/Misc/vcs_info-examples
# http://www.jukie.net/~bart/conf/zsh/rc/S60_prompt
# http://stackoverflow.com/questions/1128496/to-get-a-prompt-which-indicates-git-branch-in-zsh
### ####################################
# To be able to use ’${vcs_info_msg_0_}’ directly in your prompt,
# you will need to have the PROMPT_SUBST option enabled.
setopt prompt_subst
autoload -Uz vcs_info
# %b - branchname
# %u - unstagedstr (see below)
# %c - stangedstr (see below)
# %a - action (e.g. rebase-i)
# %R - repository path
# %S - path in the repository
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr 'C' #display specified symbol if there are unstaged changes
zstyle ':vcs_info:*' stagedstr 'C' #display specified symbol if there are staged changes
zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f %u %c'
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn
precmd () { vcs_info } # You need to call vcs_info from your precmd function.
# Once that is done you need a single quoted ’${vcs_info_msg_0_}’ in your prompt.
# Format the prompt
#PS1='%F{5}[%F{2}%n%F{5}] %F{3}%3~ ${vcs_info_msg_0_}%f%# '
PS1='%F{5}[%F{2}%n%F{5}] %f%# '
# Display the VCS information in the right prompt. The {..:- } is a workaround for Zsh below verion 4.3.9.
#RPROMPT='${vcs_info_msg_0_:- }'
RPROMPT='%F{3}%3~ ${vcs_info_msg_0_:- }'
# Now call the vcs_info_printsys utility from the command line...