Readline

From dankwiki
Jump to navigation Jump to search

GNU libreadline is the GNU component for line-based user interfaces. It supports history, completion, editing using vim and emacs keybindings, etc. Its equivalent in the BSD world is libedit.

Building with readline

Autotools provides a AX_LIB_READLINE macro in the Autoconf Archives. It does not appear to provide pkg-config information.

Configuration

Upon intiialization, libreadline reads the files /etc/inputrc and $HOME/.inputrc to configure itself. Configuration can be performed on a per-program basis using conditional directives based off application names. An application sets its readline name by setting rl_readline_name before calling any libreadline functions.

Prompt

The prompt can be read from rl_prompt. It ought be set via argument to readline() or rl_set_prompt().