I've noticed while editing along a line in a .txt file in insert mode the cursor will move to the start of the line following a write using key sequence:
I'd like to change this behavior such that the cursor will stay in position following a :write. Is this possible? I don't need the cursor to remain in insert mode, I'd just like it to maintain its last position following a write.
I am using gVim 7.4 on windows. My .vimrc is very basic, I don't believe any of my settings interfere with this behavior. I have also removed sourcing of mswin.vim and example.vim from my .vimrc (as bundled with the official vim.org windows installer).
After reading the comments below I looked at the issue again and realized the cursor only slides to the far left after a write on lines which are entirely made up of trailing white space. In other words, the cursor only slides to the far left upon esc-:w when the line is a hanging indent with no other characters besides spaces. The .vimrc is handling indent behaviors with these settings:
set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab set autoindent
So, a new line created below an indented line will contain 4 trailing white spaces as the first 4 spaces of the line (which I want to keep). Upon the 'esc' key press the cursor slides to the far left of the buffer.
Is there a way to retain cursor position upon hitting 'esc' to return to normal mode, on a line made up of trailing white spaces (as indentation)?