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).
Comments
Just some other things I find useful,
Another great one to do is assign
^W(Ctrl-w) to beunix-filename-ruboutinstead of the defaultunix-word-rubout. This makes it so when you have your cursor (|) positioned herefoo/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-directoriesas -- by default -- bash doesn't put a/after symlinks when doing autocomplete. This fixes that.You can also bind a key to
glob-expand-wordwhich will take a bash glob -- say*-- and replace the glob with all the files that match that glob.The
bind-tty-special-charsis 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 enablingbind-tty-special-charsand also putting this,The
ifjust tests if we're in an actual terminal (i.e.,stdinis open).export
Awesome tips, thanks!
export