Topic: https://brettterpstra.com/2011/09/25/quick-tip-some-inputrc-fun/
hide preview

What's next? verify your email address for reply notifications!

Donald 13y, 176d ago

Just some other things I find useful,

Another great one to do is assign ^W (Ctrl-w) to be unix-filename-rubout instead of the default unix-word-rubout. This makes it so when you have your cursor (|) positioned here foo/bar/test.txt| and hit C-w, it just deletes up to the first / character. This makes fixing thinigs a bit easier. It also works within a path.

You may also want to set mark-symlinked-directories as -- by default -- bash doesn't put a / after symlinks when doing autocomplete. This fixes that.

You can also bind a key to glob-expand-word which will take a bash glob -- say * -- and replace the glob with all the files that match that glob.

set bind-tty-special-chars on
set mark-symlinked-directories on
set prefer-visible-bell on
"\C-w": unix-filename-rubout
"": unix-filename-rubout
"\C-x*": glob-expand-word

The bind-tty-special-chars is so that I can use C-s and C-r to search forward and backwards, respectively, in my command history. Normally C-s taken over by the tty but by enabling bind-tty-special-chars and also putting this,

# this is a bugfix for certain terminals so that all eamcs bindings
# work.
if [ -t 0 ]; then
stty stop undef
stty werase undef
fi

The if just tests if we're in an actual terminal (i.e., stdin is open).

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 176d ago

Awesome tips, thanks!

hide preview

What's next? verify your email address for reply notifications!