# powerline-go duration support zmodload zsh/datetime function preexec() { __TIMER=$EPOCHREALTIME } # Cursor based on mode if [ $TERM = "linux" ]; then _LINE_CURSOR="\e[?0c" _BLOCK_CURSOR="\e[?8c" else _LINE_CURSOR="\e[6 q" _BLOCK_CURSOR="\e[2 q" fi function zle-keymap-select zle-line-init { case $KEYMAP in vicmd) print -n -- "$_BLOCK_CURSOR";; viins|main) print -n -- "$_LINE_CURSOR";; esac } function zle-line-finish { print -n -- "$_BLOCK_CURSOR" } zle -N zle-line-init zle -N zle-line-finish zle -N zle-keymap-select # Also return to normal mode from jk shortcut bindkey 'jk' vi-cmd-mode # Edit command line autoload edit-command-line zle -N edit-command-line bindkey -M vicmd v edit-command-line # Additional history-substring-search bindings for vi cmd mode # TODO Doesn't work, as home-manager loads history-substring at the very end of the file # bindkey -M vicmd 'k' history-substring-search-up # bindkey -M vicmd 'j' history-substring-search-down