The easiest way I've found to split lines in Vim is the normal mode command gq
(type both letters in quick succession in normal or visual mode):
- In visual mode, it will split whatever is selected.
- In normal mode, you follow
gq
with a motion.
For example, gql
will split one line to the currently set width. To set the width of the split lines to be different from your current setting, you can use
:set textwidth=<n>
Where n=number of characters you want in a line, e.g., 10, and change back to your normal width when you're done.
Got this information from a Youtube video by Kholidfu that shows how to join and split lines in normal mode using a motion: Vim Tutorial - Join and Split Lines.