Maximum line length in Vi

1328 views
Skip to first unread message

G. Ioannou

unread,
Apr 10, 1995, 3:00:00 AM4/10/95
to
Hello,

Does anyone know what the maximum line length is in Vi? I
was trying to edit my .newsrc file, when I noticed that the
buffer stopped at a certain group high up in the file,
after which there were ~'s to indicate end of file. The Vi
manpage mentions nothing about limitations (SunOS 4.1). I
found the following in the ed(1) manpage:

> LIMITATIONS
> The following limitations apply:
>
> 512 characters per line.
> 256 characters per global command-list.
> 1024 characters per filename.
>
> The limit on the number of lines depends on the amount
> of user memory: each line takes 1 word.

Do these restrictions hold for Vi, as well?

PS: I did manage to edit the file in Emacs, and could view it
using more or less. I haven't tried Vim yet.

--
George Ioannou
gi...@cam.ac.uk

Hans Mulder

unread,
Apr 11, 1995, 3:00:00 AM4/11/95
to
In <3mc0hk$n...@lyra.csx.cam.ac.uk> gi...@cus.cam.ac.uk (G. Ioannou) writes:

>Does anyone know what the maximum line length is in Vi?

1024 characters. That is, 1023 characters plus a newline.

>I was trying to edit my .newsrc file, when I noticed that the
>buffer stopped at a certain group high up in the file,
>after which there were ~'s to indicate end of file.

You should get a message at the bottom of the screen reading:

".newsrc" Line too long

When that happens, vi does not try to read the rest of the file.
If you type control-G in that situation, you get something like

".newsrc [Not edited] line 42 of 42 --100%--

If you edit the file anyway, the message changes to

".newsrc [Not edited] [Modified] line 42 of 42 --100%--

If you then try to exit using ZZ, you get a message

".newsrc" File exists - use "w! .newsrc" to overwrite

>The Vi manpage mentions nothing about limitations (SunOS 4.1). I
>found the following in the ed(1) manpage:

>> LIMITATIONS
>> The following limitations apply:

>> 512 characters per line.
>> 256 characters per global command-list.
>> 1024 characters per filename.

>> The limit on the number of lines depends on the amount
>> of user memory: each line takes 1 word.

>Do these restrictions hold for Vi, as well?

In vi, it seems to be:

1024 characters per line
128 characters per global command-list.
1024 characters per filename.

There is no hard limit on the number of lines, but vi keeps its edit
buffer in a disk file. If you try to edit too much, the disk gets full.

--
Hope this helps,

HansM

Jeff Burrows

unread,
Apr 12, 1995, 3:00:00 AM4/12/95
to
G. Ioannou <gi...@cus.cam.ac.uk> wrote:
>Hello,
>
>Does anyone know what the maximum line length is in Vi? I


1000 characters [?]
-Jeff.

G. Ioannou

unread,
Apr 12, 1995, 3:00:00 AM4/12/95
to

Following up to my own article, I'd like to add that I've now tried
the following editors on Slackware Linux for maximum line length:

ed
Vim
Vile

They all worked fine with lines over 2000 characters in length, but I
don't know the exact limit.

--
George Ioannou
gi...@cam.ac.uk

Paul Fox

unread,
Apr 17, 1995, 3:00:00 AM4/17/95
to
G. Ioannou (gi...@cus.cam.ac.uk) wrote:
: ed

: Vim
: Vile
: They all worked fine with lines over 2000 characters in length, but I
: don't know the exact limit.

lines on vile, at least, are limited by the size of an int.

anyone know what it is in vim?

paul

---------------------------------
paul fox, p...@foxharp.boston.ma.us (arlington, ma)


Tejasvi S Tomar

unread,
Feb 26, 2021, 10:21:34 PM2/26/21
to

Eli the Bearded

unread,
Feb 27, 2021, 2:07:28 AM2/27/21
to
In comp.editors, Tejasvi S Tomar <tst...@outlook.com> wrote:
> On Monday, April 17, 1995 at 12:30:00 PM UTC+5:30, Paul Fox wrote:

Over 25 years!

> > G. Ioannou (gi...@cus.cam.ac.uk) wrote:
> > : ed
> > : Vim
> > : Vile
> > : They all worked fine with lines over 2000 characters in length, but I
> > : don't know the exact limit.
> > lines on vile, at least, are limited by the size of an int.
> > anyone know what it is in vim?
> > paul
> > ---------------------------------
> > paul fox, p...@foxharp.boston.ma.us (arlington, ma)
>
> It seems there isn't any limit.
> https://www.oreilly.com/library/view/learning-the-vi/9780596529833/ch15s10.html

Paul likely isn't using that email address, that computer, that version
of vim. He's not reading or posting to this group, and he won't have
waited for your wrong reply.

