'What is the shortcut to delete last word in csh?
In bash, I use Ctrl + w to do so, but it is not working in my csh and instead of deleting a word, it is cleaning entire line. How to delete last word ?
Although Ctrl + u is working fine in both csh and bash.
I'm running csh inside screen (ubuntu).
Solution 1:[1]
This works for me with tcsh: ALT
+ BACKSPACE
. Hope that helped!
Solution 2:[2]
Solution 3:[3]
The action is named "backward-delete-word".
If you run the command >bindkey
in csh you will get all the keyboard shortcuts that apply to your shell.
You can >grep "backward-delete-word"
and you will get a result kinda like this:
>> bindkey | grep "backward-delete-word"
"^?" -> backward-delete-word
"^[^H" -> backward-delete-word
"^[^?" -> backward-delete-word
These results should be a combination of the default keybinds as well as custom ones if someone set them up.
I definitely have no idea what the first one means, but I can tell that ^[
means "meta-character", ^H
means ctrl+h (not ctrl+H which would be ctrl + shift + h) and ^?
means "backspace".
You can enter a meta character key by either pressing esc and letting go, or by pressing alt and keeping it pressed while you press on the other keys in the combination.
So the options that I (and probably you as well) have for delete-backward-word are:
alt+ctrl+h
esc->ctrl+h
alt+backspace
esc->backspace
and one mystery option.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | silverstreak |
Solution 2 | SajjadHashmi |
Solution 3 | Nimrod Weinberg |