Thanks in advance
Kiran.
If your vi is actually vim, you could do:
:syn on
:syn match Error /\%81v.*/
to visually mark (like white over red) text written past the
80th columns.
--
Stéphane
why not just set your terminal width to 80 columns.
-frank
It's not the most beautiful way to do it, but one way is to insert a
line of 80 characters to compare against:
o ESC 80 a x ESC
Then, delete that line later on when you're done editing.
If you want to check whether a given line contains more than 80 columns
of text, that's fairly simple. Just do this:
80 | 0 81 |
On any line 80 columns or shorter, those two "|" commands will go to the
same position. On a longer line, the second "|" command will move
further. You can turn the second number into something larger (like 90)
to make it easier to see the difference.
In some vi-compatible editors, like vim, you can just use control-G to
see what column you're in, which is a bit easier. Then you just need
to type "$ G" to see if the line is longer than 80 columns.
- Logan
I am using vim (VIM - Vi IMproved 6.3 (2004 June 7,
compiled Mar 22 2005 23:18:46)
When i gave the above command it gave error message "E319: Sorry, the
command is not available in this version". Any way, thanks for trying
to help me.
I think you must have misunderstood or entered it wrong. I am talking
about entering the letter "o", then hitting the ESCape key, then entering
the digits "8" and "0", then entering the letters "a" and "x", then
hitting the ESCape key again.
It works when I try it in vim 6.2.
- Logan
> In some vi-compatible editors, like vim, you can just use control-G to
> see what column you're in, which is a bit easier. Then you just need
> to type "$ G" to see if the line is longer than 80 columns.
iirc, "ruler" was first implemented in elvis (vim and vile do that).
It saves typing ^G's
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
It also works in nvi(1) here, but I'm not sure which vi breed had it
first.
Yep. It should even work in plain /usr/bin/vi in other systems too.
It's pretty much the same 'trick' I'm using when I have to edit the
source code of some script or other program with /usr/bin/vi on Solaris:
o ESC 72 a * ESC
Of course, one can always install vim or Emacs, and turn on their
automatic line-wrapping features, but that's another story :)
- Giorgos
A good changelog would be nice - nvi seems to lack that.
I only recall having seen it first in the MS-DOS port of elvis in 1992
or 1993, at least a couple of years before encountering nvi. I added it
to vile in August 1993 (according to changelog ;-). I don't have the
email from that time, which would have the discussion regarding elvis.
Anyway, it's a common feature of vi-clones lacking in the "real" vi's.
>>> iirc, "ruler" was first implemented in elvis (vim and vile do that).
>>> It saves typing ^G's
>
>> It also works in nvi(1) here, but I'm not sure which vi breed had it
>> first.
>
> A good changelog would be nice - nvi seems to lack that.
The file docs/changelog in the nvi 1.79 source distribution has one
mention of "ruler" under 1.34 -> 1.35 Wed Aug 31 19:20:15 1994:
+ Fix ruler to display logical column, not physical column.
> I only recall having seen it first in the MS-DOS port of elvis in 1992
> or 1993, at least a couple of years before encountering nvi. I added it
> to vile in August 1993 (according to changelog ;-). I don't have the
> email from that time, which would have the discussion regarding elvis.
The nvi 1.79 changelog only goes back to Mon Dec 20 19:52:14 EST 1993,
so it is probably safe to assume "ruler" was implemented in nvi before
that (otherwise its addition would be mentioned).
--
Geoff Clare <net...@gclare.org.uk>
>>>> iirc, "ruler" was first implemented in elvis (vim and vile do that).
>>>> It saves typing ^G's
>>
>>> It also works in nvi(1) here, but I'm not sure which vi breed had it
>>> first.
>>
>> A good changelog would be nice - nvi seems to lack that.
> The file docs/changelog in the nvi 1.79 source distribution has one
> mention of "ruler" under 1.34 -> 1.35 Wed Aug 31 19:20:15 1994:
I see (I was looking at 1.81, hadn't recalled where I had older code).
Looking in 1.76, I see a changelog (same info). But a comment in the
code implies ruler was in "4.4BSD", fwiw.
> + Fix ruler to display logical column, not physical column.
>> I only recall having seen it first in the MS-DOS port of elvis in 1992
>> or 1993, at least a couple of years before encountering nvi. I added it
>> to vile in August 1993 (according to changelog ;-). I don't have the
>> email from that time, which would have the discussion regarding elvis.
> The nvi 1.79 changelog only goes back to Mon Dec 20 19:52:14 EST 1993,
> so it is probably safe to assume "ruler" was implemented in nvi before
> that (otherwise its addition would be mentioned).
I guess neither Steven Kirkendall nor Keith Bostic is reading this
thread...
>>>>> iirc, "ruler" was first implemented in elvis (vim and vile do that).
>>>>> It saves typing ^G's
>>>
>>>> It also works in nvi(1) here, but I'm not sure which vi breed had it
>>>> first.
>>>
>>> A good changelog would be nice - nvi seems to lack that.
>> The file docs/changelog in the nvi 1.79 source distribution has one
>> mention of "ruler" under 1.34 -> 1.35 Wed Aug 31 19:20:15 1994:
> I see (I was looking at 1.81, hadn't recalled where I had older code).
> Looking in 1.76, I see a changelog (same info). But a comment in the
> code implies ruler was in "4.4BSD", fwiw.
>> + Fix ruler to display logical column, not physical column.
>>> I only recall having seen it first in the MS-DOS port of elvis in 1992
>>> or 1993, at least a couple of years before encountering nvi. I added it
>>> to vile in August 1993 (according to changelog ;-). I don't have the
>>> email from that time, which would have the discussion regarding elvis.
google shows me that elvis added this in version 1.5 (April 2, 1992),
and for reference, version 1.4 was August 4, 1991.
>> The nvi 1.79 changelog only goes back to Mon Dec 20 19:52:14 EST 1993,
>> so it is probably safe to assume "ruler" was implemented in nvi before
>> that (otherwise its addition would be mentioned).
Aside from a few comments that nvi is derived from an early version
of elvis, I don't see anything specific about _when_ that was.
However, comments here (and noting the changelog entry for nvi, which is
the same in the 1.49 tarball).
http://en.wikipedia.org/wiki/Nvi
http://en.wikipedia.org/wiki/USL_v._BSDi
make it seem likely that nvi was derived from elvis 1.5, rather than 1.4
Given a good changelog, one could get the proper information.
(Not specifically aimed at nvi/elvis - this is a problem with many programs).