Open verhovsky opened 2 years ago
This is a niche enough use case that I'm unlikely to support it explicitly (the config is already much more bloated than I'd like). More complete support of vimscript is planned, but it'll be a while until autocmd
and such work well enough for that to work.
inoremap <Esc> <Esc>l
gets you close - it just moves your cursor to the right on the first column. There may be some clever way of getting around this; I'm not sure.
Evil (vim bindings for Emacs) has a dedicated evil-move-cursor-back
config option for this and it's also a somewhat common question on stackoverflow
so it's not that niche. I'm honestly surprised that I'm the first one to ask about this.
Another place where this matters and where it should also have an effect is when pasting text. If you copy some text like abcd
and move your cursor to be in the space between the words
hello world
^
then press p
then press C
you will delete the last letter you pasted
hello abc
^
So pretty much every time I paste something I have to press l
, whereas in Emacs using Evil with the above mentioned option, I don't.
This is long past, but I'd also really appreciate this functionality!
I just realized about this issue and is driving me crazy
chatgpt$ rewrite the evil-move-cursor-back function from emacs lisp into javascript. 🤣
To replicate, write a sentence like
then move the cursor to the end of a line and repeatedly type
i
,Esc
,i
,Esc
(i.e. enter and exit insert mode). The cursor will eventually end up at the beginning of the line instead of staying where it started.Describe the solution you'd like I would like a config option like
that would keep the cursor where it is when exiting insert mode (default to
true
).Describe alternatives you've considered I think I could use NeoVim integration because there's definitely ways of configuring it to behave this way, I think I do it with
autocmd InsertLeave * :normal `^
. See https://vim.fandom.com/wiki/Prevent_escape_from_moving_the_cursor_one_character_to_the_left#Programmatic_Alternative