TransWikia.com

How do I use vi keybindings at the command line in Radare2?

Reverse Engineering Asked by cjs on March 15, 2021

The Radare2 command line (I believe it’s called “interactive mode”?) allows bringing back history and editing it with the arrow keys. However, I prefer to use vi/vim keybindings for this. How do I configure this?

I do have a $HOME/.inputrc file which contains set editing-mode vi, and this works for many programs (presumably all that use GNU Readline or a compatible library).

Alternatively, is there an option available to build Radare2 with Readline?

One Answer

You can e scr.prompt.vi = true to enable a limited form of vi key bindings for command line editing. However, this is very limited; it's even missing basic movement commands such as f and t, and some commands such as cw do not appear to work properly. Searching with vi keybindings is unavailable; you must still use the Emacs Ctrl-R syntax to search backwards in your history. And a special warning: Enter in command mode will do nothing; you must enter insert mode and press Enter to enter the command you've just brought up or edited.

(I found the setting by searching the configuration variables using e scr. ~vi; thanks to @blabb for mentioning this to me.)

Radare2 uses its own command line editing code, in libr/cons/dietline.c.

Correct answer by cjs on March 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP