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.


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

  • 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.

  • 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 clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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