I often find myself bouncing on o or O and ctrl{ to insert blank lines and get back out of insert mode.
Thinking there must be a simpler way, and hoping to retain my cursor position, I hacked together these sloppy macros:
map <Leader>O :let cursorpos = getpos(".")<CR>:i<CR><CR>.<CR>:let cursorpos[1] = cursorpos[1] + 1<CR>:call setpos('.', cursorpos)<CR>
map <Leader>o :let cursorpos = getpos(".")<CR>:a<CR><CR>.<CR>:call setpos('.', cursorpos)<CR>
However, this doesn't allow for ranges. It would be nice to be able to go 5\O and get 5 blanks above my current line.
Any suggestions on how I can fix this to allow ranges and still return to the original cursor position when done?
For most writing, this is not a problem until you want Word to not create a new paragraph. Thankfully, there is a keyboard shortcut that moves to the next line. Move the text cursor to where you want the new line to begin, press the Enter key, hold down the Shift key, and then press Enter again.
To insert a blank line below the current line use :put , or :put! to insert one above. To specify where to insert the blank line (nth line) use :[n]put .
To exit from 'insert' mode, hit ESC (the escape key). If you want to force a quit (i.e. quit without saving) type: :q!
You can use :call append(linenumber, repeat([''], 5))
. It won't move the cursor.
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