I am aware of the startinsert
command which switch to insert mode as if the i
key was pressed. With the !
it behaves like A
.
Do you know if there is some kind of option to go to insert mode like we press the a
key?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityHere is a workaround with manually detecting if the cursor is at the end of the line :
if col('.') == col('$') - 1
startinsert! " `A`
else
normal l " `l`
startinsert " `i`
end
col('$')
is the last column + 1 so if the cursor is at the end of the line we must substract 1.
reference : https://stackoverflow.com/a/19544043/2558252 (thanks to the robert-audi comment)