Situation
Recently I was investigating the behaviour of word motions in vim and to me it seems like ge
is grossly inconsistent with the other 3. Here is an example with ^
showing the cursor:
word1 word2 de: wo word2 dw: woword2
^
word1 word2 db: word1 rd2 dge: wordd2
^
It seems to me that dge
is inconsistent in 2 ways:
- It deletes the character the cursor is on (inconsistent with db)
- It deletes the last character of the previous word (inconsistent with dw)
What I tried
The following fixed the issue with leaving the character the cursor was on:
onoremap ge vge
And the following fixes the issue with leaving the last character on the previous word:
onoremap <expr> ge ":<c-u>normal! gel<cr>"
But I cannot find a convenient way to combine these two behaviours.
Question
How can I remap ge
so it behaves this way:
word1 word2 dge: word1rd2
^
Also, maybe my perception about ge
being inconsistent is wrong?
Would be very interested in hearing comments disputing that.