I hate the effect of the cursor going backwards after exiting insert mode when I have entered this mode using the i
key.
Is there an option that disables this?
If there is no such option then I also have an idea how to program this in lua, unfortunately neovim doesn't seem to have the right tools for this or I can't find them.
If I wanted to program it I would do it like this:
autocmd
on InsertEnter
. Then I would need a function that reads the last key pressed and saves it, but neovim doesn't seem to have such a function (correct me if I'm wrong). Then save a global variable with a flag (or maybe there is a better way).
The other solution is to use vim.keymap.set('n', 'i', function())
, where this function will save a global variable with a flag. Unfortunately I don't know how to call rhs
ie i
from this function, so that i
still enters insert mode, something like continue event in javascript after preventDefault
Then in both of the above cases, autocmd
would be set for InsertLeave
, which would check if the i
key was used to enter insert mode and if so, the cursor would be moved one field to the right.
Does anyone know if this is possible in neovim?
I'm looking for pure lua solution or as close as possible.