readline

What is the '.tee_history' file?

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 –version tee (GNU coreutils) 9.3 I have no use for the history. Can this logging be easily …

Total answers: 1

View text in kill-ring

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 Asked By: Nifle || Source Check this. It’s extremely hacky but it works: # from https://unix.stackexchange.com/a/217390/569343 # write provided text to the terminal input # (does not work in subshells) …

Total answers: 1

How to delete a region in the command line?

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? Asked By: ychaouche || Source In both readline and zsh, that’s the same kill-region …

Total answers: 1

ANSI escape sequences in PS1 cause incorrect length calculation

ANSI escape sequences in PS1 cause incorrect length calculation 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 of the prompt incorrectly. As a consequence, when entering longer commands, …

Total answers: 1

Customize the default word definition of GNU readline library?

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 makes it unintuitive when moving the cursor around. Is there a way to customize this word definition like consider all non …

Total answers: 1

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

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) Asked By: itil nonok || Source If …

Total answers: 1

How to increase the size of the .ed_history file

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 like to increase that limit, perhaps to …

Total answers: 1

How to enable up arrow in Rakudo REPL on Ubuntu 21.10?

How to enable up arrow in Rakudo REPL on Ubuntu 21.10? I’m installed Rakudo on Ubuntu 21.10 by running this command: sudo apt install rakudo Now I can run the Raku REPL by running raku or rakudo. I would like to be able to select the previous command by typing the up arrow, just like …

Total answers: 1

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

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 use my mouse to select …

Total answers: 1

How to disable libreadline's bracketed paste mode programmatically

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 can be globally disabled by adding this line to /etc/inputrc set enable-bracketed-paste off I know …

Total answers: 1

Is it possible to save `bc` command line history?

Is it possible to save `bc` command line history? bash has a handy file .bash_history in which it saves the history of commands and on the next execution of bash the history is populated with saved commands. Is it possible to save bc command history to a file in the same way and then load …

Total answers: 2

Insert the last argument in bash in vi mode without inserting a leading space

Insert the last argument in bash in vi mode without inserting a leading space Using bash in the default (emacs) mode I get the following behavior when I hit Esc, .. $ echo hello hello $ hello # I hit `<ESC>.` to insert this Note there is no space before the word hello that is inserted …

Total answers: 2

How to read readline key bindings

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 “eC-r”, “er”. previous-history can be found on “C-p”, “eOA”, “e[A”. How do I read this stuff? Is there a complete description somewhere? Asked By: Felix Dombek || Source While readline accepts …

Total answers: 1

Alternative to Ctrl-R reverse search in bash

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 characters, the current position in the history is somewhere in the past, and …

Total answers: 5

Is there a way to define a bash readline command?

Is there a way to define a bash readline command? 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 date: bind ‘”C-xx”: my-dynamical-date’ aaa …

Total answers: 2

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

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 is cleared, I can just scroll to …

Total answers: 5

Is there a POSIX shell alternative to read -e?

Is there a POSIX shell alternative to read -e? 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 one command. Asked By: Socob || Source The POSIX …

Total answers: 2

Moving by whitespace-delimited word in bash/readline

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. These are the forward-word and backward-word commands. (Meta-f can be either …

Total answers: 3