Added autocompletion installation
This commit is contained in:
23
qcd_function
23
qcd_function
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user