about summary refs log tree commit diff
path: root/Functions/Zftp/zfinit
blob: fbe6c5979682220095bee4be608a01f611f2ddd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
emulate -L zsh

[[ $1 = -n ]] || zmodload -ia zftp

alias zfcd='noglob zfcd'
alias zfget='noglob zfget'
alias zfls='noglob zfls'
alias zfdir='noglob zfdir'
alias zfuget='noglob zfuget'

autoload -U zfanon zfautocheck zfcd zfcd_match zfcget zfclose zfcput
autoload -U zfdir zfgcp zfget zfget_match zfgoto zfhere zfinit zfls
autoload -U zfmark zfopen zfparams zfpcp zfput zfrglob zfrtime zfstat
autoload -U zftp_chpwd zftp_progress zftype zfuget zfuput

# only way of getting that noglob out of the way: this is unnecessary with
# widget-based completion and can be commented out.
setopt completealiases

#
# zftp completions: only use these if new-style completion is not
# active.
#
if [[ ${#_patcomps} -eq 0 || ${_patcomps[(i)zf*]} -gt ${#_patcomps} ]]; then
  compctl -f -x 'p[1]' \
    -k '(open params user login type ascii binary mode put putat
    get getat append appendat ls dir local remote mkdir rmdir delete
    close quit)'  - \
    '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,open][1,params]' -k hosts -- zftp
  compctl -K zfcd_match -S/ -q zfcd zfdir zfls
  compctl -K zfget_match zfget zfgcp zfuget zfcget
  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
fi