vim shows entire file in oneline

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

vim shows entire file in oneline

ping song
experts:
I just ran into a weird issue today...

when opening a log file in one of my server, It displays everything in one line, joined by ^J (ascii code 10).

g ctrl-g gives:
Col 32004 of 4999968-5005640; Line 1 of 1; Word 20 of 144087; Byte 32004 of 4999969

when I copy the same file into my local machine, and open it with vim here, it shows multiple lines.

Col 1 of 1736; Line 25 of 5672; Word 741 of 144087; Byte 66114 of 4999968

in both machine I use the same .vimrc. but the vim version is different.

in the server (running ubuntu 14.04): 

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:43:18)
Included patches: 1-52

in my local machine (running wsl in windows):
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 03 2019 13:04:21)
Included patches: 1-1967

is this a known issue that got fixed? I doubted it though.
please shed some light on this. thanks.

regards
ping

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAHyaFsXDWAcecnwj4kQRpxGVkf%2Br1DEdaQ9V7mcpPKEONRHpOw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: vim shows entire file in oneline

ping song
I found the cause, by binary search / test with my .vimrc
turns out to be this line:

set    fileformats=unix,dos,mac

funny that with it, in my server vim7.4 the log file was identified as "fileformat mac", and that caused the problem(everything in one line).
but with same exact configuration in my local PC vim8.1 , the same log file was identified as "fileformat unix", and I see multiple lines.

I wonder why? is this default behavior changed in vim8.1?





On Thu, Apr 16, 2020 at 12:14 AM ping song <[hidden email]> wrote:
experts:
I just ran into a weird issue today...

when opening a log file in one of my server, It displays everything in one line, joined by ^J (ascii code 10).

g ctrl-g gives:
Col 32004 of 4999968-5005640; Line 1 of 1; Word 20 of 144087; Byte 32004 of 4999969

when I copy the same file into my local machine, and open it with vim here, it shows multiple lines.

Col 1 of 1736; Line 25 of 5672; Word 741 of 144087; Byte 66114 of 4999968

in both machine I use the same .vimrc. but the vim version is different.

in the server (running ubuntu 14.04): 

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:43:18)
Included patches: 1-52

in my local machine (running wsl in windows):
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 03 2019 13:04:21)
Included patches: 1-1967

is this a known issue that got fixed? I doubted it though.
please shed some light on this. thanks.

regards
ping

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAHyaFsVtFeUKBWQaweV3hFFMhDsuMOAEKTdpEysN%3D0HSR4ZPLA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: vim shows entire file in oneline

Tony Mechelynck
On Fri, Apr 17, 2020 at 10:33 PM ping song <[hidden email]> wrote:

>
> I found the cause, by binary search / test with my .vimrc
> turns out to be this line:
>
> set    fileformats=unix,dos,mac
>
> funny that with it, in my server vim7.4 the log file was identified as "fileformat mac", and that caused the problem(everything in one line).
> but with same exact configuration in my local PC vim8.1 , the same log file was identified as "fileformat unix", and I see multiple lines.
>
> I wonder why? is this default behavior changed in vim8.1?
>
AFAIK this behaviour hasn't changed in a very long time (maybe since
the time when Vim first supported all three of DOS, Unix and Classical
Mac) but the bahaviour is known to vary between OSes. The fact that
your local machine runs Windows while your server runs Linux could
perhaps explain the difference. In general Vim for Windows is more
tolerant of quirky ends-of-lines than Vim for Unix is: for instance,
if a file has a CR+LF end-of-line on all lines except the last one,
Vim for Windows will accept it as a normal file (and usually fix the
"unterminated" last line) while Vim for Unix will show you a ^M
character at the end of every line except the last one. Maybe your log
has some ^M (carriage-return) characters not followed by a ^J (line
feed) somewhere, possibly near the beginning? Some programs
(including, for instance, the fsck filesystem-check program) use that
trick so that the line ending with CR but no LF will be overwritten by
the next line of output. Vim might in some cases confuse such a log
with a classical-Mac file.

I've never had a Mac but I've had a Windows machine long ago (after I
found about Vim though). I leave the 'fileformats' option at its
'nocompatible' default, which is "unix,dos" on Unix (or Cygwin or Mac)
and "dos,unix" on (native) Windows (or, once upon a time, DOS). I
don't have any problems with it.

For details, see
        :h 'fileformats'
        :h file-formats

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXu-nm%3DsbPMc%3De2vh0TL3AfPVm8gOEpMH%3DK3x58CZ7X_HA%40mail.gmail.com.