4

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?

0

Here 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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.