By Alvin Alexander. Last updated: March 30, 2024
vi/vim editor FAQ: How do I wrap long lines in vim?
Solution: “nowrap”
When you’re working with long lines, it can be easier to work with the file if the lines don’t wrap on the screen. This is when I usually use the “no wrap” feature of the vi (or vim) editor.
If you don’t want the lines to wrap in vi just type this command while you’re in command mode:
:set nowrap
That command tells vim not to wrap the lines. The result is that any line that was wrapped before will now scroll off the screen to the right.
If/when you want to return it to the default wrapping mode just type this command:
:set wrap