Reputation: 110482
In vim, I can use ctrl-u
to delete all characters to the left of my cursor in command mode. For example:
:hello |there
:|there
Is there a way to delete all characters to the right of my cursor? For example:
:hello |there
:hello |
If not, what might be a reasonable mapping to do this? The only thing I could think of is something a bit hairy, such as:
:onoremap <c-k> <Delete><Delete><Delete><Delete><Delete><Delete><Delete><Delete><Delete><Delete>...
Upvotes: 1
Views: 174
Reputation: 15196
cnoremap <c-k> <c-\>egetcmdline()[:getcmdpos()-2]<CR>
See :h c_CTRL-\_e
, :h getcmdline()
and :h getcmdpos()
.
Upvotes: 5