Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: vim scp autocomplete
- X-seq: zsh-users 17381
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: shawn wilson <ag4ve.us@xxxxxxxxx>
- Subject: Re: vim scp autocomplete
- Date: Tue, 06 Nov 2012 19:20:46 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- 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=
- In-reply-to: <CAH_OBie4fh=RD5_nfoAPCMXSXb3BfVjphyKOYq7avAkfcv4fqw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAH_OBie4fh=RD5_nfoAPCMXSXb3BfVjphyKOYq7avAkfcv4fqw@mail.gmail.com>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author