I'm trying to set up normal mode mappings to make it easy to add white space around the cursor:
<C-h>
will add one space to the right of the cursor;
<C-j>
will add a newline below;
<C-k>
will add a newline above;
<C-l>
will add one space to the right of the cursor; and
<C-Enter>
will add a newline at the current cursor position.
I also want the cursor position not to move during the command. For left, right, and newline, this is simple:
nnoremap <C-h> i <Esc>l
nnoremap <C-l> a <Esc>h
nnoremap <C-^M> i<CR><Esc><Backspace>
but for above and below, the corresponding commands
nnoremap <C-j> o <Esc>k
nnoremap <C-k> O <Esc>j
will get me back on the right line, but not back to the same column that I was on before.
Is there any way to return to the cursor position I was at just before entering insert mode? My best Google-fu only brought up references to ''
& double-backtick (can't figure out how to format the markdown there) and :jumps
/ <C-O>
& <C-I>
, neither of which seem to work quite the way I'd like.
Can this be solved without Vimscript? Can it even be solved with Vimscript?