Whenever I press <<
or >>
in insert or normal mode, I lose the cursor position, as it always goes back to the start of the line. Is there a setting to fix this?
Here is where I am right now, but am having some trouble figuring out why the below isn't working in normal mode:
inoremap <leader>] <C-O>>>
inoremap <leader>[ <C-O><<
nnoremap <exp> <leader>] col('.') == 1 ? '>>' : "D>>A<C-O>P<Esc>`["
nnoremap <exp> <leader>[ col('.') == 1 ? '<<' : "D<<A<C-O>P<Esc>`["
vnoremap <leader>] >gv
vnoremap <leader>[ <gv