Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In zsh how do you bind Ctrl+backspace to delete the previous word?

Tags:

I'm trying to bind the command usualy binded to ^W with ctrl+backspace.

I have two problem here, one for each parameter of the bindkey command:

  • what is string to mean the ctrl+backspace
  • what is the command to delete the previous word
like image 826
psychoslave Avatar asked Jan 21 '14 08:01

psychoslave


People also ask

How do I change Ctrl Backspace?

That is, press the Ctrl key and hold it down, and press the Backspace key at the same time.

Why is Ctrl Backspace not working?

If these two keyboard functions are enabled, sometimes your backspace key cannot work fine. Follow these to turn off these two feature to get your backspace work again: 1) Type ease in the search box from Start. Then click Ease of Access keyboard settings.

How do I delete a word using command prompt?

Ctrl + Shift + ← (left arrow) highlights a word backwards. Then press Delete to delete the last word.

How do I delete a word in Ubuntu terminal?

Ctrl + U = Delete left of the cursor. Ctrl + K = Delete right of the cursor. Ctrl + W = Delete word on the left.


1 Answers

One may use:

bindkey '^H' backward-kill-word 

Note that on old versions of GNOME terminal, it won't work, see this related question and this bug report. As indicated bellow, this seems fixed in current version.

like image 163
psychoslave Avatar answered Sep 28 '22 01:09

psychoslave