Ответ на сообщение «Re: CRLF behavior with :!», присланное в 11:33:47 13 октября 2010, Среда. Отправитель: Gary Johnson:
Sometimes after I kill vim I get this stair-stepping in a terminal, but if I do
``stty onlcr'' everything gets fine (in zsh this can be fixed by putting
``ttyctl -f'' into .zshrc if you are interested. No calls to `stty' will be
required then). Try to examine ``stty'' output (without arguments), on my
machine it is
speed 38400 baud; line = 0;
erase = ^H;
-brkint ixoff -imaxbel iutf8
both inside vim (:!stty) and in terminal. If it changes, try to find why: here
``strace'' will be your friend, if I am not mistaking tty is controlled by
``ioctl'' system call, so you need to find on what event it is called.
By the way, does the output of the following command echo the same stepping
formation?:
:!stty -onlcr && ls -l
Текст сообщения:
> On 2010-10-13, Jürgen Krämer wrote:
> > Hi
> >
> > Jeenu wrote:
> > > I noticed that running commands like ':!svn info' from Vim in both
> > > Cygwin and Linux machines differ. On Linux machines, the output looked
> > > like how it's displayed in terminal. However, with Vim on Cygwin
> > > (PuTTYCyg client) I see no CR's, and the whole display take a stepping
> > > formation. Is these some option inside Vim which can control this
> > > behavior?
> >
> > sounds like a misconfigured PuTTY. In the Windows version there is an
> > option "Implicit CR in every LF" in the "Terminal" part of the
> > configuration dialog. Is this option present and checked?
>
> It's not just a problem with PuTTY; mintty does this, too, and there
> is no setting among mintty's options to correct this. No other
> application that I've run in mintty does this, just Vim. It's been
> one of those annoyances I just haven't had the time to investigate
> properly.
>
> I read this list using mutt on a machine running Cygwin. At the
> moment, I'm logged into that machine via from a laptop which is also
> running Cygwin. The terminal is mintty. From mutt, I can execute
>
> !ls
>
> and see a properly-formatted result. If instead I execute
>
> !vim
>
> and from within Vim execute
>
> :!ls
>
> I get the stair-stepped result reported by Jeenu.
>
> Also, the behavior is inconsistent. Again, I haven't taken the time
> to study this carefully, but sometimes the output from a :! command
> does have the proper formatting. It's as though Vim only sometimes
> forgets to include the CR.
>
> My workaround has been to pipe the output of :! commands through
> u2d, as
>
> :!ls | u2d
>
> OK, I just tried another experiment. I opened a new mintty terminal
> on the laptop--no ssh. "ls" works fine. I executed "less" on a
> file and within less, executed
>
> !ls
>
> Again, the formatting was correct. I then executed
>
> !vim
>
> and within the resulting Vim executed
>
> :!ls
>
> The formatting was correct! I executed the same ":!ls" command and
> the formatting was still correct. Then I hit Enter so that the
> output of the two ls commands was cleared from the screen and the
> cursor returned to the upper left corner of the Vim window. Then I
> executed
>
> :!ls
>
> again, but this time the output was stair-stepped!
>
> I exited vim, which returned me to less, and with less executed
> "!ls" again. The output was correctly formatted--no stair stepping.
>
> Since I haven't identified the root cause, it could be a problem in
> both mintty and PuTTY (I believe mintty is derived from PuTTY), but
> it certainly appears that Vim doesn't always set or reset something
> (the line discipline?) correctly. Mutt and less both appear to do
> this correctly.
>
> Regards,
> Gary
signature.asc
Description: This is a digitally signed message part.
