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
vote
1answer
37 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
25 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 ...
-1
votes
1answer
41 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 ...
2
votes
3answers
240 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
45 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
27 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
21 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
20 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 ...
0
votes
0answers
31 views

Mimic command on Linux

I find it really useful when using osx to have the Control key freed up to use emacs-like shortcuts in most applications, but in Linux it tends to be used for shortcuts instead. Is there a way to ...
3
votes
1answer
64 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
0answers
77 views

`~/.inputrc` vi editing mode with emacs shortcut keys, `Control-e: end-of-line` not working

I am using Debian 9 with the Bash shell as default. This is my ~/.inputrc file. set editing-mode vi set show-mode-in-prompt on set vi-ins-mode-string "+ " set vi-cmd-mode-string "- " # in vi-command ...
0
votes
1answer
38 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
0answers
48 views

bash COMPREPLY with custom colors

Is there a way to have a COMPREPLY return colored output? I can get it to work when readline recognizes the output as a folder when I have bind "set colored-stats on", but I can't make my own colors. ...
0
votes
0answers
14 views

Ctrl-Y yanking in Node repl doesn't work

I like interactively working in a REPL, so I was a bit confused when firing up Node's node process and seeing that all the readline shortcuts I usually use worked as normal, except yanking with Ctrl-Y....
0
votes
2answers
55 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
931 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
165 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
111 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
141 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
66 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
185 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
0answers
45 views

How to bind a key in bash to a function that modifies the current command line

This is an extension to: https://stackoverflow.com/questions/4200800/in-bash-how-do-i-bind-a-function-key-to-a-command. I am looking for a way (through bash and/or readline) to bind a key to a ...
0
votes
1answer
68 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
43 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
38 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
113 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 ...
2
votes
1answer
54 views

Generate brace expansion from list of files

This brace expression will generate a list of files: $ touch {foo{.t,t.t},other.txt,test{,.{ascii,t{est.qt,x{t,xt}}}}} $ ls foo.t foot.t other.txt test test.ascii test.test.qt test.txt test.txxt ...
2
votes
1answer
117 views

bash in-line brace expansion

Does bash/readline have a binding or a function that a key combination can be binded to in order to expand in-line braces? Similar to the way M-* key combination can be used for in-line globbing ...
1
vote
2answers
225 views

How can I permanently correct a typo in my last bash command?

It's not uncommon that I make a typo when entering commands in my bash interactive shell. I'd like to be able to correct the typo in my bash history so that the incorrect command does not pollute it ...
0
votes
1answer
79 views

Rlwrap vi-movement-mode does not work with some programs

With rlwrap cat or rlwrap bash I can use keybinding "jk" to exit from insert mode. This does not work with rlwrap ghci. Why?
1
vote
1answer
44 views

What are bindable variables?

Reading Bash-4.4 Release Available, I noticed the following sentence. There is a new bindable variable, `colored-completion-prefix', which, if set, causes the common prefix of a set of ...
5
votes
2answers
577 views

Is there a way to define a bash readline command? [closed]

I can not find a way to do that from bash. So Is there a way to define a bash readline shortcut that will insert a dynamically generated string at the position of the cursor? E.g., I want to insert ...
0
votes
6answers
125 views

Replace counter field in large file with iterated value

I have a huge text file with about 70k lines in it. My objective is to read this file, match a pattern ("Count"), and add or replace its value with an iterated number. What I'm doing is : Reading ...
1
vote
0answers
43 views

How do I clear a suggestion from history-beginning-search-backward or history-beginning-search-forward?

How do I clear a suggestion when history-beginning-search-backward is invoked? For example: sudo vim #history-beginning-search-backward gets executed by a keybinding sudo vim /etc/hosts Once in ...
0
votes
1answer
721 views

SUSE Linux Enterprise - Python3 error with readline in /etc/inputrc

When I start a python3 shell on my machine, I get the following warnings: $ python3 Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) [GCC 7.2.0] on linux Type "help", "copyright", "...
1
vote
1answer
69 views

I can't print the default text in the Readline input

I am writing an interface to my database and would like to be able to edit entries. I thought I'd use Readline, but can't get it work. I'd say my code should work, based on Term::ReadLine::Gnu and ...
0
votes
1answer
50 views

Readline “Miscellaneous Commands” not found

In trying to read in my inputrc file, I was reading https://www.gnu.org/software/bash/manual/bashref.html#Miscellaneous-Commands: re-read-init-file (C-x C-r) Read in the contents of the inputrc ...
0
votes
0answers
37 views

How do I copy to clipboard text I cut with Ctrl+U? [duplicate]

In an interactive shell session, how do I copy to clipboard text that was cut with Ctrl+U? Without using the mouse, obviously. Thus making it available for other GUI applications, instead of pastable ...
-1
votes
1answer
744 views

reading output into variables inside the os.system command

I have a python script which runs in Linux. I need to capture a command's output and store into variables and then should print the output. Code below - #!/usr/bin/python import os, time systime=os....
1
vote
2answers
254 views

On backspace, `bash read -e` also deletes same-line printf (preexistent) text

I use printf "input: "; read -e. I type something then I press Backspace. When reaching the last character, this deletes the input: part together with it. Backspace doesn't misbehave if I hadn't typed ...
2
votes
1answer
1k views

The easiest way to clear scrollback buffer of terminal + some deeper explanation?

Why bother? Clearing scrollback buffer is handy in many ways, for example, when I wish to run some command with long output, and want to quickly scroll to start of this output. When scrollback buffer ...
-1
votes
1answer
62 views

Readline keymapping C-/ not working

I have the following line in my .inputrc which does not appear to be working: "\C-/": insert-comment When I press C-/ I expect the current line to be prefixed with the comment character (#) and ...
5
votes
2answers
1k views

Is there a POSIX shell alternative to read -e? [duplicate]

How can I achieve the effects of read -e (which turns on line editing via readline and is available in bash) from a general (POSIX) shell? I don’t want to lose POSIX compatibility just because of this ...
1
vote
1answer
124 views

printing and not executing the result of zsh history expansion on partial search

I could do: !systemctl:p to get systemctl reload bind result printed (as last command in the history starting with systemctl string). but doing the same with the partial search on the command ...
3
votes
2answers
182 views

Moving by whitespace-delimited word in bash/readline

In bash line editing (or in any program that uses GNU readline), Meta-f moves to the right by one "word" and Meta-b move to the left by one "word", where a "word" is composed of letters and digits. ...
3
votes
1answer
193 views

Question on variables in /etc/inputrc

In my /etc/inputrc file I have several set statements as noted below. Do all those variables belong to Readline ? How do I see the currently set values for those variables ? For bash variables I can ...
-3
votes
2answers
197 views

inter process comunication in bash read commands in multiple background functions

I'm trying to get the following code to read from a main input then read that in one function then be able to send that into the input of another function but i am having trouble getting it to work ...
2
votes
1answer
213 views

bind to string with escaped double-quotes

I'm trying to bind Alt-s to an SSH command that is quite complex and requires nested double quotes. bind '"\es":"ssh -t me@myserver \"echo \\"hi\\"; echo \\"bye\\"\""' But when I execute the ...
2
votes
3answers
307 views

How to prevent `rlwrap` from saving a password in an input history file?

I'm using the rlwrap utility inside the following shell alias: alias gp='rlwrap git push' The purpose of this gp alias is to be able to use basic line editing commands such as C-a or C-e to get to ...
3
votes
2answers
824 views

unbind default key from inputrc

What I want to do is made C-h not send backwards-delete-char there is nothing about it in my inputrc files but is shows up in bind -p