Skip to content

Modification for making Ctrl+Backspace feasible on Linux/Cygwin.

License

GPL-3.0, Unknown licenses found

Licenses found

GPL-3.0
COPYING
Unknown
COPYING.DOC
Notifications You must be signed in to change notification settings

davidhcefx/GNU-nano-5.4_Bsp-enabled

Repository files navigation

GNU nano (5.4) - Bsp-enabled

build

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!

How it works

  1. 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 to chopwordleft already.
    • On some terminals, unfortunately, <Backspace> emits ^H, while <Ctrl+Backspace> emits KEY_BACKSPACE.
      (Although some of the terminals allow you to change the keycode emitted by <Backspace>)
  2. 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 for KEY_BACKSPACE.
    • ^Bsp: stands for ^H, also known as BS_CODE.
  3. 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! :)

How to compile

Please refer to README.GIT for more details.

  1. Install the dependencies: apt install autoconf automake autopoint gcc gettext git groff make pkg-config texinfo

  2. Run ./autogen.sh.

  3. After that, just do the normal ./configure and make; make install.

About

Modification for making Ctrl+Backspace feasible on Linux/Cygwin.

Topics

Resources

License

GPL-3.0, Unknown licenses found

Licenses found

GPL-3.0
COPYING
Unknown
COPYING.DOC

Stars

Watchers

Forks

Packages

No packages published

Languages