One of the most annoying features of vim is splitting lines. For some reasons someone found it would be good to split lines even in whitespace sensitive formats. For example changing:

echo very-long-string > file


> file

How to turn it off?

Edit: It is not visual wrap - it is wrapped in file (i.e. vim inserts \n in file if it considers line too long). Wrapping long lines is sane and while one may want to turn of I can live without it.

  • 2
    Try moving your .vimrc to the side and then opening a non-mangulated copy of your file. Vim shouldn't be adding newlines just because it thinks they should be there. – pboin Dec 31 '10 at 17:36
  • Does the very-long-string contains invisible characters like 0x10 and 0x13 ? As pboi wrote, vim doesn't add characters. – Luc M Dec 31 '10 at 18:36
  • Find what textwidth is set at: :set Make it wider: :set textwidth=160 – yf liang Jun 14 at 22:57

set formatoptions-=tc

See :help fo-table for more info.

Wim's suggestion of set textwidth=0 should have the same effect, though a lot of annoying filetype plugins will undo that for you. (Ugh.)


I assume you are talking about the feature where long lines are visually "wrapped" to be shown on multiple lines. (This does not interfere with the content of the file though, it is just the way the text is presented visually.) Issue the following command to turn of this feature:

:set nowrap

If you are seeing that vim is really splitting lines automatically (not just visually but by actually inserting line breaks) then you must have configured vim to limit text width; this is not enabled by default. In that case you can disable it again like this:

:set textwidth=0

Edit your .vimrc configuration file to make these changes permanent.

  • No - I mean wrapped in file (even it is intended properly). Wrapping visualy is quite sane. Wrapping in file is imho insane for source/configuration files with few exceptions. – Maciej Piechotka Dec 31 '10 at 16:45
  • it seems that it is enabled on gentoo as my .vimrc contains set backupdir=/tmp only.. – Maciej Piechotka Jan 1 '11 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.