how to draw a line in vi at 80 columns
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > how to draw a line in vi at 80 columns




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    how to draw a line in vi at 80 columns  
wolverine


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-16-07 12:23 PM

Hi,
Is there any way by which i can make vi draw a line at 80
columns, so that i could see that i am about to hit  80 column limit. I
don't want to use word wrap at 80 columns. I want to see the straight
line at 80 columns.

Thanks in advance
Kiran.






[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Stephane CHAZELAS


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-16-07 06:18 PM

2007-01-16, 02:54(-08), wolverine:
> Hi,
>       Is there any way by which i can make vi draw a line at 80
> columns, so that i could see that i am about to hit  80 column limit. I
> don't want to use word wrap at 80 columns. I want to see the straight
> line at 80 columns.
[...]

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





[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Frank Cusack


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-17-07 12:27 AM

On 16 Jan 2007 02:54:55 -0800 "wolverine" <kiran.happy@gmail.com> wrote:
>       Is there any way by which i can make vi draw a line at 80
> columns, so that i could see that i am about to hit  80 column limit. I
> don't want to use word wrap at 80 columns. I want to see the straight
> line at 80 columns.

why not just set your terminal width to 80 columns.

-frank





[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Logan Shaw


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-18-07 12:28 AM

wolverine wrote:
> Hi,
>       Is there any way by which i can make vi draw a line at 80
> columns, so that i could see that i am about to hit  80 column limit. I
> don't want to use word wrap at 80 columns. I want to see the straight
> line at 80 columns.

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





[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
wolverine


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-18-07 06:32 AM

Logan Shaw wrote:
> wolverine wrote: 
>
> 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


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.

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






[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Logan Shaw


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-18-07 06:32 AM

wolverine wrote:
> Logan Shaw wrote: 
>
>
>                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





[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Thomas Dickey


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-07 06:18 PM

Logan Shaw <lshaw-usenet@austin.rr.com> wrote:

> 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





[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Giorgos Keramidas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-21-07 06:26 AM

Logan Shaw <lshaw-usenet@austin.rr.com> wrote:
>wolverine wrote: 
>
> 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.

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






[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Giorgos Keramidas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-21-07 06:26 AM

On Fri, 19 Jan 2007 14:03:38 -0000, Thomas Dickey <dickey@saltmine.radix.net> wrote:
>Logan Shaw <lshaw-usenet@austin.rr.com> wrote: 
>
> 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.






[ Post a follow-up to this message ]



    Re: how to draw a line in vi at 80 columns  
Thomas Dickey


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-22-07 12:22 AM

Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
> On Fri, 19 Jan 2007 14:03:38 -0000, Thomas Dickey <dickey@saltmine.radix.n
et> wrote: 
[vbcol=seagreen]
> 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.

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.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:56 AM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register