I would like to break a line (at the location of the cursor) in to two lines without leaving normal mode (entering insert or command-line mode). Is this possible?
I currently get to the location I want and hit 'i' to enter insert mode, 'enter' to break the line in two, then 'esc' to return to normal mode.
I am not trying to set a maximum line length or do any syntax or anything like that. I just want to break one line into two lines without leaving normal mode. 'J' joins the line the cursor is on to the line below it, which is handy. I want the opposite -- to break one line into two with a single command.
By default, Vim starts in “normal” mode. Normal mode can be accessed from other modes by pressing Esc or <C-[> .
Use c$ or just C to quickly change from the cursor to the end of a line, cc to change an entire line, or cis for a sentence. The standard change word command requires you to type cw , then a new word, then press Escape.
Press Enter to insert a blank line below current, Shift + Enter to insert it above.
Try this:
:nnoremap <NL> i<CR><ESC>
then just press Ctrl-J whenever you want to split a line.
I don't know of a single key command, but a lot of times I do "r" then "Enter" to break a line.
"r" replaces the current character under the cursor without going into insert mode. This may not be what you want if you don't want to replace a character...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With