[#149] Move compdef calls into their own files

This commit is contained in:
Sorin Ionescu 2012-06-03 20:45:53 -04:00
parent fdb3f4152f
commit 93e76b9e8d
3 changed files with 26 additions and 4 deletions

View File

@ -0,0 +1,12 @@
#compdef cdls popdls pushdls
#autoload
#
# Completes cdls, popdls, and pushdls.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
_cd

View File

@ -0,0 +1,14 @@
#compdef mkdcd
#autoload
#
# Completes mkdcd.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
_wanted directories expl \
'parent directory (alternatively specify name of directory)' \
_path_files -/ || _message 'name of directory'

View File

@ -126,25 +126,21 @@ alias pmine='ps -U "$USER" -o pid,%cpu,%mem,command'
function mkdcd { function mkdcd {
[[ -n "$1" ]] && mkdir -p "$1" && builtin cd "$1" [[ -n "$1" ]] && mkdir -p "$1" && builtin cd "$1"
} }
compdef '_path_files -/' mkdcd 2> /dev/null
# Changes to a directory and lists its contents. # Changes to a directory and lists its contents.
function cdls { function cdls {
builtin cd "$argv[-1]" && ls "${(@)argv[1,-2]}" builtin cd "$argv[-1]" && ls "${(@)argv[1,-2]}"
} }
compdef _cd cdls 2> /dev/null
# Pushes an entry onto the directory stack and lists its contents. # Pushes an entry onto the directory stack and lists its contents.
function pushdls { function pushdls {
builtin pushd "$argv[-1]" && ls "${(@)argv[1,-2]}" builtin pushd "$argv[-1]" && ls "${(@)argv[1,-2]}"
} }
compdef _cd pushdls 2> /dev/null
# Pops an entry off the directory stack and lists its contents. # Pops an entry off the directory stack and lists its contents.
function popdls { function popdls {
builtin popd "$argv[-1]" && ls "${(@)argv[1,-2]}" builtin popd "$argv[-1]" && ls "${(@)argv[1,-2]}"
} }
compdef _cd popdls 2> /dev/null
# Prints columns 1 2 3 ... n. # Prints columns 1 2 3 ... n.
function slit { function slit {