My terminal emulator in which I use vim is alacritty, and I want the key combination control + backspace to do the same that control + w does when in insert mode (i.e. delete the entire last word). So far I've tried to add imap <C-Back> <C-W> to my .vimrc which however doesn't seem to change anything. Does someone have an idea how to achieve the desired behaviour?

The terminal emulator I'm using is alacritty, os is arco linux.

  • Usually, vim is not able to distinguish between Ctrl+Backspace and just Backspace, so this might be the reason why this is happening. There are features that make distinguishing between these possible (see :help modifyOtherKeys), but that depends on the exact terminal you're using. Maybe edit your question to give more information about your setup, which O.S., which terminal emulator, etc.
    – filbranden
    May 13, 2022 at 14:58
  • @filbranden ok, I've edited my question
    – Richard
    May 13, 2022 at 15:17
  • 1
    Note that backspace is spelled <BS> in :help key-notation, so you would need <C-BS>
    – D. Ben Knoble
    May 13, 2022 at 17:39
  • 1
    @D.BenKnoble thanks for pointing out, I've already tried out both.
    – Richard
    May 13, 2022 at 17:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.