Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

to

echo
very-long-string
> 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.

share|improve this question
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

2 Answers 2

up vote 10 down vote accepted

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.)

share|improve this answer

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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