In my vimrc file, I have mapped CTRL-S in all modes to save my file. However I have a small problem.
Here is my .vimrc file:
Code:
nnoremap <C-s> :update<CR>
cnoremap <C-s> <Esc>:update<CR>
inoremap <C-s> <Esc>:update<CR>a
If I manually an indenting with the TAB key a few times and then hit CTRL-S, there are no problems.
But, I use C-indention (set cindent), so when I am writing code and I hit ENTER on certain lines, Vim will automatically indent me several tabs appropriately. When I have been indented automatically by Vim, and then I press CTRL-S, it will save but then Vim unindents my cursor.
I want to find a way to keep my cursor indented I hit save (after I have been auto-indented by Vim).