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
-1
votes
2answers
20 views

How to insert an entire command from history into the current command in Bash?

How to insert an entire command from history into the current command in Bash? I've done some research and identified two GNU Readline key-bindings that would insert the first and last words of the ...
1
vote
1answer
57 views

bash: Is there a way to invoke bind commands (e.g. redraw-current-line) programmatically?

I've come across a number of explanations on how to map redraw-current-line to a keystroke using bind, but I would like to redraw the prompt for other reasons (e.g. timer, background job), without the ...
1
vote
1answer
59 views

Use bash builtin `bind` command when starting chroot

I have a chroot and I want the chroot to have its own .inputrc file when it starts, and then run a program. I'm used to starting the chroot with chroot <PATH> <PROGRAM_TO_RUN> so I tried ...
0
votes
0answers
35 views

Bash autocomplete: list files and cycle through them

Trying to achieve the behavior mentioned in the posts below: make bash list the suggestions (like it does by default, as TAB is set to complete), but also cycle through suggestions on concurrent tabs. ...
1
vote
0answers
20 views

change global GNU readline history location

I was able to change the history location of some tools via envvars, e.g.: export PYTHONHISTFILE=/tmp/.python_history export NODE_REPL_HISTORY=/tmp/.node_repl_history export REDISCLI_HISTFILE=/tmp/....
0
votes
1answer
41 views

Using bind breaks shell

(WSL with Ubuntu 18.04) I have some configuration settings that I have used before and that can be seen recommended in various places across the internet (not to mention on SO). I hav placed them in ...
1
vote
0answers
33 views

re-read-init-file action in Bash

I have the following in my .inputrc file: "\C-x\C-r": re-read-init-file According to the readline man page. this should mean that pressing Ctrl+X, Ctrl+R should reread my .inputrc file. This is what ...
0
votes
0answers
24 views

Complete list of options for .inputrc / readline

I always knew you could switch between Vim and Emacs bindings for Bash by modifying .inputrc. I'm now realizing there are actually a few different useful options I've decided to turn on including: ...
0
votes
1answer
49 views

Can I rebind Ctrl-C to do the same as ESC in readline?

I have started using vi mode in bash (set -o vi), and my laptop has no escape key (stupid touch bar…) so its annoying to leave insert mode on the command line. This got me thinking that in Vim, I ...
0
votes
1answer
68 views

How do I remap function keys in readline bash vi (vi shell mode)?

Regarding mapping function keys in vi readline, I have read these two stackexchanges: Remap bash vi keys? Custom key bindings for vi shell mode, ie, "set -o vi"? I have a MacBookPro with a ...
1
vote
1answer
47 views

Rebinding reverse-search-history in bash

reverse-search-history is bound to C-r by default. One can type C-r to start the search, and then type C-r again to jump to an earlier match. I have bound reverse-search-history to \er (Alt-r). This ...
2
votes
2answers
48 views

How to bind a key combination to null in .inputrc?

You can bind keys like Ctrl-Left and Ctrl-Right in .inputrc like this: # Ctrl-Left "\033[1;5D": backward-word # Ctrl-Right "\033[1;5C": forward-word How would I bind Ctrl-Up and Ctrl-Down to nothing?...
1
vote
0answers
62 views

How to trigger a prompt redraw when the terminal window size changes?

So I created a trap to check if the change is being registered: trap 'echo $COLUMNS' WINCH And the change is indeed reflected. But my prompt is not redrawn, neither from re-issuing the $...
0
votes
0answers
40 views

Customising the incremental search prompt in bash

Bash has an incremental search feature for history entries. I believe (correct me if wrong) this is part of the readline library utilised by bash. Using man 3 readline and searching for terms like "...
1
vote
1answer
132 views

bash readline inputrc: bind key to a sequence of multiple commands

I have shift-tab bound to shell-expand-line in my .inputrc. However, I want shift-tab to also insert a space character after doing the shell-expand-line. How can I do this? This is what my .inputrc ...
1
vote
1answer
72 views

Read line BASH (Output $line and line below)

I have a question to this read line. I have in my file n lines. How can I store the value in the line below in the same loop step? Can maybe someone help me with that? Thank you Details: $ cat ...
1
vote
1answer
36 views

How to read a file line by line and put them as a variable?

