From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21764 invoked by alias); 6 Nov 2012 18:26:06 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17381 Received: (qmail 21927 invoked from network); 6 Nov 2012 18:26:03 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1352226046; bh=AVV6QSeDPoTg7tBH50gAkuE9Dq8VqQexYAeAsAZQ104=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:cc:In-reply-to:From:References:To:Subject:Date:Message-ID; b=GYloMf/YXmFYKWzNJkkMNz+lF49L/Ef6W2usd0SJ8b3mIa2fOxOU1F9V8nJ8gqdJpP9MHB3U+Rs4vka+0NzQfmrECau1Q56u38gyZ9YJ5bGQgiEnqnVr6ALlBTZnWnWJj/vs/xPxDISfFZ8EpwSU5C+wNoQkaVTKsgppvLc1hRE= X-Yahoo-Newman-Id: 970040.31624.bm@smtp111.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: PXwIoIUVM1nN6L0JXlPQ2Z.xnPjcvAAtUWl.2o2gybDA3s9 iHeJ8AImQX_vuD1lLcg_T1qP6tjB1kehEqGbEkPrtHKRLniLtQy68mscd4UD ecvk5opy10zcL67S7xdZIKZTs35DPi.T3nLkdsi3emLNl5.B0S3gUD1CRhX6 4sOlsWpGt1QyW9sr4.NWM5MF4Rn1wzmV7VjRwcrhE2HT.PCzxdMpm3hy4Fge 2ZrxbeVMvmpPb5.FlMSy3yScI4Raq2vBgpBScYXU1jiRgXQh1VS1sml3xI8. uPmd2RbV5W.IFxszPntZu7LlXtvLurAbvs3VXeE.o1W2gn0.XfdIlzxbgeai GKJGuOHXRk53iXTq3iYd3F8x37heRwApwhLFHr0swJN1OR0A2GICE9UemyOJ r.aU4AKdavvUGu3K8W1gyaszFxTbJI9F9bEGM_vFSIsw51iBQJ7ljsRYdE93 W2b.ya_JaauSiOBxFhGJvN_4IDZ7ztJ91.ZFUy.FapWbc.A5SiX1ZvE8JnuV Yd3IT5zgP19ix.oceApZMMXGNQal.jFsGc2v6auPzGQYp0lqZRPjnZuD_xoy jlaI- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- cc: Zsh Users In-reply-to: From: Oliver Kiddle References: To: shawn wilson Subject: Re: vim scp autocomplete Date: Tue, 06 Nov 2012 19:20:46 +0100 Message-ID: <12933.1352226046@thecus.kiddle.eu> shawn wilson wrote: > i'm curious if anyone has gotten this working? > > i found this: > http://stackoverflow.com/questions/7197021/custom-autocompletion-for-zsh > and i'm sure i can/will (eventually) figure this out. but i just > figured i'd ask if anyone has done this first. I've got something half finished which I attach below. Actually, as far as vim is concerned this should basically do the job. To finish this, I wanted to do some work on _remote_files to make it use an interface closer to _files: -/ instead of --no-files for example. I've got a lot of half-finished functions and really ought to find time to finish them off. Oliver diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index 2c9b0a1..8d0610d 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -4,6 +4,7 @@ _vim_files () { case $PREFIX in (+*) _files -P './' $* && return 0 ;; + (scp|http(|s)|(|s)ftp):*) _urls ;; (*) _files $* ;; esac case $PREFIX in diff --git a/Completion/Unix/Type/_urls b/Completion/Unix/Type/_urls index b53f5a0..87f73f8 100644 --- a/Completion/Unix/Type/_urls +++ b/Completion/Unix/Type/_urls @@ -75,7 +75,7 @@ fi scheme="$match[1]" case "$scheme" in - http(|s)|ftp|gopher) + http(|s)|(|s)ftp|scp|gopher) if ! compset -P //; then _wanted -C "$scheme" prefixes expl 'end of prefix' compadd -S '' "$@" // return @@ -143,7 +143,7 @@ host="$match[1]" # Complete part after hostname -_tags -C local files || return 1 +_tags remote-files files || return 1 if [[ "$localhttp_servername" = "$host" ]]; then if compset -P \~; then @@ -170,10 +170,12 @@ if [[ "$localhttp_servername" = "$host" ]]; then fi else while _tags; do - while _next_label files expl 'local file'; do + (( $#urls )) && while _next_label files expl 'local file'; do _path_files "$expl[@]" "$@" -W $urls/$scheme/$host "${glob[@]}" && ret=0 _path_files -S/ -r '/' "$expl[@]" -W $urls/$scheme/$host -/ && ret=0 done + [[ $scheme = (scp|sftp) ]] && _requested remote-files && + _remote_files -- ssh && ret=0 (( ret )) || return 0 done fi