I want to bind Control+Backspace in insert mode to delete a word. I'm able to bind Control+Del in both insert and normal modes, but I can only seem to bind Control+Del in normal mode. I've checked many other posts and none of the fixes worked for me.
- terminal vim
- Kubuntu 21.10
- Konsole 21.08.1
Even on 21.04 at some point after upgrading packages, Control+Backspace in insert or normal to delete a word stopped working.
I can confirm this does not work on archlinux with XTerm either.
Different things I have tried:
silent !stty -ixon
set encoding=utf-8
set fileencoding=utf-8
"let &t_TI = "\<Esc>[>4;2m"
"let &t_TE = "\<Esc>[>4;m"
"let &t_TI = ""
"let &t_TE = ""
:fixdel
I'm not sure what happened, but it used to work. This is my previous vimrc:
" (used to work before upgrading)
noremap! <C-BS> <C-w>
noremap! <C-h> <C-w>
inoremap <C-w> <C-\><C-o>dB
inoremap <C-BS> <C-\><C-o>db
This is what I have currently:
"delete previous word
"works-
nnoremap ^H db
"does not work(aggregate of different things i tried)-
inoremap <C-^?> sdsldkjfddjfkd
inoremap <C-BS> sdsldkjfddjfkd
inoremap <C-kBS> sdsldkjfddjfkd
inoremap <C-D> sdsldkjfddjfkd
inoremap <C-kD> sdsldkjfddjfkd
inoremap ^H sdsldkjfddjfkd
inoremap ^_^H sdsldkjfddjfkd
inoremap ^_^? sdsldkjfddjfkd
inoremap ^V^V^V^H sdsldkjfddjfkd
inoremap ^V^H sdsldkjfddjfkd
inoremap <C-h> sdsldkjfddjfkd
"this one works in insert mode, sending this text when pressing only backspace
inoremap ^V^? sdsldkjfddjfkd
"delete next word-working
inoremap <C-kDel> <C-o>dw
nnoremap <C-kDel> dw
vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 21 2021 08:39:53)
Included patches: 1-2434, 3402-3403, 3409, 3428
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 -perl +title
-clientserver +job +persistent_undo -toolbar
-clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak +python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape -lua -ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval +mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-MtnJpP/vim-8.2.2434=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -flto=auto -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lacl -lattr -lgpm -L/usr/lib/python3.9/config-3.9-x86_64-linux-gnu -lpython3.9 -lcrypt -ldl -lm -lm
neofetch
OS: Kubuntu 21.10 x86_64
Host: 82AU Lenovo Legion 5 15IMH05
Kernel: 5.13.0-19-generic
Uptime: 3 hours, 34 mins
Packages: 2338 (dpkg)
Shell: bash 5.1.8
DE: Plasma 5.22.5
Terminal: konsole
If the new version specifies a new way to bind these keys, how do we do it
Also, I am completely okay with Control+h in insert mode deleting a word back too; that's how it's currently working in normal mode.
Note: on konsole, keybindings are set to Default(XFree 4). The &t_TI
option to disable modifyOtherKeys
didn't do anything.
In vim, Control+Del sends ^[3;5~
while Control+Backspace sends ^H
.
In konsole: Control+Del sends ^[[3;5~
while Control+Backspace sends ^H
.
Control+Backspace works in vim-gtk(gvim) on the same machine. Should I manually configure konsole to send another sequence on pressing Control+Backspace? or is it stty
s fault? or xmodmap
? or vim?