I use tab completion more than typing letters. I used to type rm ~/De<TAB>
and it would be completed to rm ~/Desktop/
so that I could continue on the next level.
Recently, that behaviour changed. The completion now yields rm ~/Desktop<SPACE>
, which means I must backspace and type the slash if I want to continue. This makes me cry.
The changes seem to be located in the function _longopt()
in /etc/bash_completion
, however that is as far as I can follow. Is this change intentional, and if so, what is it good for? Can I have the old behaviour back, preferably by a config option instead of just copying the old code over from some other system?
Edit: The function for reference.
_longopt()
{
local cur prev split=false
_get_comp_words_by_ref -n = cur prev
_split_longopt && split=true
case "$prev" in
--*[Dd][Ii][Rr]*)
_filedir -d
return 0
;;
--*[Ff][Ii][Ll][Ee]*|--*[Pp][Aa][Tt][Hh]*)
_filedir
return 0
;;
esac
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \
-- "$cur" ) )
elif [[ "$1" == @(mk|rm)dir ]]; then
_filedir -d
else
_filedir
fi
}
rmdir
, not formkdir
ortouch
._longopt()
function?readline
settings (have you a~/inputrc
file?) and on the fact that the item is a real directory or a symlink to a directory..inputrc
on this system anymore. (Those were the days, fixing backspace and cursor keys…) And it happens for all elements, directory or file, symlink or not.