Is there any command to toggle enable auto text wrapping?

Is there any command to toggle enable auto text wrapping?

By default, I think my vimrc setttings enable the auto-wrapping. However, sometimes, I would like to see text lines are not wrapped. Is there any command I toggle the text line wrapping enabled and disabled? This would avoid me to exit and to change settings.

Change tilde (~) color in Vim


Quicker way to enter ex mode in vim?
I think what you want is:.
How do I get Vim to treat underscores in a string as a word break?
:set wrap! 
This will toggle line wrapping..
what does ^A stand for in vim
More about using ! (bang) to alter commands can be found at:.
How to “apply” backspace characters within a text file (ideally in vim)
:help :_! 

Vim 7.2 hangs on startup, “killall vim” fixes it

What are the typical use cases for vi?


Vim: Combining autocmd?
In your vimrc, create a function such as this:.
:function ToggleWrap() : if (&wrap == 1) :   set nowrap : else :   set wrap : endif :endfunction 
Then map a key (such as F9) to call this function, like so:.
map <F9> :call ToggleWrap()<CR> map! <F9> ^[:call ToggleWrap()<CR> 
Whenever you press F9, it should toggle your wrapping on and off..


:set nowrap 
There is also the linebreak option that controls whether wrapped text is broken at word boundaries or not..


The quickref suggests (no)wrap.

74 out of 100 based on 84 user ratings 1334 reviews