For Nano, is it possible to include 'Backspace' in a custom keyboard shortcut binding in the .nanorc config file?
I am looking to create a keyboard shortcut for the Nano text editor to remove the word to the left of the cursor using the key combination Ctrl + Backspace.
Is the key backspace able to be included in a custom keyboard shortcut in a .nanorc file? Here is an example of what I am looking to do, which contains an invalid 'key' entry ^Backspace
:
bind ^Backspace cutwordleft main
Here is some additional information from the nanorc v5 man page, wherein it mentions the 'Shift' key, but not 'Backspace':
The format of key should be one of:
^X where X is a Latin letter, or one of several ASCII characters (@, ], , ^, _), or the word "Space". Example: ^C.
M-X where X is any ASCII character except [, or the word "Space". Example: M-8.
Sh-M-X where X is a Latin letter. Example: Sh-M-U. By default, each Meta+letter keystroke does the same as the corresponding Shift+Meta+letter. But when any Shift+Meta bind is made, that will no longer be the case, for all letters.
FN where N is a numeric value from 1 to 24. Example: F10. (Often, F13 to F24 can be typed as F1 to F12 with Shift.)
Ins or Del.
Solution 1:
Typically a terminal application doesn't receive a "Backspace" the way GUI application does. It receives a control character, which it will interpret like backspace. The terminal emulator, which is a GUI application, does the job of translating from the GUI Backspace to the appropriate control code, and this can be configured in the terminal emulator's settings. The usual control codes for Backspace can be ^H
(the ASCII backspace character) or ^?
(the ASCII Del character). Press CtrlV and then Backspace while in your shell to see which one it is.