The vim documentation describes the limits, same as vi's docs did when I
had a system with a complete vi man page.

With modern vim, finding the limitations documentation is as easy as

:help limits

which says:

Maximum line length 2147483647 characters. Longer lines are split.
Maximum number of lines 2147483647 lines.
Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
32 bits. Much more for 64 bit longs. Also limited
by available disk space for the |swap-file|.

Elijah
------
twenty-five years, wow, don't hear much about vile any more

Kenny McCormack

unread,
Feb 27, 2021, 2:22:14 AM2/27/21
to
In article <eli$21022...@qaz.wtf>,
Eli the Bearded <*@eli.users.panix.com> wrote:
...
>With modern vim, finding the limitations documentation is as easy as
>
> :help limits
>
>which says:
>
>Maximum line length 2147483647 characters. Longer lines are split.
>Maximum number of lines 2147483647 lines.
>Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
> 32 bits. Much more for 64 bit longs. Also limited
> by available disk space for the |swap-file|.

I wonder why these are all signed (32 bit) ints.

Why not make them unsigned, which would double these limits?

--
The last time a Republican cared about you, you were a fetus.

Lewis

unread,
Feb 27, 2021, 6:31:19 AM2/27/21
to
2^64 is as near to limitless as to make no difference since you will not have
1.8x10^19 bytes of storage available.

--
“Man, that’s a real shame when folks be throwin’ away a perfectly good white
boy like that.

Lewis

unread,
Feb 27, 2021, 6:32:30 AM2/27/21
to
In message <s1crv4$393mg$1...@news.xmission.com> Kenny McCormack <gaz...@shell.xmission.com> wrote:
> In article <eli$21022...@qaz.wtf>,
> Eli the Bearded <*@eli.users.panix.com> wrote:
> ...
>>With modern vim, finding the limitations documentation is as easy as
>>
>> :help limits
>>
>>which says:
>>
>>Maximum line length 2147483647 characters. Longer lines are split.
>>Maximum number of lines 2147483647 lines.
>>Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
>> 32 bits. Much more for 64 bit longs. Also limited
>> by available disk space for the |swap-file|.

> I wonder why these are all signed (32 bit) ints.

> Why not make them unsigned, which would double these limits?

Probably because no one cares about 4GB text files on 32 bit systems?

--
"A musicologist is a man who can read music but can't hear it." -
Sir Thomas Beecham (1879 - 1961)

Kenny McCormack

unread,
Feb 27, 2021, 9:27:28 AM2/27/21
to
In article <slrns3kbed....@m1mini.local>,
Lewis <g.k...@gmail.don-t-email-me.com> wrote:
...
>>>Maximum line length 2147483647 characters. Longer lines are split.
>>>Maximum number of lines 2147483647 lines.
>>>Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
>>> 32 bits. Much more for 64 bit longs. Also limited
>>> by available disk space for the |swap-file|.
>
>> I wonder why these are all signed (32 bit) ints.
>
>> Why not make them unsigned, which would double these limits?
>
>Probably because no one cares about 4GB text files on 32 bit systems?
^^^
???

Why not?

Anyway, the bittedness of the host system is irrelevant. Either you have
files that big or you don't.

To answer my own question, I imagine it is like a lot of things in Unix,
where in the early days, they just used int for everything, but with
hindsight, we can see that using unsigned would hvae been better.

P.S. It is a 2GB limit, not 4GB.

--
You are again heaping damnation upon your own head by your statements.

- Rick C Hodgin -

Lewis

unread,
Feb 27, 2021, 2:17:21 PM2/27/21
to
In message <s1dkse$39fb6$1...@news.xmission.com> Kenny McCormack <gaz...@shell.xmission.com> wrote:
> In article <slrns3kbed....@m1mini.local>,
> Lewis <g.k...@gmail.don-t-email-me.com> wrote:
> ...
>>>>Maximum line length 2147483647 characters. Longer lines are split.
>>>>Maximum number of lines 2147483647 lines.
>>>>Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
>>>> 32 bits. Much more for 64 bit longs. Also limited
>>>> by available disk space for the |swap-file|.
>>
>>> I wonder why these are all signed (32 bit) ints.
>>
>>> Why not make them unsigned, which would double these limits?
>>
>>Probably because no one cares about 4GB text files on 32 bit systems?
> ^^^
> ???

> Why not?

> Anyway, the bittedness of the host system is irrelevant. Either you have
> files that big or you don't.

And people do not generally have multi-GB text files.

> To answer my own question, I imagine it is like a lot of things in Unix,
> where in the early days, they just used int for everything, but with
> hindsight, we can see that using unsigned would hvae been better.

It doesn’t matter, systems now are 64-bit, and the file size limit is 2
billion lines of 2 billion characters each.


--
Nothing says poor craftsmanship more than wrinkled duct tape.

Eli the Bearded

