Added autocompletion installation

This commit is contained in:
ville rantanen
2013-09-02 17:44:47 +03:00
parent f890073c57
commit 8137e9d453

View File

@@ -21,7 +21,7 @@ function qcd() {
local opt
local case
while getopts aiLl:hm opt
while getopts aiILl:hm opt
do case "$opt" in
a)
# Adding
@@ -37,6 +37,25 @@ function qcd() {
i)
case="-i"
;;
I)
echo "See ~/.bash_completion for possible duplicates"
echo '
have qcd &&
_qcd()
{
local cur
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-i -h -l -L -m ' -- $cur ) )
return 0
fi
COMPREPLY=( $( compgen -W "$( grep -h ^"$cur" ~/.qcd <( tac ~/.bash_cdhistory ) | cut -d: -f1 )" ) )
}
complete -F _qcd qcd
' >> ~/.bash_completion
return
;;
L)
echo ==History ~/.bash_cdhistory:
cat ~/.bash_cdhistory
@@ -76,6 +95,7 @@ Keeps a history of folders visited in ~/.bash_cdhistory
You may add the name of the path, but when omitted
the basename will be used
-i Case insensitive search, must come first.
-I Install autocompletion (use only once)
-l [name] Show the match, but do not change
-L Lists the paths
-m Maintain the list, deleting non-existing entries'
@@ -101,6 +121,7 @@ Keeps a history of folders visited in ~/.bash_cdhistory
}
function whenfilechanges() {
[ -z "$1" ] && { echo 'Usage: whenfilechanges "file" "some" "command"
Follows the modification time of the "file" and runs the command