5

Does the geth console input prompt use the standard readline library?

For apps that do, setting in ~/.inputrc:

set editing-mode vi

enables vi mode on the command prompt. For example, try

$ python
input()

with and without the above ~/.inputrc.

Geth Geth/v1.4.5-stable-a269a713/linux/go1.6.2 does not seem to honor the .inputrc setting. Missing feature (or bug)?

  • never thought of that, quite interested as well ! – euri10 May 31 '16 at 15:35
  • You never need vi there – niksmac Jun 16 '16 at 4:10
  • @niksmac It's not about vi, it's about keyboard keymappings for editting the command line. Once you switch to vi mode, everything else becomes painful to use. – redfish Jun 17 '16 at 4:56
  • editing the command line? what is there for you to edit? out of curiosity. – niksmac Jun 17 '16 at 6:04
4
+50

Summary

geth does not use the Unix standard readline library. It implements some of the command line input within it's code base with the github.com/peterh/liner library for some of the other functionality.

Q: How to enable vi mode in geth console?

A: You cannot enable vi mode in the geth console.

Q: Geth Geth/v1.4.5-stable-a269a713/linux/go1.6.2 does not seem to honor the .inputrc setting. Missing feature (or bug)?

A: I would consider this a feature, as geth has been built to run across the three operating systems Linux, OS X and Windows.



Details

You will get the interactive console when you start geth with the console or attach command and these call repl.interactive():

The calls to repl.interactive() execute the function interactive() in cmd/geth/js.go, lines 318-371.

The function interactive() uses the cmd/utils/input.go and github.com/peterh/liner library to deal with the command line editor.

You can see the keystroke handling in github.com/peterh/liner/input.go.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.