# GNUs screen, nano & the End key



## nicky (Mar 31, 2019)

Hello good people of FreeBSD

With all major problems fixed on my systems, in no large part with the help of this forum, I now turn to you with a most annoying matter. A problem of key bindings. I'm using the text editor editors/nano for simple stuff, and GNUs sysutils/screen on the servers.

I like to use the Home and End keys in nano, and when opening nano from the console of a system, from x11/qterminal with xorg or through SSH, all is good, meaning that pressing the End key in nano takes the cursor to the end-of-line. shells/bash is used as the shell, and all the systems is current 12.0 and fully upgraded, both base and ports.

But when opening nano through screen, from the very same systems, the End key does not work. The error in nano is displayed in Danish, but I suppose the English version would be "Unbound key". nano has a shortcut to move the cursor to the end-of-line, CTRL+e / ^-e, but to be honest I find using the End key is much easier, in no large part because I use it in other editing programs. This is one aspect of the onset of old age I can't run from; things should work as they used to.

The systems do have a nano RC file, but it does not sets any custom key bindings. screen does not have a RC file. Different resources on the Internet lists different solutions, but so far without the desired effect.

And besides, it's one of those things that has my curiosity piqued, so I would really like to know why it isn't working, or more precisely, what the difference for nano is, depending on how it is started.


----------



## Deleted member 48958 (Mar 31, 2019)

nicky said:


> I'm using the text editor editors/nano for simple stuff, and GNUs sysutils/screen on the servers.
> 
> I like to use the Home and End keys in nano, and when opening nano from the console of a system,


Better try to use sysutils/tmux instead of sysutils/screen, it's also a "terminal multiplexer",
but it is much more configurable and usable, IMO. It's possible to configure tmux using ~/.tmux.conf,
here is my tmux.conf, for example. Home/End keys should work fine in tmux.


----------



## argwings (Mar 29, 2022)

Termcap is confusing. `set rawsequences` in /usr/local/etc/nanorc should  fix it.


----------



## grahamperrin@ (Apr 4, 2022)

argwings said:


> … `set rawsequences` in /usr/local/etc/nanorc should  fix it.



I have keys working as required, probably thanks to entries in my ~/.cshrc

I can't visualise what's done with sysutils/screen (sorry); would ~/.cshrc not apply?


----------



## argwings (Apr 4, 2022)

Thanks for the tip. I didn't look at it too closely since it's kind of intermittent. I can't seem to reproduce with oksh from ports.


----------



## argwings (Apr 4, 2022)

Problem seems weirdly intermittent.


----------



## argwings (Apr 5, 2022)

Hm. I think the terminfo-db package would normally fix this, but bash seems to be a weird one. And I imagine there's a possibility of a clash with the ncurses from ports. Not sure. The double message above was me being confused when it worked again without the option. I actually had this problem a while ago but it magically fixed itself, and reappeared recently.

oksh links directly to base, though.


----------

