问题
This key binding escapes me. It is the same as emacs Ctrl+D
and I've tried Googling such things as "delete one character to the right," "forward delete," "delete next character", etc.
Here are the bindings in phpstorm which I assume is pretty similar to Webstorm.
Any idea what this action would be called?
Note this is what fn+delete
does on mac. If there were a way to reverse engineer this keybinding and see what function is actually called in Webstorm, that would work. I asked how to reverse engineer bindings here.
回答1:
It is buried a bit but, under the WebStorm menu, Preferences..., Keymap (under IDE Settings). Scroll to the bottom of the window until you get to Other. Click the triangle to expand. Scroll down until you get to Delete, double click it and assign it Control D. WebStorm might warn you that the key stroke is already assigned and gives you the option to remove the other command. That's it. Made me happy to find it as well.
回答2:
If you enable emacs mode this will be enabled.
Settings > Keymaps > click dropdown > emacs.
回答3:
Why not record a keystroke macro that shifts the caret one place to the right and then deletes a character. Or even one that simply does Fn + Delete
if you're on a Mac.
- To record a macro it is
Edit > Macros > Start Macro Recording
. - To assign a shortcut key combo to a macro use
File > Settings > Keymap > Macros
.
I appreciate this is not quite what you're asking, but is maybe a good workaround if there is no a way to get to the underlying key binding.
回答4:
On recent version of WebStorm (I have 2019.1), the way to do this is to add ^D (control-D) as a second keyboard shortcut to the existing Delete function (the one that is run by the delete key). Somehow with this combination, WebStorm knows to delete the character to the left with the 'delete' key, but delete the character to the right with the '^D' key. (I also removed the ^D keyboard mapping for my Run Debug function.)
来源:https://stackoverflow.com/questions/21095392/delete-one-character-to-the-right-in-webstorm