Skip to main content

Questions tagged [readline]

GNU Readline is a library that provides command-line editing and history searching capabilities for Bash and other interactive command-line programs. Use this tag for questions relating to the use of Readline functionality in Bash and other software.

Filter by
Sorted by
Tagged with
8 votes
1 answer
1k views

What is the '.tee_history' file?

This is a plaintext file, apparently limited to 300 lines. I use tee frequently on my system. $ file .tee_history .tee_history: Unicode text, UTF-8 text $ wc -l .tee_history 300 .tee_history $ tee --...
user598527's user avatar
1 vote
0 answers
21 views

How to remap "vi-search-again" in .inputrc?

I use Colemak + Bash Vi mode, and have remapped h j k l to h n e i in .inputrc. The original N n keys for repeating search seem to be bound to the same command: $ # Run in command mode $ bind -p | ...
UM-Li's user avatar
  • 47
0 votes
0 answers
32 views

I can't bind Meta-h to backward-kill-word using bash/readline for my xterms

redhat-release: Red Hat Enterprise Linux Workstation release 7.4 (Maipo) bash version: 4.2.46(2) xterm version: X.Org 7.6.0(295) I'm using xmodmap to map my Meta keys correctly. Confirmed this via ...
eh3's user avatar
  • 1
0 votes
0 answers
81 views

What is a CLI helper/wrapper that allows a dumb CLI program to have a command history? [duplicate]

Many years ago I came across a simple utility that would handle the keyboard interaction for any CLI-based program that did not support command history. This tool would keep track of the commands you ...
Paperclip Bob's user avatar
0 votes
0 answers
383 views

"Bracketed Paste Mode" gone wrong

I turn off enable-bracketed-paste feature whenever I log in into my bash, and I need to access a remote server which had not turned it off system wide. Many time, this is what I'm getting before I've ...
xpt's user avatar
  • 1,644
1 vote
0 answers
66 views

Required help with extremely hacky Bash script to view Readline's killring

I devised a contraption to visualize the killring in Bash. It work like this: $ killring Killring: 1 Line one in killring 2 Line two in killring 3 Line three in killring However, there are some ...
Sebastian Carlos's user avatar
0 votes
0 answers
53 views

How can I differentiate a bash prompt ending with a newline from a running command?

I have bracketed-paste-mode turned on in bash. I think it is a good safety feature and I would like to keep it. One problem I have is that it is difficult to differentiate a running command from one ...
Dan Robertson's user avatar
1 vote
1 answer
276 views

quick-swap TUI mode while using vi keybindings in GDB

In the default mode of gdb, pressing ctrl+x a turns on and off the UI, and ctrl+x 2 cycles through different split views. There are a number of similar useful shortcuts. I can turn on vi emulation ...
Fraser's user avatar
  • 111
2 votes
0 answers
565 views

getting php readline extension to work in php 8 xampp installation

i have a fresh install of linux mint 21.1 as well as the latest version of xampp which comes with php 8.2.4. i added export PATH=$PATH:/opt/lampp/bin to .bashrc to access php from the terminal. it ...
bungee1980's user avatar
2 votes
1 answer
137 views

View text in kill-ring

Is there a way to view your entire kill-ring besides repededly hitting M-y Somthing like emacs browse-kill-ring but for the shell
Nifle's user avatar
  • 549
0 votes
1 answer
193 views

How to delete a region in the command line?

I just learned that command lines have marks, just like emacs. But, unlike emacs, C-w doesn't delete the region, it only deletes one word backwards. Is there a readline equivalent for this?
ychaouche's user avatar
  • 998
4 votes
1 answer
268 views

Fish equivalent of Bash / readline's Ctrl-O "operate-and-get-next"

Readline and therefore Bash have a very useful command called operate-and-get-next, bound by default to Ctrl-O, that executes the current line, after selecting it from the history, and advances the ...
Tobia's user avatar
  • 689
1 vote
1 answer
292 views

ANSI escape sequences in PS1 cause incorrect length calculation [duplicate]

I have a PS1 set up in my .zshrc which includes multiple ANSI escape sequences. An equivalent definition works nicely in Bash, but in Zsh (v5.8.1) it seemingly causes the shell to calculate the width ...
Konrad Rudolph's user avatar
1 vote
2 answers
263 views

Mouse-click stopped positioning cursor in shell (readline) in XTerm after upgrade from Fedora 18 to 36

I am using the following control sequence to set up that when I click in the command line in shell (BASH) in XTerm the cursor moves to the position. At least, it used to worked that way in my ancient ...
mjf's user avatar
  • 113
1 vote
0 answers
349 views

zsh: read line without clearing screen below prompt while allowing user to use arrow keys to make edit in middle of line

Using Bash tput cup 0 0; read -e -p "Enter input: " userinput works well for getting a line of user input: It does not clear screen below the prompt It allows user to use arrow keys to go ...
codepoet's user avatar
  • 596
0 votes
1 answer
81 views

Customize the default word definition of GNU readline library?

