From: Oliver Kiddle <opk@u.genie.co.uk>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: PATCH: Support file url in _urls
Date: Thu, 07 Oct 1999 12:42:52 +0100 [thread overview]
Message-ID: <37FC873C.F3257422@u.genie.co.uk> (raw)
Following is a patch to _urls to allow it to support the file url:
file://<tab> will complete from .zsh/urls as for http/ftp
file:/<tab> will complete files from root
file:<tab> inserts the current directory. I find this behaviour
(which is done in the compctl example) extremely useful.
There is one slight problem: if the current directory is root then the
compadd -S '/' ~+ line will add two slashes - one for the current
directory '/' and one for the suffix. I can't think of a simple way off
the top of my head to chop any trailing slash off the end of ~+.
What is the bookmark url scheme? Is it something specific to Netscape or
Lynx because if so, handling of it should move to _lynx/_netscape. Or,
maybe we need to provide a way of specifying which url schemes are supported.
Lynx supports a finger url for example.
I'm not entirely convinced by the system of taking urls from a directory
structure. At the least I think there should be an alternative. For
example, if $compconfig[urls_path] doesn't exist, the basic host names
should complete after (http|file|ftp)://. I would also like a compconfig
option which says that the local host is a web server, named X, doc root
in Y and users own web pages in directory Z within their home so files on
a local web server are completed.
One thing which I would like to implement is to restrict file types used
with urls. This would probably depend upon the browser (Netscape handles
graphics, Lynx doesn't etc) but the parameters to _url are passed to
both _files and compadd so I'm restricted in what I can do here.
Shouldn't _webbrowser be ditched and the first line of _urls be changed
to the #compdef - it would be cleaner in my opinion. The only problem is
that the -f option would be lost for those commands. We could always
negate its meaning though.
Any comments?
Oliver Kiddle
*** Completion/User/_urls.bak Thu Oct 7 12:03:33 1999
--- Completion/User/_urls Thu Oct 7 12:33:20 1999
***************
*** 46,58 ****
scheme="${PREFIX%%:*}"
compset -P "[-+.a-z0-9]#:"
else
! compadd "$@" -S '' http:// ftp:// bookmark:
return
fi
case "$scheme" in
! http) compset -P // || { compadd "$@" -S '' //; return };;
! ftp) compset -P // || { compadd "$@" -S '' //; return };;
esac
if [[ "$scheme" = bookmark &&
--- 46,68 ----
scheme="${PREFIX%%:*}"
compset -P "[-+.a-z0-9]#:"
else
! compadd "$@" -S '' http:// ftp:// bookmark: file:
return
fi
case "$scheme" in
! http|ftp) compset -P // || { compadd "$@" -S '' //; return };;
! file)
! if [[ -prefix // ]]; then
! compset -P //
! elif [ -prefix / ]; then
! _files "$@"
! return
! elif [ ! "$PREFIX" ]; then
! compadd -S '/' ~+
! return
! fi
! ;;
esac
if [[ "$scheme" = bookmark &&
next reply other threads:[~1999-10-07 11:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-07 11:42 Oliver Kiddle [this message]
1999-10-07 11:47 ` Zefram
1999-10-07 13:21 ` Tanaka Akira
1999-10-07 13:26 ` Adam Spiers
[not found] ` <14332.42410.2764.422238@kevins>
1999-11-09 2:13 ` PATCH: automatically generate ~/.zsh/urls for use with _urls Adam Spiers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37FC873C.F3257422@u.genie.co.uk \
--to=opk@u.genie.co.uk \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).