spaceship-prompt: vi-notification stuck in insert

Issue

All the vi mode keybindings work as expected. However, when I go into normal mode, my prompt stays in insert mode.

Screenshot

As you can see in the gif, I enter some words in insert mode. Then I hit esc to go into normal mode. I use b, e, dd, and p and the whole time the prompt says INSERT.

screenshot

Environment

Operating system: Linux Zeus 4.11.6-3-ARCH #1 SMP PREEMPT Thu Jun 22 12:21:46 CEST 2017 x86_64 GNU/Linux Terminal emulator: termite ZSH version: zsh 5.3.1 (x86_64-unknown-linux-gnu)

Relevant .zshrc

export ZSH=/home/marcel/.oh-my-zsh

ZSH_THEME="spaceship"
SPACESHIP_DIR_TRUNC=0
SPACESHIP_VI_MODE_SHOW=true
SPACESHIP_VI_MODE_PREFIX=""
SPACESHIP_VI_MODE_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"
SPACESHIP_VI_MODE_INSERT="[INSERT]"
SPACESHIP_VI_MODE_NORMAL="[NORMAL]"
SPACESHIP_VI_MODE_COLOR="white"

plugins=(git,vi-mode)

source "$ZSH/oh-my-zsh.sh"

for file in /home/marcel/.dotfiles/zsh/{exports,aliases,functions,secret}.sh; do
  [ -r "$file" ] && [ -f "$file" ] && source "$file";
done;

(hash wal 2>/dev/null && wal -r -t &)

DEFAULT_USER="marcel"

eval $(thefuck --alias)

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

bindkey -v

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

meu terminal quando o inicio já aparece: Warning! The 'vi_mode' section was not found. Removing it from the prompt.

Na linha que especifica os plugins, altere e deixe assim: plugins=(git spaceship-vi-mode)

I was able to work around this by adding the following line somewhere before promptinit:

spaceship_vi_mode_enable

@talescoelhocn hey, thanks for a question! That’s because we no longer bundle vi-mode with spaceship core, since v4.0. You can install it separately as an external section from here: https://github.com/spaceship-prompt/spaceship-vi-mode

@zer09 I copied a function from somebody for just the vi_mode, while rest of prompt is by spaceship.

In general, add the following before your autoload -U promptinit; promptinit

function zle-keymap-select() {
   zle reset-prompt zle -R
}
zle -N zle-keymap-select


autoload -U colors && colors
function vi_mode_prompt_info() { echo "%{$fg[red]%}${${KEYMAP/vicmd/[% NORMAL]%}/(main|viins)/[% INSERT]%}" }

RPS1='%t $(vi_mode_prompt_info)'
RPS2=$RPS1

Now, as I mentioned, this is a blind copy from dotfiles of somebody. I don’t have enough command over zsh to debug this if something goes wrong. However it works for me. What is better, it works alongside spaceship right hand side prompt too. As in, on my RHS, time is shown by spaceship, while vi_mode is shown by the above function.