I wouldn't call it a bug. Looking at :h ge
this is said:
ge Backward to the end of word [count] inclusive.
Now let's see what inclusive means :h inclusive
A character motion is either inclusive or exclusive. When inclusive, the
start and end position of the motion are included in the operation. When
exclusive, the last character towards the end of the buffer is not
included. Linewise motions always include the start and end position.
This means, that ge will always include the character further to the beginning of the document, e.g. where the cursor jumps to. You can force it to be exclusive using the v
modifier (:h o_v
). But that means in this case only that the starting point will be excluded from the operation.
I gues what what you want, is something more like this map:
:onoremap <silent> <leader>ge :norm! ge <cr>
This will make it exclusive to the char where the cursor jumps to (e.g. the beginning of the visual selection). If you want both ends to be exclusive, you can use this mapping:
:onoremap <silent> <leader>ge :norm! vge oh<cr>
Note, that both mappings depend on your 'selection'
option to be at the default of inclusive
. For a truly robust mapping, you would have to save and restore that option and use a mapping that works under a defined option value.
If you want the mapping make use of a count, something like this should do it. (For better understandability let's make use of a function):
fu! MyCustomGE()
return "\<c-u>:norm! ".v:count1."ge "
endfu
onoremap <leader>ge :<c-u><c-r>=MyCustomGE()<cr><cr>
This way you can use ge
for the standard Vim behaviour and <Leader>ge
for your special case. See :h <Leader>
for the Leader key (default backslash)
ge
goes to the end of the last word, so it would also delete the end of the last word. – EvergreenTree Mar 9 '15 at 13:09b
instead. – Doorknob Mar 9 '15 at 13:54dw
does not delete the first letter of the following word. – Alexey Mar 9 '15 at 14:13b
deletes to the beginning of the previous word. My question is aboutge
. My usecase is an operation on what goes after the previous word. – Alexey Mar 9 '15 at 14:16wW
andbB
are "exclusive" motions buteE
andgegE
are "inclusive" motions. See:h exclusive
. – romainl Mar 9 '15 at 17:05