There's no such thing, you can see the ctlseq document doesn't have any single mention of the word word. There's also the question of what background color to use to erase and whether to shift what's to the right of the word to the left or not. You may have to consider words that are wrapped at the right margin of the terminal.
Some of your options are:
send as many BS characters as there are cells in the word you want to erase, followed by as many SPC (beware it uses the current background colour) followed by as many BS characters again (to move the cursor back again):
$ printf 'foo bar\b\b\b \b\b\b+\n'
foo +
that one should work on virtually all terminals.
same but use tput cub x (where x is the number of cells) to move the cursor back by that amount instead of using a sequence of BS. And you can use tput ech x to erase those cells (with the current background color or not depending on the terminal)
$ printf 'foo bar'; tput cub 3; tput ech 3; printf '+\n'
foo +
instead of tput ech x, you can use tput el to erase to the end of line, or tput dch x to delete x cells (and shift what's after that to the left).
(tput here is the shell interface to the terminfo database, the idea being to avoid hard coding escape sequences, use the equivalent for your language).
Looking at the backward-kill-word widgets of some shells (using script for instance to log their output), I see readline uses BS for motion and dch to delete, while zsh uses a combination of BS and cub and rewrite. tcsh seems to be doing some absolute column positioning (hba) and use dch to delete, ksh93 sends a CR and rewrites the whole line.
readlineorlibedit, orzlenot be an option in your case rather than reinvent the wheel? – Stéphane Chazelas Nov 27 '19 at 13:38zle). There is acommandIDin VSCode calledworkbench.action.terminal.deleteWordRightthat I can map to a keybinding. In other words, I don't need to useworkbench.action.terminal.sendSequenceto send an XTerm Control sequence for this particular operation. Thanks to both StéphaneChazelas and stolenmoment for your help! – Amelio Vazquez-Reina Nov 27 '19 at 16:49