Various shells apparently do not support ZLE_RPROMPT_IDENT=0 properly
and shift the cursor one to the left. As a result,
autocompleting leads to weird shifting of the user input and
'overlapping' text.
In order to fix this issue, it seems to be sufficient to set
ZLE_RPROMPT_INDENT=-1.
(see https://github.com/bhilburn/powerlevel9k/issues/110)
Apparently ZLE_RPROMPT_INDENT is a bit buggy on several prompts (e.g.
iTerm2, virtual-terminal on linux, etc) since not only the most right
space is removed as intended, but also the cursor is moved on to the
right causing the last character of the prompt to be overwritten.
This causes completion to be rather weird (some characters are
drawn twice and some aren't at all).
Fix: Use %{ .. %} with ${bottom_right_suffix} to tell the terminal the
last symbols have a width of zero -> the most right space will be
overdrawn and thus not shown.
The prompt now no longer requires "setopt promptsubst" and even has
a bit more functionality:
- show exitcode if not equal zero
- underlined hostname if remote-connected via ssh
- extra prompt symbol for root and different color username
- improved battery status (color + charge detection)
Furthermore time and username@hostname have been swapped.