Clone this wiki locally
For folks new to Readline, it's a really efficient way to move around the command line. I use the emacs bindings in Readline (though I'm a vim user in general), which means:
Current line navigation
- Ctrl-a: start of line
- Ctrl-e: end of line
- Meta-b: back a word
- Meta-f: forward a word
- Ctrl-f: forward a character
Command history navigation
- Ctrl-r: search backward for the text you type in next
- Ctrl-p: previous command
- Ctrl-n: next command
- Ctrl-k: "kill" everything after the cursor
- Ctrl-u: delete everything before the cursor
This is just a smattering of what's available, off the top of my head - there's lots more, and these should all be rebindable, I think.
I have Meta bound to the Alt/Option key on my Mac, but it often defaults to hitting the Escape key, then hitting the following key. Your OS probably allows you to bind it in other ways as well.
There's a little bit you can glean from JLine's wiki, but mostly you'll want to learn about your
~/.inputrc file to do custom keybinding work. For a deep dive, check out the Readline User Manual
~/.inputrc controls Readline apps of all sorts, and since JLine is a port of Readline for the JVM, that's what JLine uses to do configuration.
If there are features in your
~/.inputrc that work in other Readline-using apps but don't work in JLine, you should probably open a JLine issue. If you do so, it would be helpful to collect some debugging information by setting a Java property: