Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Vim via MinTTY under Cygwin. When I issue a command like

:!ls -la

the displayed output doesn't show newlines correctly. It rather just jumps to the virtual column of the next line, where the previous output ended, like this:

This is line 1
              This is line 2
                            This line wraps
      Line 4 starts here

Has anyone an idea, what causes this behaviour? Some settings:

:set sh?

:set shellpipe?
shellpipe=2>&1| tee

they were never touched by me. Vim is started with '-X -T xterm-256color', but that doesn't seem to play a role.

share|improve this question
up vote 1 down vote accepted

Looks to me like it's because of the line-ending differences. Vim is defaulting to DOS-style CR/LF line endings. But when you're running the commands, you are seeing only the LF.

I know this doesn't make any sense.

But I'd be interested in seeing what happens if you :set shellpipe?=2>&1\|unix2dos\|tee and then :!ls -la

share|improve this answer
I'm under Linux right now, but I'll test it as soon as I'm back to a Windows machine. – Boldewyn Sep 24 '10 at 11:59

I've seen something similar when vim is trying to do smart indenting. Try using the paste buffer :!a because this does not do smart indenting.

share|improve this answer
Hm. It seems to be more like a MinTTY+screen+bash issue. I tested under Debian with the same .vimrc and vim version, and everything works fine. On the other hand, even the midnight commander has this strange behaviour, when I issue a ls -la there. – Boldewyn Sep 23 '10 at 14:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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