Automatic Text wrap in vi editor

Normally, In vi editor, when we write long lines. It reaches beyond the limit. To solve this , we use fold command, But fold command only work on already created file. No doubt it, wrap text upto specified width. But it effect  your text. Another way to wrap text is to use :set colorcolmn=72 after ESC in vi editor. Now this command put line at 72 width, you have to press enter , when 72 limit reaches. we can say, it s manual text wrapping. But these two are not very good, Because these does not provide atomatic text wrapping in any editor. Here I provide you soltion to set automatic text wrapping. In this case, you don’t have a need to press enter after 72 limit. It will place your cursor in next line when 72 lmit reaches.

Step for automatic text wrapping:

Open ~/.vimrc file

$ gksudo gedit ~/.vimrc

Add following line in ~/.vimrc.

set textwidth=72

Screenshot from 2016-01-30 21:15:30

Close ~/.vimrc file. To check text  wrap, create demo file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s