Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to do the right thing and put my key bindings into ~/.inputrc.

However, it turns out that I have to change

bind '"\e\C-j":"\e[1~quiet \e[4~\n"'

into

"\e\C-j": "\eOHquiet \eOF\n"

Now \eOH (nav-block-pos1 bound to beginning-of-line) and \eOF (nav-block-end bound to end-of-line) are themselves bindings in my configuration which I possibly cannot always rely on.

So the main question is why does binding to num-block-pos1 (\e[1~) and num-block-end (\e[4~) work with bind but not in my ~/.inputrc?


Edit:

The whole thing is getting even more complicated, now that I realized that \e\C-j only works for Gnome Terminial (or probably xterm as well, who knows...).

For my TTY it has to be

"\e\C-m": "\e[1~_quiet \e[4~\n"

So is it that various VTs have different implementations of how to interpret keys or what?

share|improve this question
    
This is documented in the GNU Readline User Interface manual, section 1.3. The keymap option is used to set what kind of key representation is used in key bindings definitions. Relevant information: superuser.com/questions/286781/… cnswww.cns.cwru.edu/php/chet/readline/rluserman.html#SEC9 wiki.archlinux.org/index.php/Readline –  Ярослав Рахматуллин Dec 5 '12 at 0:09
    
@ЯрославРахматуллин How exactly is this relevant to the difference in behavior between using bind and using inputrc for the actual binding. Should they not use the same settings? –  user173944 Dec 5 '12 at 6:15
add comment

1 Answer

Your terminal emulator can operate in one of two modes: application mode, and cursor mode (see http://homes.mpimf-heidelberg.mpg.de/%7Erohm/computing/mpimf/notes/terminal.html). It depends on what mode your particular application runs in that determines what escape sequence you need to send.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.