GNU readline considers consecutive alphanums as word, and all others are non-words, like -option1 -option2 has 4 words (" -", "option1", " -", "option2") which ...
Thomson's user avatar
  • 113
1 vote
1 answer
15 views

Is it possible to make readline ignore compspec when expanding matches in VI mode?

I use VI mode when using bash and I sometimes find that some of the standard compspec definitions don't do what I want. For example, java doesn't appear to know that you have been able to do java ...
Mark W's user avatar
  • 145
2 votes
1 answer
78 views

In Linux shell, have Ctrl-W / ^W send EOF when input is empty like Ctrl-D / ^D does?

Is there any way to have ^W behave the same way as ^D with empty input in a shell? I use zsh, but this should apply to bash as well. It otherwise does nothing (if the input line is already cleared) ...
radu242's user avatar
  • 21
0 votes
0 answers
597 views

To execute key press from within bash

How do we execute/simulate key press from within bash line code script? e.g. alt-L a shortcut preset with a readline code is needed to be triggered in such bash line code How to achieve it?
user avatar
0 votes
1 answer
54 views

How to have repeated command bash code/script equivalent typing Alt n

how to have repeated command in bash code/script to represent the typing Alt n as the number of repetition followed by a key and then hit Enter? e.g. have line code/script for (typing Alt 7) f (Enter)
user avatar
0 votes
0 answers
331 views

Linux from Scratch - readline-8.1.2 throwing an error

I was on my way with installing Linux from Scratch, when I was told to compile and install readline-8.1.2, in chapter 8.11, in LFS 11.1 systemd edition. I then went and got some old versions of ...
Aarav Gupta's user avatar
2 votes
1 answer
140 views

How to increase the size of the .ed_history file

I am running GNU ed 1.18 on Fedora Linux 36. I run ed with rlwrap also installed which gives me access to my command history. My .ed_history file appears to have a size limit of 300 lines. I would ...
Edman's user avatar
  • 512
1 vote
1 answer
244 views

Why can't I get bash to use forward incremental search?

Recently I ran across a few articles with tips on how to more efficiently use bash that mentioned a combination I'd never tried: Ctrl-S (in the prompt, with no command running) to search the other way ...
Nathan Tuggy's user avatar
1 vote
0 answers
527 views

Ubuntu's bash does not honor INPUTRC

I'm using INPUTRC to move the .inputrc file away from my home folder. It used to work (like with my GNU bash, version 5.1.4), but in bash version 5.1.16, I found that the INPUTRC is no longer honored. ...
xpt's user avatar
  • 1,644
12 votes
4 answers
4k views

Is it possible in Bash to run the output of a command as the actual command-line to run

Let me explain with an example: I have a line where I declare an alias in my ~/.bashrc: > grep lsdir ~/.bashrc alias lsdir='ls -d */' I have just added this line to my bashrc, and the alias is ...
adamency's user avatar
  • 387
3 votes
1 answer
368 views

Send accept-line to readline when binding the Enter key using bash bind -x

I have successfully bind the Enter key using: function foo() { echo 'Im a foo' } bind -m vi-insert -x '"\C-M": foo' the problem is I have no way of accepting the READLINE_LINE. How can ...
cevhyruz's user avatar
  • 437
13 votes
1 answer
2k views

What shells use readline?

I recently posted a question about a strange behavior I had observed in the bash, fish and zsh shells that was not exhibited by the tcsh, csh, ksh, or dash shells. It turns out the behavior was caused ...
terdon's user avatar
  • 244k
12 votes
1 answer
2k views

Make a trailing newline execute a command when pasted into the shell

A couple of months ago, a system update caused my shell to no longer interpret trailing newlines as an enter when pasting a command into the terminal. For example, if I write ls at my prompt and then ...
terdon's user avatar
  • 244k
3 votes
1 answer
2k views

How to disable libreadline's bracketed paste mode programmatically

Starting with libreadline version 8.1, the default is to give special treatment to "bracketed paste" operations. This breaks parsing for my program, so I want to disable it. I know that it ...
Ethan's user avatar
  • 194
1 vote
1 answer
298 views

Proper way to wrap dash using rlwrap

