Discussion:
python repl vi mode line editing not working.
(too old to reply)
Tobiah
2024-07-09 13:15:14 UTC
Permalink
Kubuntu 24.04.


sinewave:toby ~(1)> cat .inputrc
set editing-mode vi
set keymap vi
sinewave:toby ~(1)> cat .editrc
bind -v
bind \\t rl_complete
sinewave:toby ~(1)> python
Python 2.7.18 (default, Jul 8 2024, 12:49:12)
[GCC 13.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
1
1
2
2
^[k
I see the literal 'escape' character + 'k', when it should
let me edit previous commands.

I did have to compile my own python because I'm using 2.7 on
this machine.

Thanks for any help.


Toby
Stefan Ram
2024-07-09 13:40:43 UTC
Permalink
1
1
2
2
^[k
Works here under a Linux with Python 3. I add the lines from
your rc files to my rc files, call "python3", and then I see

|>>> 1
|1
|>>> 2
|2
|>>> 2

after pressing [1][enter][2][enter][escape][k].

(It seems Python 2 is not available to me on this system.)

For this to work, the Python implementation should use the same
readline library as your shell, I guess.
Tobiah
2024-07-10 13:35:16 UTC
Permalink
Post by Stefan Ram
For this to work, the Python implementation should use the same
readline library as your shell, I guess.
It works in python3, so I guess my problem is that I'm
compiling python (I think kubuntu dropped python2), but
I don't see any relevant options in the configure help.
Tobiah
2024-07-10 13:44:50 UTC
Permalink
Post by Tobiah
I see the literal 'escape' character + 'k', when it should
let me edit previous commands.
I did have to compile my own python because I'm using 2.7 on
this machine.
I figured it out. I needed to apt install libreadline-dev.

Loading...