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
around
      Line 4 starts here

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

:set sh?
sh=/bin/bash

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

link|improve this question

feedback

2 Answers

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

link|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
feedback

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.

link|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
feedback

Your Answer

 
or
required, but never shown

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