You are not logged in.

#1 2017-08-08 19:44:12

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,393

bash: inputrc: Tune Bash tab completion.

~/.inputrc:

# Colour in <Tab> completions
set colored-stats on

# Case-insensitive matching when completing. Increases comfort a lot.
set completion-ignore-case on

# Don't double-tab for completion suggestions when the pattern is ambigious.
set show-all-if-ambiguous on

# The common prefix of all completion suggestions is shown in a different color.
set colored-completion-prefix on

More interesting settings may be available: https://cnswww.cns.cwru.edu/php/chet/re … rltop.html.


A silent kite against the blue, blue sky

Offline

#2 2017-08-09 02:01:46

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,231
Website

Re: bash: inputrc: Tune Bash tab completion.

My favourite, up-arrow for history completions. Type the start, then ↑ to get the recent commands beginning thus (I use this every day):

# some defaults / modifications for the emacs mode
$if mode=emacs

## --other stuff--

# use up & down arrows to search history
"\e[A":history-search-backward
"\e[B":history-search-forward
"\e[C": forward-char
"\e[D": backward-char

$endif

More:
https://ss64.com/bash/syntax-inputrc.html
https://www.gnu.org/software/bash/manua … -Init-File


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#3 2019-02-17 08:16:01

ohnonot
...again
Registered: 2015-09-29
Posts: 3,674
Website

Re: bash: inputrc: Tune Bash tab completion.

I came back to this whilst looking for a way to solve a different problem:
I was trying to find a way to make aliases reveal themselves when executed (so that I don't forget the original commands).
I tried by prepending each alias with a call to alias, e.g.:

alias grep='alias grep; grep --color=auto'

but it interferes with piping.

I tried to write a custom function that outputs the alias to stderr:

alias grep='alias_func grep; grep --color=auto'

but it still interferes with piping.

So I remembered that inputrc offered something pertaining to aliases.
The closest I got was by adding this to /etc/inputrc:

"\C-a": alias-expand-line

but it requires me to type Ctrl-a to execute it.

Any way to make aliases reveal themselves without intefering with piping?

PS:
There's some really cool stuff here. Got lost reading 'man bash', readline section.
I wish I knew enough to not break it. Some things remain unclear even after reading the docs, e.g. the bash builtin 'complete'...

PPS:
twoion, the link from your first post seems broken. Is that still available? If it's just a general introduction like johnraff posted, no need.

Offline

#4 2019-02-17 09:33:01

damo
....moderator....
Registered: 2015-08-20
Posts: 4,878

Re: bash: inputrc: Tune Bash tab completion.

ohnonot wrote:

...

Any way to make aliases reveal themselves without intefering with piping?
....

Not sure if it fits your use-case, but I have a "keybinds-pipemenu" for displaying various application keybinds, including aliases. The relevant command to show all aliases is

awk '$1 ~ /^alias/{$1 = "";print}' $HOME/.bash_aliases

Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB