Browse Source

[#149] Move compdef calls into their own files

master
Sorin Ionescu 13 years ago
parent
commit
93e76b9e8d
  1. 12
      modules/utility/functions/_cdls_popdls_pushdls
  2. 14
      modules/utility/functions/_mkdcd
  3. 4
      modules/utility/init.zsh

12
modules/utility/functions/_cdls_popdls_pushdls

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

14
modules/utility/functions/_mkdcd

@ -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'

4
modules/utility/init.zsh

@ -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 {

Loading…
Cancel
Save