2

In zsh shell, I am having the following issue. After I press a command in command prompt, it is repeated in second line and also there's an ineligible character as well.

Command prompt Screen-shot

I run zsh in Guake. Here's my .zshrc:

a TERM="screen-256color"

# install zsh antigen
source /usr/share/zsh-antigen/antigen.zsh

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle debian
antigen bundle autojump
antigen bundle cp
antigen bundle colorize
antigen bundle command-not-found
antigen bundle git
antigen bundle zsh-users/zsh-syntax-highlighting
# Set Home for VirtualEnvWrapper
export WORKON_HOME="$HOME/.config/virtualenv"
antigen bundle virtualenvwrapper
antigen bundle tmux
antigen bundle littleq0903/gcloud-zsh-completion

# Tell antigen that you're done.
antigen apply



# using system powerline
source /usr/share/powerline/bindings/zsh/powerline.zsh
export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist noma' -\""

I started removing line by line to check, which one is causing the issue. I believe its the "antigen use oh-my-zsh".

Another pain point: I tried a lot tmux.conf, but it just didn't work the only thing that worked is this and tmux=tmux -2.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
rafee
  • 152
  • 6
  • 1
    It will most be your terminal configuration – Raman Sailopal Aug 18 '17 at 09:14
  • Probably zsh issues an escape sequence that's not understood by your terminal emulator. Guake is pretty much the only terminal emulator left that's still using an ancient (6 year old) and unmaintained version of VTE (the widget doing the actual terminal emulation). About a dozen other VTE-based terminal emulators all managed to upgrade to use the newest version thereof. I recommend you to consider switching to one of them. – egmont Aug 18 '17 at 10:44
  • I tried the regular emulator, but the issue persists. But the issue is not available in bash. My zshrc is pasted in this link https://pastebin.com/ZbTemhyi – rafee Aug 18 '17 at 11:02
  • I started removing line by line to check, which one is causing the issue. I believe its the "antigen use oh-my-zsh" – rafee Aug 18 '17 at 11:25
  • Hmm, indeed. It seems to print the base command name enclosed between `ESC k` and `ESC \ ` which VTE does not understand. According to https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html, it is used by `screen` to set the Title Definition String. – egmont Aug 18 '17 at 13:03
  • For the record, `xterm` doesn't understand this sequence either, it prints the string enclosed within, without those weird box characters. E.g. you'd still see `gcloudNAME [...]` in the first line of the command's output. – egmont Aug 18 '17 at 13:07
  • I believe the issue is related to you setting `TERM=screen-256color` in the top of your `.zshrc`. Set a `screen`-related `TERM` if and only if you are inside `screen` or `tmux`, not when directly in Guake or other emulator. – egmont Aug 18 '17 at 13:08
  • actually that's my another pain point. I tried a lot tmux.conf, but it just didn't work the only thing that worked is this and "tmux=tmux -2" – rafee Aug 18 '17 at 13:26
  • by the way after changing antigen use oh-my-zsh the issue is resolved – rafee Aug 18 '17 at 13:39
  • 1
    I am absolutely sure now, this is being caused by oh-my-zsh. As my auto completion weren't working with loading oh-my-zsh base, I had to uncomment the line and the issue reappeared. – rafee Aug 18 '17 at 13:59

1 Answers1

1

Those kind of issues arise when something is printing stuff to stdout when they shouldn't, and thus usually messing up either Zsh Line Editor's prompt or the command output. The offending print is probably done from a hook function that the Line Editor runs when a user command is run. You may be able to find the offending print/echo call by searching through the hook function bodies:

whence -f precmd $precmd_functions preexec $preexec_functions

Those are hook functions documented in http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions.

As mentioned in previous comments, the offending print/echo call is probably a failed attempt to speak with the terminal rather than to print to stdout. Normally I would "if out" the offending line of code by something like:

if [[ $TERM != guake ]]; then
    print -n "\E]..."
fi

but it seems that Guake is not setting the TERM properly. Hopefully you can figure out some other way to detect which terminal is running. Or perhaps just clear/modify those functions and function arrays in your .zshrc.

jmalmari
  • 11
  • 2
  • Thank you for the suggestion. But I can't try this anymore as I switched from oh-my-zsh – rafee Sep 14 '17 at 14:54