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.
+1
A:
:set nowrap
There is also the linebreak
option that controls whether wrapped text is broken at word boundaries or not.
Greg Hewgill
2008-10-29 19:34:37
+2
A:
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.
m0j0
2008-10-29 19:36:57
map <F9> :set wrap!<cr>
Jeremy Cantrell
2008-10-29 19:53:24
I prefer this one. Great!
David.Chu.ca
2008-10-29 21:27:02
If you like my suggestion, then you know what you must do... wink wink nudge nudge (hint: my answer is listed below)
Jeremy Cantrell
2008-10-30 00:00:06
+4
A:
I think what you want is:
:set wrap!
This will toggle line wrapping.
More about using ! (bang) to alter commands can be found at:
:help :_!
Jeremy Cantrell
2008-10-29 19:49:24
A:
That's all great solutions. Thank you very much! One thing I realized that the scroll bar for horizontal scroll does not appear event there are some long lines beyond the screen. Maybe there is a different command to make it visible?
David.Chu.ca
2008-10-29 21:29:02