arrow key bindings in perl debugger mode

Discussion in 'Perl Misc' started by andrew, May 14, 2008.

  1. andrew

    andrew Guest

    Hi. I've been pouring over the debugger perldocs trying to figure out
    how to change keyboard bindings, so for example the 'left' and 'right'
    arrow keys let me move the cursor around the current line instead of
    spitting out things like '^[[C', and mapping the 'up' arrow key to
    cycle through the command history like it would at a command line
    prompt. Am I approaching this completely wrong? Any advice would be
    welcome. Thanks :)
     
    andrew, May 14, 2008
    #1
    1. Advertising

  2. andrew <> wrote:
    > Hi. I've been pouring over the debugger perldocs trying to figure out
    > how to change keyboard bindings, so for example the 'left' and 'right'
    > arrow keys let me move the cursor around the current line instead of
    > spitting out things like '^[[C', and mapping the 'up' arrow key to
    > cycle through the command history like it would at a command line
    > prompt. Am I approaching this completely wrong? Any advice would be
    > welcome. Thanks :)


    From 'perldoc perldebug':

    As shipped, the only command-line history supplied is a simplistic
    one that checks for leading exclamation points. However, if you
    install the Term::ReadKey and Term::ReadLine modules from CPAN,
    you will have full editing capabilities much like GNU readline(3)
    provides. Look for these in the modules/by-module/Term directory
    on CPAN. These do not support normal vi command-line editing,
    however.

    And with ReadLine support also the left and right key should
    work as expected.
    Regards, Jens
    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
     
    Jens Thoms Toerring, May 14, 2008
    #2
    1. Advertising

  3. andrew

    andrew Guest

    My sincerest thanks :)
     
    andrew, May 15, 2008
    #3
  4. andrew

    andrew Guest

    Hmm, these two modules are installed, but it's not exactly clear to me
    how to use them to customize key bindings.
     
    andrew, May 15, 2008
    #4
  5. andrew <> wrote:
    > Hmm, these two modules are installed, but it's not exactly clear to me
    > how to use them to customize key bindings.


    Since readline is used you can customize keybindings by creating
    a .inputrc file in your home directory (or set up the INPUTRC
    environment variable to the name of the init file for readline)
    and putting the keybindings in there. Per default more-or-less
    emacs keybindings are used. In that file you can change them.
    It's admittedly not trivial (unless you're an emacs expert)
    but see e.g.

    http://tiswww.case.edu/php/chet/readline/rluserman.html#SEC9

    Regards, Jens
    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
     
    Jens Thoms Toerring, May 15, 2008
    #5
  6. Jens Thoms Toerring <> wrote:
    > andrew <> wrote:
    > > Hmm, these two modules are installed, but it's not exactly clear to me
    > > how to use them to customize key bindings.


    > Since readline is used you can customize keybindings by creating
    > a .inputrc file in your home directory (or set up the INPUTRC
    > environment variable to the name of the init file for readline)
    > and putting the keybindings in there. Per default more-or-less
    > emacs keybindings are used. In that file you can change them.
    > It's admittedly not trivial (unless you're an emacs expert)
    > but see e.g.


    > http://tiswww.case.edu/php/chet/readline/rluserman.html#SEC9


    You should be aware that using .inputrc in your home directory
    also sets the keybindings also for all other programs that use
    the readline library (e.g. xterm). The simplest way around that
    is probably to create an alias like (bash style)

    alis pd='INPUTRC=~/.perldinputrc perl -d'

    so that the INPUTRC variable gets only set to the file with
    eybindings for the debugger, named here .perldinputrc in
    your home directory, when you start perl in debug mode with
    the new "command" 'pd'.
    Regards, Jens
    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
     
    Jens Thoms Toerring, May 15, 2008
    #6
  7. andrew wrote:
    > Hmm, these two modules are installed, but it's not exactly clear to me
    > how to use them to customize key bindings.


    Something else must be wrong, then. The default bindings for those keys
    matches the functionality you wanted.

    -mjc
     
    Michael Carman, May 16, 2008
    #7
  8. Jens Thoms Toerring wrote:
    > You should be aware that using .inputrc in your home directory also
    > sets the keybindings also for all other programs that use
    > the readline library (e.g. xterm). The simplest way around that is
    > probably to create an alias like (bash style)
    >
    > alis pd='INPUTRC=~/.perldinputrc perl -d'
    >
    > so that the INPUTRC variable gets only set to the file with eybindings
    > for the debugger, named here .perldinputrc in your home directory,
    > when you start perl in debug mode with the new "command" 'pd'.

    Why in the world would I want the Perl debugger to behave one way and
    bash another?
    --
    Andrew DeFaria <http://defaria.com>
    Everybody repeat after me ...We are all individuals.
     
    Andrew DeFaria, May 16, 2008
    #8
  9. Andrew DeFaria <> wrote:
    > [-- text/plain, encoding 7bit, charset: ISO-8859-1, 17 lines --]


    > Jens Thoms Toerring wrote:
    > > You should be aware that using .inputrc in your home directory also
    > > sets the keybindings also for all other programs that use
    > > the readline library (e.g. xterm). The simplest way around that is
    > > probably to create an alias like (bash style)
    > >
    > > alis pd='INPUTRC=~/.perldinputrc perl -d'
    > >
    > > so that the INPUTRC variable gets only set to the file with eybindings
    > > for the debugger, named here .perldinputrc in your home directory,
    > > when you start perl in debug mode with the new "command" 'pd'.

    > Why in the world would I want the Perl debugger to behave one way and
    > bash another?


    Maybe because you want to assign to some function keys an
    action that doesn't make sense in an xterm? Like e.g. assigning
    the debuggers 'q' command to F12 while the same function key
    should emit 'exit' in an xterm?

    --
    \ Jens Thoms Toerring ___
    \__________________________ http://toerring.de
     
    Jens Thoms Toerring, May 16, 2008
    #9
  10. Jens Thoms Toerring wrote:
    >> Why in the world would I want the Perl debugger to behave one way and
    >> bash another?

    > Maybe because you want to assign to some function keys an action that
    > doesn't make sense in an xterm? Like e.g. assigning
    > the debuggers 'q' command to F12 while the same function key should
    > emit 'exit' in an xterm?

    Well I don't use xterm. But the answer is - I wouldn't. I wouldn't
    bother assigning a function key (F12) to do the "q" command to quit the
    debugger when the "q" key is right within grasp (of a touch typist, one
    for over 25 years and a guitarist for 30 which great control of my
    fingers) and the F12 is a stretch at best!
    --
    Andrew DeFaria <http://defaria.com>
    The hilarious thing about self-important self-righteous people is that
    they are so easily baited.
     
    Andrew DeFaria, May 17, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John J Lee
    Replies:
    3
    Views:
    552
    bruno at modulix
    Dec 1, 2005
  2. Edward Loper
    Replies:
    0
    Views:
    528
    Edward Loper
    Aug 7, 2007
  3. John J Lee
    Replies:
    0
    Views:
    561
    John J Lee
    Aug 7, 2007
  4. Edward Loper

    mmm-mode, python-mode and doctest-mode?

    Edward Loper, Aug 9, 2007, in forum: Python
    Replies:
    0
    Views:
    476
    Edward Loper
    Aug 9, 2007
  5. JS Bangs
    Replies:
    1
    Views:
    158
    JS Bangs
    Jul 9, 2003
Loading...

Share This Page