bash - key bindings

bash - key bindings

Post by Troy Piggin » Mon, 21 Jun 2004 14:58:14



Having trouble with what my keyboard does when logged in as myself - let
me explain :
System is RH9, shell is bash-2.05b-20.1 (from rpm).  From the default
install, the arrow keys up/down through command history, left/right
mover the cursor along the commandline, and the home/end keys moved the
cursor to front/end of current command.
Few weeks ago I played around with some bashrc's to tweak my shell (as
you do).  Somewhere along the line, I now can't use the home/end to go
to front/end of commandline.  The arrow keys still work as before.
My .bashrc, .bash_profile are back to what they were before I started
frigging around with them, but still no luck.
If I log in as some other user, or root, the home/end keys work as I
want them to.
If I use 'screen' as myself, they also work fine.  It is only when in
bash itself.
Any help appreciated.
--
T R O Y  P I G G I N S

 
 
 

bash - key bindings

Post by Chris F.A. Johnso » Mon, 21 Jun 2004 15:43:15



Quote:> Having trouble with what my keyboard does when logged in as myself - let
> me explain :
> System is RH9, shell is bash-2.05b-20.1 (from rpm).  From the default
> install, the arrow keys up/down through command history, left/right
> mover the cursor along the commandline, and the home/end keys moved the
> cursor to front/end of current command.
> Few weeks ago I played around with some bashrc's to tweak my shell (as
> you do).  Somewhere along the line, I now can't use the home/end to go
> to front/end of commandline.  The arrow keys still work as before.

     Create a $HOME/.inputrc file, if you don't already have one.

     Find the key sequence generated by your home and end keys (press
     ^V and the key), and put them in .inputrc. For example, rxvt
     gives me "^[[7~" for the home key. '^[' is escape and is entered
     as '\e'.

     These are the entries I have to cover various terminal programs:

"\e[1~": beginning-of-line
"\eOH": beginning-of-line
"\e[7~": beginning-of-line

"\e[8~": end-of-line
"\eOF": end-of-line
"\e[F": end-of-line
"\e[4~": end-of-line

Quote:> My .bashrc, .bash_profile are back to what they were before I started
> frigging around with them, but still no luck.
> If I log in as some other user, or root, the home/end keys work as I
> want them to.
> If I use 'screen' as myself, they also work fine.  It is only when in
> bash itself.
> Any help appreciated.

--
    Chris F.A. Johnson                  http://cfaj.freeshell.org/shell
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 
 
 

bash - key bindings

Post by Troy Piggin » Mon, 21 Jun 2004 15:55:50


<snip>

Quote:>      Create a $HOME/.inputrc file, if you don't already have one.

I am a tool.  That was *exactly* the problem.  Default new user on my
system does not get a ~/.inputrc.  When I was playing with setup I must
have used someone else's .inputrc and that is where the problem was.  I
didn't even think of that because I am a bit of a novice.  All good now,
and thankyou for the lightning-fast response!

<snip>

--
T R O Y  P I G G I N S

 
 
 

bash - key bindings

Post by Troy Piggin » Mon, 21 Jun 2004 16:00:17




> <snip>

>>      Create a $HOME/.inputrc file, if you don't already have one.

> I am a tool.  That was *exactly* the problem.  Default new user on my
> system does not get a ~/.inputrc.  When I was playing with setup I must
> have used someone else's .inputrc and that is where the problem was.  I
> didn't even think of that because I am a bit of a novice.  All good now,
> and thankyou for the lightning-fast response!

> <snip>

Just thinking about this - how come the keys worked in screen?  Wouldn't
screen have used the same .inputrc file? (don't mean to get OT ;-) )
--
T R O Y  P I G G I N S

 
 
 

bash - key bindings

Post by Alan Conno » Mon, 21 Jun 2004 16:08:14



> Having trouble with what my keyboard does when logged in as myself - let
> me explain :
> System is RH9, shell is bash-2.05b-20.1 (from rpm).  From the default
> install, the arrow keys up/down through command history, left/right
> mover the cursor along the commandline, and the home/end keys moved the
> cursor to front/end of current command.
> Few weeks ago I played around with some bashrc's to tweak my shell (as
> you do).  Somewhere along the line, I now can't use the home/end to go
> to front/end of commandline.  The arrow keys still work as before.
> My .bashrc, .bash_profile are back to what they were before I started
> frigging around with them, but still no luck.
> If I log in as some other user, or root, the home/end keys work as I
> want them to.
> If I use 'screen' as myself, they also work fine.  It is only when in
> bash itself.
> Any help appreciated.

Does ^A and ^E work? (Ctrl-a;Ctrl-e)

AC

 
 
 

bash - key bindings

Post by Troy Piggin » Mon, 21 Jun 2004 19:19:19


<snip>

Quote:> Does ^A and ^E work? (Ctrl-a;Ctrl-e)

> AC

G'day Alan.  Yes, that does work, but for me home and end are more
intuitive and a reflex for my fingers.  It was all in the .inputrc as
Chris had mentioned.
Thanks.
--
T R O Y  P I G G I N S

 
 
 

1. bash key binding

I bind some keys (Home, End,...) in my .bashrc, like:

bind '"\e[1~": "grep -i "'

But annoyingly these keys get rebound to beginning-of-line etc.
by the time bash returns prompt. Of course, I can rebind by
. .bashrc

This problem has come up only after I upgraded from RH5.2 to RH6.0
How can I tell bash to respect my key bindings at first place?

Vinod.

2. C99 initializers for sound/isa

3. Setting bash key bindings in .inputrc

4. lpsched (Sun recent patch)

5. bash key binding problem

6. "Const" changes symbol table.

7. Bash key bindings

8. help ! SoundCard problem of rh9: SndConfig detects 2 card; one is working only in test

9. bash key-binding problem

10. BASH BASH BASH BASH BASH BASH BASH BASH BASH BASH

11. key binding in bash

12. Key Bindings in bash

13. bash command line editing with vi key bindings