By default, vim will wrap lines of text that flow off the viewable screen. Normally this isn’t such a bad thing. However, when you’re editing source code or reading log files this can become annoying.
It’s fairly simple to disable this options, a simple :set nowrap will disable wrapping for the current vim session.
Placing set nowrap in youre .vimrc will disable wraping for all vim sessions.
Finally, we can use maps to create a kind of toggle switch for wrapping.
In your .vimrc add :map < F2> :set nowrap! < CR>
Now, anytime you press F2, wrapping will be toggle on and off. You can still set your default preference in .vimrc, but now you can toggle between the two settings with ease.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
One Comment
Text wrapping really does get in my way sometimes when I’m editing scripts.