71/dance

How can I make ctrl-w delete the last word in insert mode?

chtenb opened this issue · 5 comments

Similar question for ctrl-u to delete the whole line. I checked the wiki and existing issues.

Does binding deleteWordLeft to ctrl+w through the gui not work?

  {
    "key": "ctrl+w",
    "command": "deleteWordLeft",
    "when": "textInputFocus && !editorReadonly"
  },

Yeah, that works fine! I supposed I had to do some dance specific configuration, since I believe that this ctrl-w behavior is default in kakoune. Anyway, thanks for the answer and I hope this issue helps other people with the same question.

Correction: it does work, but also in normal mode. That means you can't use ctrl-w to close a tab anymore in normal mode.

71 commented

If you want this to only work in insert mode, you can use

  {
    "key": "ctrl+w",
    "command": "deleteWordLeft",
    "when": "textInputFocus && !editorReadonly && dance.mode == 'insert'",
  },

It could easily be added as a default keybinding in Dance, but AFAIK it's not a keybinding in Kakoune (except in : prompts).

Yeah, that works very nicely. Thanks for providing that filter.

but AFAIK it's not a keybinding in Kakoune (except in : prompts).

I'm not a kakoune user myself (coming from vim) but I read it somewhere. It must have been about the : prompt then.