1833897 Members
1991 Online
110063 Solutions
New Discussion

Re: problem about "vi"

 
lin.chen
Frequent Advisor

problem about "vi"

Dear all,
I use "vi" to modify my file.
one line is too long,nearby 300 charactors
How can I make such message show in one line only?
Can I use export COLUMNS=400 or could you give me some suggestion?

Regards,Louis
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: problem about "vi"

Shalom,

vi does not as far as I use external variables.

You can set these values within the vi application.

There may be a configuration file you can change called .viminfo

In your home directory

http://unix.t-a-y-l-o-r.com/VRoptions.html

set all

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Victor BERRIDGE
Honored Contributor

Re: problem about "vi"

I believe its not a problem with vi...
You have a line with 300 char, if you on tha line type $ it will go at the last char...
Even if it displays it as on 5 lines its not silly...

You are asking to find a terminal capable of displaying 300-400 columns!
You find it vi will display...


All the best
Victor
Victor BERRIDGE
Honored Contributor

Re: problem about "vi"

Now more seriously did you have a look at the command pr? do a man pr to see if there is a beginning of solution....
blah2blah
Frequent Advisor

Re: problem about "vi"


is your value of wrapmargin set to zero?

wrapmargin (wm)
If this option has a value greater than zero, the editor will automatically "word wrap". That is, if you get to within that many spaces of the left margin, the word will wrap to the next line, without having to type return. For example, to set the wrap margin to two characters, you would type this: :set wm=2.
F Verschuren
Esteemed Contributor

Re: problem about "vi"

one line is as far I know not poseble but maybe you can ad a \ ad the end of the line and go on on the next line, that the script thinks is it on one line

Example:
echo test
can also written as:

ec\
ho \
te\
st

hoops this helps.
Bill Hassell
Honored Contributor

Re: problem about "vi"

vi can handle lines thousands of characters long. The line is being split by your terminal screen, not vi, unless wm is set to a non-zero value. To see that you have one line, position the cursor to the beginning of the long line using the number 0 (zero). Now type $ and the cursor will be positioned to the end of the line. If the long line has not been split, the cursor will jump to the end of the line (which be several screen lines down.

vi is not a formatting tool but your terminal will definitely affect how things appear. You can easily set Reflection/HP or Reflection/VT for 300 or more characters. However, you will need a 25" to 30" display to read the text.

If vi seems to be splitting your long lines, use this command in vi:

:set noai wm=0

and now long lines will not be automatically split.


Bill Hassell, sysadmin