Take for example,
" This is a line
How do I check if my cursor is after the first
"character or before it, if I'm in insert mode?
The reason I need this is because I have a
insert-mode keymapping that depends on the
:h virtcol() position of the cursor. If I use
<C-O>, the cursor goes to normal mode and in position after the character
", when if I use
<Esc>, the cursor goes to normal mode and in position before the character
". I could use
<C-o> to distinguish if the insert mode cursor was before or after the character
". But the problem remains if the line has only one character, i.e.
". And I have some other reasons I want to use
My if-else blocks has mainly two cases:
- If the insert-mode cursor is before any other character, insert a
- Otherwise, insert spaces.