1

When I run the :sh command I see the following characters

enter image description here

If it is relevant, my default shell is zsh and it runs oh-my-zsh also
Thanks

5
  • Can you confirm the problem doesn't come from your vimrc?
    – statox
    Mar 5, 2019 at 11:09
  • using the default vimrc gives the same wired characters
    – jagjordi
    Mar 5, 2019 at 11:28
  • 2
    01;32m feels like color codes to me. and those box icons are glyphs not supported by your font. Have you recently changed your configuration? As in moved to a new font/terminal emulator/distro/copied someone's bashrc?
    – 3N4N
    Mar 5, 2019 at 12:32
  • I recently discovered the sh command and Is always been like this. bashrc is made by my, running an empty bashrc results in the same issue
    – jagjordi
    Mar 5, 2019 at 12:35
  • Whats the Vim version? (See Help->About)
    – Ralf
    Mar 6, 2019 at 5:55

2 Answers 2

3

You are doing this in GVim and this only provides a terminal with limited capabilities. The command echo $TERM returns "dumb". Might be your zsh /oh-my-zsh setup can't handle this.

It works for me (with bash) as my bash setups checks for terminal capabilities before configuring a colored PS1 or configuring colored output for ls or grep.

Vim 8.0.1609 added the guioption !, see :help 'go-!'. This provides a better terminal:

:set guioptions+=!

Then the "terminal" started by :sh supports colors.(tested with Vim 8.1.996 on Ubuntu: echo $TERM returns "xterm").

If you have Vim 8.0.747+, or better 8.1.x, you should use :terminal to start a terminal window inside GVim. See :help terminal.

If you are on an older version of Vim, you need to change your zsh setup to work properly on a dumb terminal. Google something like "zsh dumb terminal" or "oh-my-zsh dumb terminal".

6
  • I tried adding ! to guioptions but the problem persists
    – jagjordi
    Mar 5, 2019 at 23:16
  • @jagjordi Updated, added some version information.
    – Ralf
    Mar 6, 2019 at 6:37
  • @jagjordi try to set shell=/bin/bash and then run shell :sh
    – Alex Kroll
    Mar 6, 2019 at 6:40
  • @AlexKroll Do you want to write that in a own answer, or should I integrate it into my answer?
    – Ralf
    Mar 6, 2019 at 10:20
  • I am not sure. Your solution solves the issue of getting the wired characters to disappear, but maybe I should post another answer asking how to get zsh to work with :sh
    – jagjordi
    Mar 6, 2019 at 14:36
1

get this behavior when runing from a ssh from other station. It was due to bad interpretation of terminal code. changing the TERM variable solve the issue by limiting vi code used

TERM was set to 'linux' or 'xterm' to work

in my .bashrc and based on parent ssh process

# change terminal value for ssh (avoid weird char escape code in vi)
if [ $( pstree -s $$ | grep -c sshd ) -gt 0 ]
 then
   export TERM='linux'
 fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.