1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,22 @@ |
0 |
+function zle-line-init zle-keymap-select { |
|
1 |
+ zle reset-prompt |
|
2 |
+} |
|
3 |
+ |
|
4 |
+zle -N zle-line-init |
|
5 |
+zle -N zle-keymap-select |
|
6 |
+ |
|
7 |
+bindkey -v |
|
8 |
+ |
|
9 |
+# if mode indicator wasn't setup by theme, define default |
|
10 |
+if [[ "$MODE_INDICATOR" == "" ]]; then |
|
11 |
+ MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}" |
|
12 |
+fi |
|
13 |
+ |
|
14 |
+function vi_mode_prompt_info() { |
|
15 |
+ echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" |
|
16 |
+} |
|
17 |
+ |
|
18 |
+# define right prompt, if it wasn't defined by a theme |
|
19 |
+if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then |
|
20 |
+ RPS1='$(vi_mode_prompt_info)' |
|
21 |
+fi |