16

As I'm writing code, when the cursor reaches column 80, vim automatically wraps the text by inserting a newline character. How do I prevent vim from doing so? Is there any setting that am missing?

4

2 回答 2

18

The auto-wrapping is defined by set wrap and this option depends on the width of your window/screen, but it does not insert a newline character into the file.

The column 80 is defined by set tw=80 this will change the text by adding new linebreaks for long lines.

To check details, you can:

:h 'wrap'
:h 'tw'

To disable auto-wrapping, you could:

:set nowrap

To disable long line auto broken, you can:

:set tw=0

0 is default.

于 2013-03-31T00:11:59.143 回答
12

Just found that set tw=0 works. It doesn't wrap lines by inserting a new line character at a predefined limit.

Added that set to vimrc to make it permanent.

于 2013-03-31T00:15:50.123 回答