Current Position:Home > Gnu readline with vi mode change visualization

Gnu readline with vi mode change visualization

Update:10-11Source: network consolidation
After a lot of searching how to get some kind of vi mode indicator working with GNU readline I've decided to hack readline myself. It's working fine for me and because I'm happy archlinux user I've decided to share my findings here, so maybe somebody will find it useful too.
there is a patch to readline needed - I've created AUR package readline-vi-mode-changed-hook
additional logic / configuration to provide your visualization
To not double post what I've already wrote in more detailed way, here is the link to my personal blog where I've documented the whole thing.
There are however few things still bugging me and maybe somebody will be able to help me with that. The particular thing which I would like to solve is to get escape sequence for changing cursor color working inside screen and tmux. I've found trick for screen but what is expectable is that when switching windows the cursor color is not reset by screen to last color set in particular window. Because cursor color sequence is not really a standard nor part of termcap / terminfo I feel it will not be so easy / possible ?
Last edited by mirci (2010-10-11 19:26:06)

The Best Answer

Sara wrote:Am using this with GNU screen, and it works great (no change in cursor color, of course, but I think I actually prefer that, as it isn't inconvenient to look at the window title in DWM). Thanks for sharing the patch--I don't know how I ever lived without it
Well I started with the window title as I use Xmonad, then I realized that looking up or down on screen isn't very convenient for me (mainly because of a big screen I have) but it's still fine, so I was thinking about visualization which would be closest to the prompt location, cursor color was natural choice however it is not very reliable in terminal multiplexers and in general. The latest and my favorite now is the change of prompt itself (eg. bold version).
Anyway thanks for feedback, firstly when published this I thought nobody is using VI mode with readline judging based on almost no feedback at all. It's cool that at least somebody found this patch useful .
lavandero wrote:
Would you be interested in porting this to NetBSD editline (libedit)?
Open/FreeBSD also use it, just in case that qualifies as incentive.
I don't use any application which uses editline. I know it just in the meaning that it is implementing similar functionality as readline do. I guess then some applications usually can be compiled with readline or editline (if author thinks it can be useful based on different licenses and so on) ... does the *BSD systems do it that way ? Anyway I have editline in my mind if I would maybe implement some application where I would need readline functionality. Readline is fine but to be honest I found the source code of it not very nice. So to your question ... as I'm not user of the editline so far I am not planing to port this patch there anytime soon.
Just out of my curiosity which let's say well known applications can be compiled against readline and editline, is it out of box provided by upstream or usually patches are done for it. How it works in *BSD then ? In my archlinux box I frequently use mainly 2 readline applications (bash, i/python).
  • Gnu readline with vi mode change visualization Update:10-11

    After a lot of searching how to get some kind of vi mode indicator working with GNU readline I've decided to hack readline myself. It's working fine for me and because I'm happy archlinux user I've decided to share my findings here, so maybe somebody

  • Feature Request(?): Readline for zonecfg Update:11-30

    I'm not sure if it's appropriate to make a feature request, but I thought I might throw it out there since thats kind of what Express is all about. Is there any merit in adding readline support to zonecfg for command history recall and editing? I adm

  • VERY strange lag on a Dell Optiplex 760 Update:10-11

    I thought it would be a good idea to keep a 16GB flash drive on my keychain that booted Arch so I could work on HW for college in a consistent OS!  Everything is working great so far, but I ran into a very strange problem with a Dell Optiplex 760.  D

  • Maxima - problem with arrow buttons Update:10-11

    I've installed maxima 5.26.0. In console when I want to navigate through the command line (ex. change something or get last commnad from history) I get something like this: "^[[A^[[B". Rest of keyboard buttons (except right side - I mean: arrows

  • SQL*Plus + rlwrap + Terminator = tolerable environment Update:11-30

    I have no doubt that those who are "full-time" users of sqlplus (that is a native Oracle's textmode client app to the database server), will agree that it provides a spartan and unimaginative command-line interface. Unlike most modern command-li

  • Steam bad game performance Update:11-30

    Hello! My system is 64bit Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz with Nvidia G635M  on my lapton. There are a lot of post in Internet saying that Left for dead 2 in Linux has more fps than in windows. But for me on Windows everything is smooth, but

  • 32-bit binary does not run on x86_64, ldd not a dynamic executable Update:11-30

    Hi, I switched from Ubuntu 8.10 x86_64 to arch linux x86_64 a short while ago and have an issue running 32-bit proprietary binary that dynamically links to some libraries. ldd insists "not a dynamic executable" How am I supposed to resolve the i

  • Rlwrap installation error Update:11-30

    I am trying to install rlwrap so I can use command history in sqlplus and rman command prompts. Database is and OS is CentOS 5. I download the zip file from here: ...and take the following installat

  • [SOLVED] WPA_SUPPLICANT and rt2500 chipset cards [SOLVED] Update:11-30

    EDIT: If you want to make an rt2500 chipset wireless card work with wpa_supplicant (and it doesn't already), maybe you have tried to run wpa_supplicant and got a bunch of errors saying nasty things about IOCTRL, this means, most likely, that wpa_supp

  • Picasa under Arch64? Update:11-30

    Hello there, I've been trying to set up picasa-beta package from AUR on my new Arch64 install and I can't get it to work. I installed its deps (lib32-nss and lib32-openssl) and it complaint about missing libx11, so I also installed lib32-libx11, and