]> Sergey Matveev's repositories - dotfiles.git/blobdiff - zsh/.zsh/rc/015prompt.zsh
Splitted zsh rc files
[dotfiles.git] / zsh / .zsh / rc / 015prompt.zsh
diff --git a/zsh/.zsh/rc/015prompt.zsh b/zsh/.zsh/rc/015prompt.zsh
new file mode 100644 (file)
index 0000000..cdbd0fa
--- /dev/null
@@ -0,0 +1,21 @@
+function zle-line-init zle-keymap-select {
+    local state="%#" timer_val="?"
+    [[ ${KEYMAP} == vicmd ]] && state="+"
+    [[ $timer ]] && timer_val=$(( $SECONDS - $timer ))
+    prompt="%2~ "
+    prompt+="%U${timer_val}%u|"
+    prompt+="%B%?%b"
+    prompt+="%B%F{magenta}${state}%f%b "
+    PS1=$prompt
+    zle reset-prompt
+}
+zle -N zle-line-init
+zle -N zle-keymap-select
+
+preexec() {
+    timer=$SECONDS
+}
+
+precmd() {
+    printf "\a\033]2;\033\\"
+}