Under FreeBSD’s xterm the following setting made vim delete the last word after pressing ctrl+ (“Control+Backspace”):

set backspace=indent,eol,start
inoremap <C-?> <C-W>
cnoremap <C-?> <C-W>

For whatever reason after the last system upgrade this does not work anymore. Instead it results in vim inserting ^? into the document.

It works as expected if vim is used inside of screen.


  • Pressing ctrl+v,ctrl+? in vim under xterm inserts ^[[27;6;63~.
  • Pressing ctrl+v,ctrl+? in vim under screen inserts ^?.

vim --version gives:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov 24 2019 15:10:11)
Included patches: 1-2237
Compiled by root@120amd64-default-job-19
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sysmouse    -tag_any_white
+arabic            +file_in_path      +mouse_urxvt       -tcl
+autocmd           +find_in_path      +mouse_xterm       +termguicolors
+autochdir         +float             +multi_byte        +terminal
-autoservername    +folding           +multi_lang        +terminfo
+balloon_eval      -footer            -mzscheme          +termresponse
+balloon_eval_term +fork()            +netbeans_intg     +textobjects
+browse            +gettext           +num64             +textprop
++builtin_terms    -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     +perl              +toolbar
+cindent           +job               +persistent_undo   +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           -python            +visual
+cmdline_info      +libcall           +python3           +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          +ruby              +wildmenu
+cursorbind        -lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con_gui    +mksession         +smartindent       +X11
+diff              +modify_fname      -sound             -xfontset
+digraphs          +mouse             +spell             +xim
+dnd               +mouseshape        +startuptime       +xpm
-ebcdic            +mouse_dec         +statusline        +xsmp_interact
+emacs_tags        -mouse_gpm         -sun_workshop      +xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary        
+extra_search      +mouse_sgr         -tag_old_static    

Any ideas how to fix this, so that ctrl+ in vim deletes the last word?


The ^[[27;6;63~ looks like xterm's modifyOtherKeys feature, which is not recent.

That's odd, because there was a recent change to vim in this area, but not to xterm. The question mentions this:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov 24 2019 15:10:11)

but does not mention the xterm version. The relevant changes in xterm were only for documentation (see FAQ How can my program distinguish control-I from tab?). The recent change to vim turns on the modifyOtherKeys feature of xterm. Bram addressed a problem with that in October (still later than "8.1").

  • xterm -version gives XTerm(351) – viuser Nov 30 '19 at 20:44
  • yes - but see the history - it's an "old" feature of xterm for which vim has recently altered its usage. – Thomas Dickey Nov 30 '19 at 20:56
  • I noticed another strange thing: the “bug” only occurs if an already existing file is opened by vim. It does not occur by simply executing vim and using the "[No Name]” buffer. In the latter case Ctrl-Backspace works as expected according to the definition in .vimrc. – viuser Nov 30 '19 at 21:03
  • Why is vim compiled with terminfo anyway? Isn’t FreeBSD still using termcap? – viuser Nov 30 '19 at 21:07
  • It's terminfo (ncurses) underneath for a long time, since the mid-1990s. vim uses the termcap library interface (also part of ncurses). But for the bug - asking on vim-users mailing list might get results. If there had been some related change to the xterm configure script, that would be a clue - but only screendumps and double-buffering have been promoted (made default) this year. – Thomas Dickey Nov 30 '19 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.