mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-07 11:41:16 +02:00
Load tcp module, zfcd_match, zfget_match where necessary.
This commit is contained in:
parent
d247b7f146
commit
87db190920
2 changed files with 51 additions and 6 deletions
|
@ -28,11 +28,13 @@ fi
|
||||||
case $subcom in
|
case $subcom in
|
||||||
*(cd|ls|dir))
|
*(cd|ls|dir))
|
||||||
# complete remote directories
|
# complete remote directories
|
||||||
|
[[ -z ${functions[zfcd_match]} ]] && autoload -U zfcd_match
|
||||||
_tags directories && zfcd_match $PREFIX $SUFFIX
|
_tags directories && zfcd_match $PREFIX $SUFFIX
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*(get(|at)|gcp|delete|remote))
|
*(get(|at)|gcp|delete|remote))
|
||||||
# complete remote files
|
# complete remote files
|
||||||
|
[[ -z ${functions[zfget_match]} ]] && autoload -U zfget_match
|
||||||
_tags files && zfget_match $PREFIX $SUFFIX
|
_tags files && zfget_match $PREFIX $SUFFIX
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,23 @@
|
||||||
[[ $1 = -n ]] || zmodload -ia zftp
|
emulate -L zsh
|
||||||
|
|
||||||
|
if [[ $1 != -n ]]; then
|
||||||
|
zmodload -i zsh/net/tcp || return 1
|
||||||
|
zmodload -ia zsh/zftp zftp || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if zmodload -i zsh/zutil; then
|
||||||
|
local arr
|
||||||
|
# Set defaults for styles if none set.
|
||||||
|
zstyle -g arr ':zftp:*' progress || zstyle ':zftp:*' progress bar
|
||||||
|
zstyle -g arr ':zftp:*' update || zstyle ':zftp:*' update 1
|
||||||
|
zstyle -g arr ':zftp:*' titlebar || zstyle ':zftp:*' titlebar true
|
||||||
|
if functions chpwd >&/dev/null && ! zstyle -g arr ':zftp:*' chpwd; then
|
||||||
|
zstyle ':zftp:*' chpwd true
|
||||||
|
fi
|
||||||
|
|
||||||
|
typeset -gA zfconfig
|
||||||
|
zfconfig=(lastsession default)
|
||||||
|
fi
|
||||||
|
|
||||||
alias zfcd='noglob zfcd'
|
alias zfcd='noglob zfcd'
|
||||||
alias zfget='noglob zfget'
|
alias zfget='noglob zfget'
|
||||||
|
@ -6,23 +25,47 @@ alias zfls='noglob zfls'
|
||||||
alias zfdir='noglob zfdir'
|
alias zfdir='noglob zfdir'
|
||||||
alias zfuget='noglob zfuget'
|
alias zfuget='noglob zfuget'
|
||||||
|
|
||||||
# only way of getting that noglob out of the way: this is unnecessary with
|
autoload -U zfanon zfautocheck zfcd zfcd_match zfcget zfclose zfcput
|
||||||
# widget-based completion and can be commented out.
|
autoload -U zfdir zffcache zfgcp zfget zfget_match zfgoto zfhere zfinit zfls
|
||||||
setopt completealiases
|
autoload -U zfmark zfopen zfparams zfpcp zfput zfrglob zfrtime zfsession
|
||||||
|
autoload -U zfstat zftp_chpwd zftp_progress zftransfer zftype zfuget zfuput
|
||||||
|
|
||||||
#
|
#
|
||||||
# zftp completions: only use these if new-style completion is not
|
# zftp completions: only use these if new-style completion is not
|
||||||
# active.
|
# active.
|
||||||
#
|
#
|
||||||
if [[ ${#patcomps} -eq 0 || ${patcomps[(i)zf*]} -gt ${#patcomps} ]]; then
|
if [[ ${#_patcomps} -eq 0 || -z ${_patcomps[(r)_zf*]} ]]; then
|
||||||
|
# only way of getting that noglob out of the way: this is unnecessary with
|
||||||
|
# widget-based completion
|
||||||
|
setopt completealiases
|
||||||
|
|
||||||
compctl -f -x 'p[1]' \
|
compctl -f -x 'p[1]' \
|
||||||
-k '(open params user login type ascii binary mode put putat
|
-k '(open params user login type ascii binary mode put putat
|
||||||
get getat append appendat ls dir local remote mkdir rmdir delete
|
get getat append appendat ls dir local remote mkdir rmdir delete
|
||||||
close quit)' - \
|
close quit)' - \
|
||||||
'w[1,cd][1,ls][1,dir][1,rmdir]' -K zfcd_match -S/ -q - \
|
'w[1,cd][1,ls][1,dir][1,rmdir]' -K zfcd_match -S/ -q - \
|
||||||
'W[1,get*]' -K zfget_match - 'w[1,delete][1,remote]' -K zfget_match - \
|
'W[1,get*]' -K zfget_match - 'w[1,delete][1,remote]' -K zfget_match - \
|
||||||
'w[1,open][1,params]' -k hosts -- zftp
|
'w[1,open][1,params]' -k hosts - \
|
||||||
|
'w[1,session]' -s '${$(zftp session):#$ZFTP_SESSION}' -- zftp
|
||||||
compctl -K zfcd_match -S/ -q zfcd zfdir zfls
|
compctl -K zfcd_match -S/ -q zfcd zfdir zfls
|
||||||
compctl -K zfget_match zfget zfgcp zfuget zfcget
|
compctl -K zfget_match zfget zfgcp zfuget zfcget
|
||||||
compctl -k hosts zfanon zfopen zfparams
|
compctl -k hosts zfanon zfopen zfparams
|
||||||
|
compctl -s \
|
||||||
|
'$(awk '\''{print $1}'\'' ${ZFTP_BMFILE:-${ZDOTDIR:-$HOME}/.zfbkmarks})' \
|
||||||
|
-x 'W[1,-*n*]' \
|
||||||
|
-s '$(awk -F, '\''NR > 2 { print $1 }'\'' ~/.ncftp/bookmarks)' -- \
|
||||||
|
zfgoto zfmark
|
||||||
|
compctl -s '${$(zftp session):#$ZFTP_SESSION}' zfsession
|
||||||
|
# in _zftp for new completion, but hard to inline into a compctl
|
||||||
|
zftransfer_match() {
|
||||||
|
local sess=${1%%:*} oldsess=$ZFTP_SESSION
|
||||||
|
[[ -n $sess ]] && zftp session $sess
|
||||||
|
zfget_match ${1#*:} $2
|
||||||
|
[[ -n $sess && -n $oldsess ]] && zftp session $oldsess
|
||||||
|
reply=(${sess}:${^reply})
|
||||||
|
}
|
||||||
|
compctl -s '$(zftp session)' -S : -x 'C[0,*:*]' \
|
||||||
|
-K zftransfer_match -- zftransfer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
Loading…
Reference in a new issue