On Ubuntu, I have set alias sh='rlwrap --complete-filenames sh' to get readline keybindings and filename completion when using the dash shell (on my computer, sh is /usr/bin/sh, which is a symbolic ...
Flux's user avatar
  • 2,978
2 votes
0 answers
254 views

How to use readline bindings everywhere?

Using OSX I am able to use readline-specific bindings, such as going to the beginning of the line with CTRL+A, everywhere. I recently switched to Linux (specifically NixOS) and I've been missing this ...
Christian's user avatar
2 votes
1 answer
1k views

How do you set the colour of the bash tab completion when `colored-completion-prefix` is turned on?

I have colored-completion-prefix set on in my ~/.inputrc file, but when I tab complete, the prefix part which has already been typed is a colour that I do not like. In the bash manual it says: "...
paradroid's user avatar
  • 1,203
1 vote
1 answer
662 views

Why can't install specified mariadb version with readline library?

My os info: uname -a Linux debian 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux Locale setting: locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_CTYPE="en_US.UTF-8" ...
showkey's user avatar
  • 395
0 votes
4 answers
390 views

How to expand a variable on console/shell prompt

How do we expand a variable, ie. a '$' preceded name, to its value content on bash readline ?
user avatar
1 vote
0 answers
87 views

bash/readline: How to enable *-expansion on <TAB>?

After switching from Ubuntu 20.04 to Debian 11 I noticed that typing, for example $ rm *.db<TAB> no longer attempts to expand *.db. What used to happen (on Ubuntu 20.04 and earlier versions) ...
MWB's user avatar
  • 123
0 votes
0 answers
64 views

Need bash glob to be expanded and keep it ready in the readline

how can bash glob is expanded and keep the cursor ready on the readline so that keep current command from being executed
user avatar
1 vote
0 answers
56 views

Option+Left in Bash on Mac sometimes produces ;9D

I've set up my bash in iTerm2 on Mac so that Option+Left goes backward a word, and Option+Right goes forward a word. I've done this to have a similar setup as on my Linux machine. However, sometimes ...
Thomas McGuire's user avatar
1 vote
1 answer
247 views

disable terminal werase setting only in interactive mode in bash

I want to bind C^w to a non-default action in bash, but it requires disabling werase in the terminal. This, unfortunately, affects other programs launched by bash, especially my ssh sessions: when I ...
basin's user avatar
  • 2,061
4 votes
1 answer
610 views

How do I disable Esc-v in bash opening the previous command in an editor?

This has bothered me for years. I have tried to unbind the key sequence in .inputrc, I have set EDITOR to true and false, I have read and reread the bash and readline man pages. I have used ksh ...
Hinheckle Jones's user avatar
0 votes
1 answer
207 views

CamelCase-aware backward-kill-word in readline

backward-kill-word is a readline action that deletes the previous alphanumeric word. For example, applying this action in the following scenario (▯ indicates the position of the cursor) echo hello-...
mgarort's user avatar
  • 465
0 votes
0 answers
108 views

Keymap causes Readline Delay on `.` in Vi Mode

When I press . in Vi/command mode there is always a delay (half a second) before the last action gets repeated. I found that this is caused by my .inputrc: set editing-mode vi set keymap vi-command &...
laktak's user avatar
  • 6,054
2 votes
1 answer
2k views

Setting cmd-mode bindings in inputrc for vi editing-mode

I am using vi key bindings in .inputrc with set editing-mode vi Then I would like to add new bindings for command mode, namely use K and J to perform forward and reverse search in history of what I ...
Joce's user avatar
  • 212
2 votes
0 answers
2k views

Symbol lookup error for libreadline

I recently started having problems with running programs like sqlite3 or awk on Ubuntu20. These programs won't start and just show this error: symbol lookup error: /usr/local/lib/libreadline.so.8: ...
Juraj Bezručka's user avatar
2 votes
1 answer
465 views

How to list readline variables with their current value

I'd like to be able to see if, for example, show-all-if-unmodified is enabled in the current session.
Arch Stanton's user avatar
2 votes
0 answers
385 views

What could go wrong with sending input to /dev/tty?

My setup entails sending inputs to another terminal program running Bash in the same machine and same X session. I'm using ttyecho for that which, to put it short, sends input to /dev/tty/[id], ...
resolritter's user avatar
1 vote
1 answer
271 views

How to have `SPACE: magic-space` in ~/.inputrc without breaking Python 3 REPL?

If I put SPACE: magic-space in my ~/.inputrc file for configuring Readline, then I cannot enter SPACEs in python3 REPL (v3.8.7) How can I use SPACE: magic-space in my ~/.inputrc without breaking ...
Shuzheng's user avatar
  • 4,581
1 vote
1 answer
115 views

How to use "\M-\C-" as an key sequence prefix when defining key bindings using Readline in Bash?

If I put "\M-\C-k": kill-whole-line in my ~/.inputrc file the result is "\213": kill-whole-line (displayed by bind -p). However, if I change \M- to \e ("\e\C-k": kill-...
Shuzheng's user avatar
  • 4,581
1 vote
1 answer
188 views

Bash _/- completion

man bash says: completion-map-case (Off) If set to On, and completion-ignore-case is enabled, readline treats hyphens (-) and underscores (_) as equivalent when performing case-insensitive ...
laktak's user avatar
  • 6,054
1 vote
1 answer
478 views

Expand shell variable while editing command line

If I write ls bla.* at the prompt and then I press = while the cursor is still on the bla.* part of the command line, the list of files matching bla.* is printed. If I press *, that word is ...
Enlico's user avatar
  • 1,677
0 votes
1 answer
175 views

readline's rl_parse_and_bind causes crash

I am using Ubuntu 18.04.5. This very simple program segfaults on the invocation of rl_parse_and_bind. Can anyone help me? // Build with cc read.c -o read -lreadline #include <readline/readline.h&...
Stephen Montgomery-Smith's user avatar

1
2 3 4 5 6