zsh-users
 help / color / mirror / code / Atom feed
From: "Thomas Köhler" <jean-luc@picard.franken.de>
To: zsh-users@sunsite.dk
Subject: Re: Adding a prefix to certain filename completions
Date: Thu, 7 Jul 2005 21:00:49 +0200	[thread overview]
Message-ID: <20050707190049.GA11877@picard.franken.de> (raw)
In-Reply-To: <200507071254.j67CsHJh024834@news01.csr.com>

[-- Attachment #1: Type: text/plain, Size: 2667 bytes --]

Peter Stephenson wrote:
> Nikolai Weibull wrote:
> > Ah, of course.  There are many commands that can use this actually.
> > :help ex gives the following list:
> > 
> > ex exim view gvim gex gview rvim rview rgvim rgview evim eview vimdiff gvimdi
> > ff
> > 
> > and, as you say, there's usually a vi link as well,
> 
> This adds the vim-specific versions.  ex and view also come with vi.
> I'll wait for someone to decide how to manage these three.
> 
> Index: Completion/Unix/Command/_vim
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_vim,v
> retrieving revision 1.1
> diff -u -r1.1 _vim
> --- Completion/Unix/Command/_vim	7 Jul 2005 11:16:11 -0000	1.1
> +++ Completion/Unix/Command/_vim	7 Jul 2005 12:51:01 -0000
> @@ -1,4 +1,4 @@
> -#compdef vim
> +#compdef vim exim gvim gex gview rvim rview rgvim rgview evim eview vimdiff gvimdiff
>  
>  _vim_files () {
>    if [[ $(echo $PREFIX*(N)) == '' ]]; then

This whole discussion reminds me of some stuff that I always
wanted to clean up a bit...
My _vimhelp still depends on $VIM to be set (parsing "vim
--version" output for vim's fallback for $VIM should be no
problem), and removing sed out of the $vimversion calculation
below could maybe also be done. Anyways... for those who think
this might be useful:

----------------------- _vimhelp ---------------------
#compdef vimhelp gvimhelp

local vimversion curcontext="$curcontext" context state line expl ret tagsfile

vimversion=$(vim --version |& head -1 | sed -e 's/VIM - Vi IMproved //' -e 's/ .*//' -e 's/\.//' -e 's/^/vim/')
tagsfile=$VIM/$vimversion/doc/tags

_vimhelp_update_tags() {
  if (( ! $+_vimhelp_tags )); then
    _vimhelp_tags=(
      $(cat $tagsfile | sed -e 's/	.*//')
    )
  fi
}
_vimhelp() {
   _vimhelp_update_tags
   compadd -- $_vimhelp_tags
}

_vimhelp "$@"
---------------------- / .zshrc --------------------

----------------------- _vimhelp ---------------------
vimhelp () { vim -c "help $1" -c on -c "au! VimEnter *" }
gvimhelp () { gvim -c "help $1" -c on -c "au! VimEnter *" }
---------------------- / .zshrc --------------------

I was once thinking like
   vim -c "h<TAB>
=> vim -c "help
=> vim -c "help Z<TAB>
=> vim -c "help ZZ"
but then I just wrote my little vimhelp wrapper which was easier
to do...

Ciao,
Thomas

-- 
 Thomas Köhler       Email:       jean-luc@picard.franken.de
     <><             WWW:              http://gott-gehabt.de
                     IRC:                           tkoehler
                     PGP public key available from Homepage!

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-07-07 19:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-04 19:37 Nikolai Weibull
2005-07-05  0:13 ` William Scott
2005-07-05  8:07   ` Nikolai Weibull
2005-07-05 15:09     ` William Scott
2005-07-05 15:23     ` William Scott
2005-07-05  4:23 ` Thomas Köhler
2005-07-05  8:09   ` Nikolai Weibull
2005-07-05 14:25     ` William Scott
2005-07-05 17:28       ` Nikolai Weibull
2005-07-05 16:56         ` John Reese
2005-07-05 17:07         ` William Scott
2005-07-06  5:00       ` Bart Schaefer
2005-07-06 11:31         ` Nikolai Weibull
2005-07-07  2:02           ` Nikolai Weibull
2005-07-07  5:40             ` Bart Schaefer
2005-07-07  7:21               ` Dan Nelson
2005-07-07 10:58               ` Nikolai Weibull
2005-07-07 11:18                 ` Peter Stephenson
2005-07-07 11:58                   ` Doug Kearns
2005-07-07 12:11                   ` Nikolai Weibull
2005-07-07 12:54                     ` Peter Stephenson
2005-07-07 19:00                       ` Thomas Köhler [this message]
2005-07-07 14:51                 ` William Scott
2005-07-07 15:57                   ` Nikolai Weibull
2005-07-08  1:24                 ` Bart Schaefer
2005-07-08 10:12                   ` Nikolai Weibull
2005-07-05 17:01 ` Bart Schaefer
2005-07-05 19:14   ` Nikolai Weibull

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=20050707190049.GA11877@picard.franken.de \
    --to=jean-luc@picard.franken.de \
    --cc=zsh-users@sunsite.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).