How to wrap words in vi?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to wrap words in vi?
# 1  
Old 12-07-2010
How to wrap words in vi?

I just typed several long lines into vi but I only want it to have 80 columns. How can I set this in vi?
# 2  
Old 12-07-2010
For the new text:

Code:
:set tw=80

For the already inserted text:

Code:
:%!fold -w80

# 3  
Old 12-07-2010
set: no tw option: 'set all' gives all option values.

I've tried this already and found out it was for vim, not vi Smilie

":%!fold -w80" works, but it cuts off words. I don't want it to cut off words, but move it to the next line if there's no enough columns left for the word.
# 4  
Old 12-07-2010
Sorry,
so try:

Code:
:set wrapmargin=15

for existing text:

Code:
%!fmt -80

This User Gave Thanks to radoulov For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace particular words in file based on if finds another words in that line

Hi All, I need one help to replace particular words in file based on if finds another words in that file . i.e. my self is peter@king. i am staying at north sydney. we all are peter@king. How to replace peter to sham if it finds @king in any line of that file. Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies

2. Shell Programming and Scripting

Gawk gensub, match capital words and lowercase words

Hi I have strings like these : Vengeance mitt Men Vengeance gloves Women Quatro Windstopper Etip gloves Quatro Windstopper Etip gloves Girls Thermobite hooded jacket Thermobite Triclimate snow jacket Boys Thermobite Triclimate snow jacket and I would like to get the lower case words at... (2 Replies)
Discussion started by: louisJ
2 Replies

3. UNIX for Dummies Questions & Answers

Word Wrap

When I cat a file that has several hundred characters in a line, the right hand side is truncated. How can I make everything displayed on my screen word wrap? (6 Replies)
Discussion started by: bsimon
6 Replies

4. UNIX for Dummies Questions & Answers

line wrap in sed

I tried line wrap in sed by sed -l 20 ' n' and as far as i understand each long line would be split into lenght of 20 characters in each. but thats not happening.wats going wrong:confused: (5 Replies)
Discussion started by: mithun1!
5 Replies

5. Shell Programming and Scripting

Shell script to find out words, replace them and count words

hello, i 'd like your help about a bash script which: 1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel, 2.finds the link which leads to the download location of the Latest Stable Kernel version, (the right link should lead to the file... (3 Replies)
Discussion started by: alex83
3 Replies

6. Shell Programming and Scripting

Word wrap with sed

Hi, I got some timetable in a file but it is all mixed up like this 01:00 hgrtwhrt #104:00 tyergethr05:00 tqqrthd qrth #107:00 qhtrhqerth10:00 qerthrthqr qtrqthr qthrrt11:00 thqrthqrthrr rthgreth #212:00 trhrthrth14:00 wrthwrtwrqrthwrthwr #2116:00 trqhthtr: rthrthr17:00 rtwhtrhwrth rthwrt... (6 Replies)
Discussion started by: stinkefisch
6 Replies

7. AIX

Wrap Plug Test

Can someone show me on how to use DIAG command in doing a wrap plug test for fcs0 (FC Adapter)? (3 Replies)
Discussion started by: apra143
3 Replies

8. Shell Programming and Scripting

Wrap Interactive Script

Does anyone know of a program to wrap an interactive script into an application..I tried using platypus but i want a utility to allow interactive scripts to be run in a stand-alone window to avoid .profile settings on multiple computers...platypus provides the option of a text window output but... (0 Replies)
Discussion started by: meskue
0 Replies

9. UNIX for Dummies Questions & Answers

word wrap in vi

I am using vi to edit shell scripts, but whenever I get to the end of the line it goes to the next line, and when I run the script it considers whatever was placed onthe next line a new command...I guess this has to do with word wrap- how do I continue to write on one line? (3 Replies)
Discussion started by: dangral
3 Replies
Login or Register to Ask a Question