unread,
Feb 27, 2021, 10:02:44 PM2/27/21
to
In comp.editors, Lewis <g.k...@gmail.don-t-email-me.com> wrote:
> Eli the Bearded <*@eli.users.panix.com> wrote:
>> The vim documentation describes the limits, same as vi's docs did when I
>> had a system with a complete vi man page.
>> Maximum line length 2147483647 characters. Longer lines are split.
>> Maximum number of lines 2147483647 lines.
>> Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
>> 32 bits. Much more for 64 bit longs. Also limited
>> by available disk space for the |swap-file|.
> 2^64 is as near to limitless as to make no difference since you will not have
> 1.8x10^19 bytes of storage available.

Yes, but you may very well have _lines_ 2147483648 bytes or longer.
Pretty rare, but certainly doable. Having files that are 2147483648
bytes or longer is somewhat common in this day and age. 2147483648 or
more lines is probably also rare but doable.

The original vi had limits that were much smaller for line length. I
don't know the limits for number of lines, but probably MAXINT.

Elijah
------
what is doable and what has been done frequently differ

Lewis

unread,
Feb 28, 2021, 8:51:01 AM2/28/21
to
In message <eli$21022...@qaz.wtf> Eli the Bearded <*@eli.users.panix.com> wrote:
> In comp.editors, Lewis <g.k...@gmail.don-t-email-me.com> wrote:
>> Eli the Bearded <*@eli.users.panix.com> wrote:
>>> The vim documentation describes the limits, same as vi's docs did when I
>>> had a system with a complete vi man page.
>>> Maximum line length 2147483647 characters. Longer lines are split.
>>> Maximum number of lines 2147483647 lines.
>>> Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
>>> 32 bits. Much more for 64 bit longs. Also limited
>>> by available disk space for the |swap-file|.
>> 2^64 is as near to limitless as to make no difference since you will not have
>> 1.8x10^19 bytes of storage available.

> Yes, but you may very well have _lines_ 2147483648 bytes or longer.

If you say so.

> Pretty rare, but certainly doable. Having files that are 2147483648
> bytes or longer is somewhat common in this day and age

Text files? No, that is not common.

--
Keep calm and 🎼Let it Go🎵

John McCue

unread,
Feb 28, 2021, 2:18:44 PM2/28/21
to
Lewis <g.k...@kreme.dont-email.me> wrote:
> In message <eli$21022...@qaz.wtf> Eli the Bearded
> <*@eli.users.panix.com> wrote:
<snip>
>
>> Yes, but you may very well have _lines_ 2147483648 bytes or longer.
>
> If you say so.

Actually I have seen files like his in the wild. There
is a Finance Server at work that generates multiple
Revenue Reports once per month that are multi-gig in
size. Line length rather small (~100 chars) with the
number of records being around 5**10 lines.

People do download these and how they read them is beyond
me (they are on windows), many years ago I used vim (v6 I
think) to get into one of the smaller ones for fun, it
took quite a while, but finally it loaded.

<snip>

John

Lewis

unread,
Feb 28, 2021, 9:25:26 PM2/28/21
to
In message <s1gqai$cdq$1...@dont-email.me> John McCue <jmc...@obsd2.mhome.org> wrote:
> Lewis <g.k...@kreme.dont-email.me> wrote:
>> In message <eli$21022...@qaz.wtf> Eli the Bearded
>> <*@eli.users.panix.com> wrote:
> <snip>
>>
>>> Yes, but you may very well have _lines_ 2147483648 bytes or longer.
>>
>> If you say so.

> Actually I have seen files like his in the wild. There
> is a Finance Server at work that generates multiple
> Revenue Reports once per month that are multi-gig in
> size. Line length rather small (~100 chars) with the
> number of records being around 5**10 lines.

So the opposite of what he said?

> People do download these and how they read them is beyond
> me (they are on windows), many years ago I used vim (v6 I
> think) to get into one of the smaller ones for fun, it
> took quite a while, but finally it loaded.

man split, perhaps?

I didn't say that no files over 2GB exist, I said they are not common.

--
'Pardon me for living, I'm sure.' NO-ONE GETS PARDONED FOR LIVING.

Lewis

unread,
Feb 28, 2021, 9:27:00 PM2/28/21
to
In message <87o8g4k...@usenet.ankman.de> Andreas Kohlbach <a...@spamfence.net> wrote:
> May be referring to binary usenet downloads. Any file is technically a
> text file, even hot_babes.mp4. :-D

No, binary files are not text files. Usenet "binary" files are text
encoded files and are much smaller than 2GB.

Binary files are not text files.

--
"Are you pondering what I'm pondering?"
"I think so, Brain, but if the plural of mouse is mice, wouldn't the
plural of spouse be spice?"
Reply all
Reply to author
Forward
0 new messages