im very new to linux and shell scripting. May I know how do you read a file line by line and pass each line as a variable? For example, lets say i have a file called abc.txt with these 2 lines as its ...
6
votes
2answers
101 views

Briefly jump to matching parentheses in Bash

In vim there is an option called showmatch. When you type a closing parenthesis in insert mode, this jumps the cursor to the matching opening parenthesis (at the same nesting level), then back again. ...
0
votes
2answers
88 views

Searching command history in any interpreter

By running an interpreter trough rlwrap I have access to the command history by pressing the up and down arrow keys. However, I would like to be able to search the command history like I do in Bash (...
3
votes
3answers
434 views

How to set Readline key bindings using ALT (Meta) or some other control key as prefix instead of `\C-` and `\e`?

I can only find examples of setting Readline key bindings using Control (\C-) or Escape (\e) as prefixes. In my case, on macOS, the \C- space is completely filled up by default key bindings, and the \...
0
votes
1answer
211 views

Shell script loop while not reading [closed]

I'm trying to figure out the best way to halt a running script using a keyboard shortcut while the terminal is not the active window. This led me to learn about watching keyboard events with cat /dev/...
1
vote
0answers
56 views

In GNU readline, How to change Alt key to Meta, instead of being ESC?

In GNU readline manual, it says the left Alt is usually Meta: The Meta key is labeled ALT on many keyboards. On keyboards with two keys labeled ALT (usually to either side of the space bar), the ...
7
votes
1answer
155 views

Why does GNU Readline's shell-expand-line command only expands the first occurrence of tilde (~)?

According to the Bash manual, the shell-expand-line GNU Readline command should expand the command-line, just as Bash normally would, including alias and history expansion. The current setting can be ...
3
votes
1answer
63 views

How to Set Readline key bindings in both vi-command and vi-insert modes

To use the Emacs transpose-words function in vi mode I have the following .inputrc: $if mode=vi bind Control-b: transpose-words $endif Unfortunately it only works in "insert" mode. What is the ...
2
votes
1answer
71 views

How to read readline key bindings

bind -P gives me back things like bracketed-paste-begin can be found on "\e[200~". revert-line can be found on "\e\C-r", "\er". previous-history can be found on "\C-p", "\eOA", "\e[A". How do I ...
1
vote
1answer
36 views

How do I tell readline to use an updated .inputrc?

I have updated my ~/.inputrc file to test out show-all-if-unmodified, and now want to try it out. How do I use it without logging off and back in?
1
vote
0answers
267 views

gcc: readline/libreadline.a: No such file or directory gcc: readline/libhistory.a: No such file or directory

I am trying to install python readline 6.2.4.1 package on SLES 11 SP3 but I am getting the following error: gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -...
0
votes
0answers
72 views

Redo not working correctly for (readline) `vi` command-line editing

I'm using vi command-line editing: shopt -o -s vi My problem is that while undo (u) works as expected, that is not true redo (.). In particular, if I've the following command-line AA BB CC, then ...
0
votes
0answers
100 views

readline suddenly stopped working in Python app under FreeBSD 12

I have a Python3 CRUD app that I've been using on by BSD VPS that started giving me the following error yesterday. ImportError: /usr/local/lib/python3.6/lib-dynload/readline.so: Undefined symbol "...
1
vote
1answer
41 views

“i” key is not functional in bash

In bash, the key that normally outputs the i character, stays dead. It does not output anything, no space no character, multiple keystrokes of same key do neither. This is happening on trisquel8, out ...
1
vote
1answer
73 views

How do I use bind (or .inputrc) to map two bash commands to one key?

Normally, I use vi mode in bash. It starts off in insert mode you have to hit Esc (or Altj was it?) to get into normal (command) mode. I also bind ↑ (up-arrow) to history-search-backward. What ...
-2
votes
1answer
113 views

What does `bind '“\C-i”: menu-complete'` do?

I would like to fill out a command which expects a file argument, by alternating the files in the current directory. So I followed Gilles' reply Bind the Tab key to the menu-complete command ...
3
votes
3answers
1k views

Alternative to Ctrl-R reverse search in bash

I am happy and really like the Ctrl-R backward search feature of the bash shell. Some of my colleagues don't like it, since it is sometimes confusing. I understand them. If you enter the wrong ...
0
votes
1answer
141 views

Bash not loading inputrc automatically

No matter what I try I can't get bash to load my ~/.inputrc file. The most minimal example I have tested is getting rid of my ~/.bashrc and then having a single line in my ~/.inputrc with set ...
1
vote
1answer
97 views

Readline: using tab as menu-complete, how do I “accept” the auto-completed directory and display the next level down?

I'm using the following settings on my readline (~/.inputrc): set show-all-if-ambiguous on set menu-complete-display-prefix on set completion-ignore-case on "\t": menu-complete "\e[Z": menu-complete-...
1
vote
0answers
33 views

how to detect state of bash readline using bash script?

for example; if [ 'readline is vi-command' ]; then echo 'normal mode' else echo 'insert mode' fi I really don't have any idea how to do this and I can't seem to find anything on the man pages ...
0
votes
0answers
49 views

How to trigger tmux copy-mode using bash `bind` command

I'm trying to trigger tmux copy-mode using bash builtin bind command only in readline normal mode(vi-move) using this: bind -m vi-move -x '"vv": "tmux copy-mode"' its working but the problem is, it ...
3
votes
1answer
234 views

Using multiple copy buffers in Bash

Ctrlu cuts text from current location to the beginning of line. Now, I can paste this with Ctrly whenever I want until the next time I hit Ctrlu to copy another line in the buffer. Now the problem I ...
0
votes
1answer
125 views

How to clear the screen from command line in GAP

Normally I can clear the screen with ctrl-L but while running GAP, ctr-l just displays the last command entered.
0
votes
2answers
72 views

Text from standard input not visible after program exits from a readline

I am facing an issue where the text from my stdin is not visible from on my terminal. My program does the following Sets a SIGALRM handler which exits a program when there is no input from the user ...
0
votes
1answer
1k views

How to get PHP 7.1 to use libreadline.so.8?

After an update of my Manjaro system, my PHP server stopped working, with the error "php: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or ...
0
votes
2answers
429 views

How to make Readline in vi mode to read .vimrc?

When using Readline's vi mode in Bash, I can use command v from normal mode, to open the current command line in Vim for editing. However, in this case, Vim does not read my ~/.vimrc file, so none of ...
1
vote
2answers
208 views

Why is my readline / .inputrc configuration being ignored?

I have a configuration line in my .inputrc: set enable-bracketed-paste on # Insert paste as a string rather than possibly running it This is valid when typed at the command line: bind 'set enable-...
0
votes
1answer
388 views

Input from readline owerwrites the prompt

I'm trying to create an interactive bash script, where i can call given options from 1-n or just them like commands. It will end up with a simulated prompt and 'read' is used to get the input, ofc. ...
-1
votes
2answers
193 views

What does “set keymap vi” actually do?

In an effort to vim-theme Readline, I see there are two set editing-mode vi set keymap vi I believe I understand what editing-mode vi does providing different VIM keymaps to edit, and insert text ...
0
votes
3answers
904 views

Shell - Print values in a comma separated string

I have a txt file with some comma separated values. cat file.txt abc,def,ghi abc,ghi def,abc,ghi def,abc abc,def abc,def,ghi I want to print these values with while do read line from file separated ...
0
votes
1answer
124 views

readline keybindings in chrome/chromium

Does a chrome/chromium extension exist that can configure often used readline keybindings? Specifically Ctrl+a for Home, Ctrl+e for End, Ctrl+d, etc for use within a text editing box. I have found ...
0
votes
1answer
62 views

prompt (PS1) doesn't update on bound command

I don't understand why these two different ways to use the same command lead to different behaviors. I've installed fzf and fd and have the following lines in .bashrc function updir(){ cd .. } ...
0
votes
1answer
40 views

Tab auto-deletion at command line

Running Ubuntu 18.04 and using bash. So I am aware of how to use tabs at the command line to auto-complete the next token with file paths and what have you. Question: is there an easy shortcut for ...
0
votes
0answers
194 views

how to make `.inputrc` keybindings to work on commands that are using `read`?

I have this snippet in my .inputrc to map jj as enter/return. "jj": "\C-M" It works well but not for commands that are using read, for example entering passwords. How can I make this to also work ...

1
2 3 4 5