You are not logged in.

#1 2012-03-21 20:31:03

rhodie
Member
Registered: 2012-03-19
Posts: 45

[Solved] Enabling readline commands

In other distros I've always been able to hit, for example, alt-b to jump to the beginning of a word at the command line (emacs mode).  It's not currently enabled in my arch install.  What do I need to do to enable it?  Alt-b currently produces â.

I'm using xterm with ratpoison window manager.  I've copied my previous /etc/inputrc, but it didn't seem to make a difference.  (Didn't have ~/.inputrc previously).  readline-6.2.002-1 is installed.

Last edited by rhodie (2012-03-21 23:55:39)

Offline

#2 2012-03-21 20:43:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

Have you read the Readline page on the wiki?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2012-03-21 20:48:00

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

Yes.  It's about how to use it, not how to enable it.  It seems to assume that it's enabled by default, which is what I had also assumed.

Edit to add: I wonder there's an xorg package I need.

Edit: strike that, it should work without Xwindows, I believe.

Last edited by rhodie (2012-03-21 20:54:26)

Offline

#4 2012-03-21 20:55:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

Do you have an entry in your inputrc (either in /etc or ~) for Alt-b? Please paste the file(s) you are using.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2012-03-21 20:58:17

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

I don't have an ~/.inputrc.  This the /etc/inputrc that I copied from my fedora installation.

# do not bell on tab-completion
#set bell-style none

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on

$if mode=emacs

# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# commented out keymappings for pgup/pgdown to reach begin/end of history
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word

# for rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word

# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif

Offline

#6 2012-03-21 21:00:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

So do all those binds work? Becuase if it is just the Alt-b that doesn't, it isn't in that file...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2012-03-21 21:07:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,822

Re: [Solved] Enabling readline commands

What happens if you include export EDITOR=emacs in your ~/.bashrc or, in my case, ~/.zshrc ?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2012-03-21 21:11:25

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

jasonwryan wrote:

So do all those binds work? Becuase if it is just the Alt-b that doesn't, it isn't in that file...

My apologies.  I just checked and I was wrong when I said they don't work in the console.  They do, just not in an xterm.  In an xterm, ctrl-w works to delete previous word, but alt-backspace, alt-b, alt-f, etc don't work.

ewaller wrote:

What happens if you include export EDITOR=emacs in your ~/.bashrc or, in my case, ~/.zshrc ?

It doesn't seem to make a difference.

Offline

#9 2012-03-21 21:16:57

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

I just tried in xterm (I use vi-binds, though) and everything seemed to work fine. You haven't got anything in your Xresources/defaults that would be impacting on this?

Might be worth trying in another term emulator as well - urxvt is nice smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2012-03-21 21:27:31

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

It works in urxvt.

I dont have an /etc/X11/Xresources file

~/.Xdefaults:

*VT100*foreground: grey90
*VT100*background: black
*VT100*color4: DodgerBlue1
*VT100*color12: SteelBlue1

I'm wondering if either fedora and ubuntu (the other distro I've used) map xterm to some enhanced version of xterm or else if there's an xorg package I'm missing.

How do I see what packages are available?  Is there a way to do something like pacman -Qs xorg* for packages that are in the repositories?

If I ssh into a remote box, alt-* readline commands still don't work.

Edit: vi-binds would be fine, too!  (They're not working at the moment in xterm, either.)

Last edited by rhodie (2012-03-21 21:28:18)

Offline

#11 2012-03-21 21:31:47

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

So it is xterm specific. Can you paste the output of:

infocmp xterm

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#12 2012-03-21 22:16:42

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

#       Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm
xterm|xterm terminal emulator (X Window System),
        am, bce, km, mc5i, mir, msgr, npc, xenl,
        colors#8, cols#80, it#8, lines#24, pairs#64,
        acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
        clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
        csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
        cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
        cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
        cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
        dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
        flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
        ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
        ind=^J, indn=\E[%p1%dS, invis=\E[8m,
        is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F,
        kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~,
        kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H, kcbt=\E[Z,
        kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
        kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
        kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
        kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
        kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
        kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
        kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
        kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
        kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
        kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
        kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
        kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
        kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
        kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
        kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
        kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
        kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
        kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
        kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
        kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
        kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
        memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
        rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
        rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
        rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
        setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
        setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
        setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
        sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
        sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
        smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
        smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
        u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

Offline

#13 2012-03-21 22:23:11

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

The terminfo looks fine. I am not sure what else could be interfering with those key sequences. You aren't setting a TERM value in your shell initialization file are you?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#14 2012-03-21 22:31:40

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

Not doing anything fancy that I'm aware of.  I did a very minimal install and I'm wondering if I could be missing a package that would enable readline.  Not sure if that makes any sense, though.  Is there a way to see which xorg packages I don't have installed?  Something like fedora's "yum info xorg*"?

Offline

#15 2012-03-21 22:42:23

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

pacman -Qs xorg*

Readline is independent of xorg, though...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#16 2012-03-21 23:00:34

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

Doesn't that command only show packages that are installed?  If not, how do I tell which ones are installed?

I know it's independent, but I'm just wondering if somehow input events aren't being sent properly to or received properly by xterm and if there might be a package that enables it.  I admit that I'm grasping at straws here...

Offline

#17 2012-03-21 23:07:35

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

Yes - that only shows installed packages - sorry, I misread you question.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#18 2012-03-21 23:14:46

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

Is there a way to show packages that aren't installed?

Offline

#19 2012-03-21 23:20:15

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

You can search the repos with

pacman -Ss string

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#20 2012-03-21 23:50:20

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] Enabling readline commands

One solution I found by Googling (this is not an unknown problem) was to put this line in your /Xdefaults:

XTerm*eightBitInput:        false

I have that line in my .Xdefaults, and all the emacs shortcuts work in xterm.

The xterm man page doesn't give me enough of the basic information I currently lack, but I can see the different  *eightBit<something> settings control the output and recognition of the meta-key.

Googling also says it might be related to the language setting.  What's the output of

echo $LANG

Offline

#21 2012-03-21 23:53:37

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

jasonwryan wrote:

You can search the repos with

pacman -Ss string

Thanks for that.

XTerm*eightBitInput:        false

Thank you!  That works.  smile

Googling also says it might be related to the language setting.  What's the output of

echo $LANG

en_US.UTF-8

Last edited by rhodie (2012-03-21 23:59:34)

Offline

#22 2012-03-22 00:01:13

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Enabling readline commands

thisoldman wrote:

One solution I found by Googling (this is not an unknown problem) was to put this line in your /Xdefaults:

XTerm*eightBitInput:        false

I have that line in my .Xdefaults, and all the emacs shortcuts work in xterm.

Nice catch! Might be worth adding that to the readline page.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#23 2012-03-22 00:30:51

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [Solved] Enabling readline commands

jasonwryan wrote:

Nice catch! Might be worth adding that to the readline page.

Thanks.  But it's not a readline bug or option, it's xterm.  There's already a different version of the solution posted in the xterm article.  At least, I think it's a version of the solution

xterm*metaSendsEscape: true

Offline

#24 2012-03-22 00:37:42

rhodie
Member
Registered: 2012-03-19
Posts: 45

Re: [Solved] Enabling readline commands

thisoldman wrote:
xterm*metaSendsEscape: true

Yes, that works for me, too.

Offline

Board footer

Powered by FluxBB