Ctrl + Backspace is a modern keybinding that has already been widely supported in most browsers, text editors, search bars, file explorers, etc. However, the nanorc
file has very limited adjustabily on keybindings, so it's time for us to compile it ourselves!
-
From the nanorc manual, it read that:
If your terminal produces ^H for <Ctrl+Backspace>, you can make <Ctrl+Backspace> delete the word to the left of the cursor by rebinding ^H to this (chopwordleft) function.
- If this is your case, then congratulations! You can map
^H
tochopwordleft
already. - On some terminals, unfortunately,
<Backspace>
emits^H
, while<Ctrl+Backspace>
emitsKEY_BACKSPACE
.
(Although some of the terminals allow you to change the keycode emitted by<Backspace>
)
- If this is your case, then congratulations! You can map
-
In order to switch back the reversed mapping above, we need to be able to map the key
<Backspace>
.To do so, I added two keys in global.c that can be bounded.
Bsp
: stands forKEY_BACKSPACE
.^Bsp
: stands for^H
, also known asBS_CODE
.
-
After compilation, we could then put these lines in our
.nanorc
:set rawsequences bind ^H backspace main bind Bsp chopwordleft main
and finally make
<Ctrl+Backspace>
delete the word before the cursor! :)
Please refer to README.GIT for more details.
-
Install the dependencies:
apt install autoconf automake autopoint gcc gettext git groff make pkg-config texinfo
-
Run
./autogen.sh
. -
After that, just do the normal
./configure
andmake; make install
.