readline vi mode in python interactive shell

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tnoell@gmail.com

    #1

    readline vi mode in python interactive shell

    Hi comp.lang.pytho n:
    New to the group and new to python, so don't tear me up too much ...
    I installed the GNU readline support in python2.4, and it is working,
    but there is one annoying behaviour that I am hoping to squash ...

    Namely, when I hit <esc> to go to edit mode, then hit 'k' to go up in
    the command history,
    the prompt is put at the start of the line.

    Other places I use vi mode command line editing (e.g., zsh), the
    cursor is at the end of the previous command.

    More often than not, I am wanting to edit the latter part of the
    previous command, not the start.

    Is there any way to tell readline to put the cursor at the end of the
    command line when browsing them?

    Thx for any light you can shinte,
    Tim

  • Micah Elliott

    #2
    Re: readline vi mode in python interactive shell

    On Nov 16, tnoell@gmail.co m wrote:[color=blue]
    > Hi comp.lang.pytho n:
    > New to the group and new to python, so don't tear me up too much ...
    > I installed the GNU readline support in python2.4, and it is working,
    > but there is one annoying behaviour that I am hoping to squash ...
    >
    > Namely, when I hit <esc> to go to edit mode, then hit 'k' to go up
    > in the command history, the prompt is put at the start of the line.[/color]

    Amazing that you brought this up right now; I was just thinking about
    whether or not to bother posting my own annoyance (invisible last
    history command) with readline 4.3-5 (default with Fedora Core 3) and
    Python 2.4.2. Since you brought it up, here's my test case:

    My ~/.inputrc simply contains "set editing-mode vi". When I start
    python I type "print 'a'". Then "<Esc>k" to recall the last
    command -- but the line is invisible! If I start editing the
    blank/invisible line the text magically appears. Or if I press
    "k" twice I have visible history again. So now I have in muscle
    memory "<Esc>kkj" to get my last command :-(

    This is not a problem on the same machine with older versions of python
    that are installed. Is this worth filing a bug against python? I
    didn't find anything reported on sf.net/projects/python.
    [color=blue]
    > Other places I use vi mode command line editing (e.g., zsh), the
    > cursor is at the end of the previous command. More often than not, I
    > am wanting to edit the latter part of the previous command, not the
    > start.[/color]

    In bash "<Esc>k" puts me at the *beginning* of the line. Of course $
    puts you where you want to be then, but I'm not sure how to affect the
    behavior you're asking for; "help bind" might be useful, and "bind -P"
    shows some mappings.

    --
    _ _ ___
    |V|icah |- lliott <>< mde@micah.ellio tt.name
    " " """

    Comment

    • Micah Elliott

      #3
      Re: readline vi mode in python interactive shell

      On Nov 16, tnoell@gmail.co m wrote:[color=blue]
      > Hi comp.lang.pytho n:
      > New to the group and new to python, so don't tear me up too much ...
      > I installed the GNU readline support in python2.4, and it is working,
      > but there is one annoying behaviour that I am hoping to squash ...
      >
      > Namely, when I hit <esc> to go to edit mode, then hit 'k' to go up
      > in the command history, the prompt is put at the start of the line.[/color]

      Amazing that you brought this up right now; I was just thinking about
      whether or not to bother posting my own annoyance (invisible last
      history command) with readline 4.3-5 (default with Fedora Core 3) and
      Python 2.4.2. Since you brought it up, here's my test case:

      My ~/.inputrc simply contains "set editing-mode vi". When I start
      python I type "print 'a'". Then "<Esc>k" to recall the last
      command -- but the line is invisible! If I start editing the
      blank/invisible line the text magically appears. Or if I press
      "k" twice I have visible history again. So now I have in muscle
      memory "<Esc>kkj" to get my last command :-(

      This is not a problem on the same machine with older versions of python
      that are installed. Is this worth filing a bug against python? I
      didn't find anything reported on sf.net/projects/python.
      [color=blue]
      > Other places I use vi mode command line editing (e.g., zsh), the
      > cursor is at the end of the previous command. More often than not, I
      > am wanting to edit the latter part of the previous command, not the
      > start.[/color]

      In bash "<Esc>k" puts me at the *beginning* of the line. Of course $
      puts you where you want to be then, but I'm not sure how to affect the
      behavior you're asking for; "help bind" might be useful, and "bind -P"
      shows some mappings.

      --
      _ _ ___
      |V|icah |- lliott <>< mde@micah.ellio tt.name
      " " """

      Comment

      • tnoell@gmail.com

        #4
        Re: readline vi mode in python interactive shell

        Well, I subsequently found this:



        to explain it.

        Bummer ...

        Comment

        • tnoell@gmail.com

          #5
          Re: readline vi mode in python interactive shell

          Well, I subsequently found this:



          to explain it.

          Bummer ...

          Comment

          Working...