问题
The following items are useful to me in editing text, and I was wondering if vim had something for this built out of the box (though I didn't see it on the https://vimhelp.org/index.txt.html#index.txt page), or I had to create mappings for it:
- Forward-delete a character. This is
X
in normal mode. - Forward-delete all text to the right of the cursor on the line. This is the inverse of
ctrl-u
.
Are either of these mappings available? And if not, are there 'standard' mappings for this that are common (for example, how it might be done in another unix program).
Note that this is the keyboard I have -- there is only one delete
key (which acts like a normal backspace key) and there is no backspace key:
Note: for forward-delete, I am currently mapping ctrl-d
as:
"Ctrl-d to forward-delete when in insert or command mode
noremap! <C-d> <Delete>
However, this interferes with the tab in insert mode (which I don't use) and the help-options in command mode (which I do use!) so I may have to modify this later, or hopefully someone suggests a better solution.
回答1:
though I didn't see it on the https://vimhelp.org/index.txt.html#index.txt page
If you can't find it in the documentation, then it doesn't exist.
You can use
fn+delete
for "Forward-delete a character"."Forward-delete all text to the right of the cursor on the line" is
ctrl+k
in MacOS, but Vim has its own use for that combo,:help i_ctrl-k
so it is up to you to create a mapping for it.Something like:
inoremap <key> <C-o>ld$
来源:https://stackoverflow.com/questions/62520603/insert-mode-default-keys-in-vim