Monday, January 27, 2014

Vim: Word Wrap and Disable Automatic New Line

Vim has many features and you can configure in the way you want to make the most of it. To wrap lines you need to change your vimrc file and also to disable the automatic new line behavior.

When you are typing text Vim will automatically insert a new line after the 80 column. This is not convenient and it's very annoying if you use Vim to write besides programming as I do.
Another nice feature is to have a left margin so text is not right next to the window border.

Here's my vimrc file:

" Word wrapping and disable new line automatically
set wrap
set linebreak
set nolist  " list disables linebreak
set textwidth=0
set wrapmargin=0
set formatoptions-=tc

" Margin between text and window's border
set foldcolumn=3

And here's how the text looks like with the new configuration:

I really like Vim and I use it on Mac, Unix and Windows because it's a very light weight editor and you can make Vim a full writing tool like WriteRoom, or al full programming editor to code and compile.
You can also try my Vim green on black background colour scheme if you like.


Post a Comment

Your opinion is very appreciated, thank you!