zsh-users
 help / color / mirror / code / Atom feed
* zsh completion of just latex files
@ 2004-06-22 18:30 zzapper
  2004-06-22 23:05 ` Sartoo
  2004-06-23  7:01 ` Bart Schaefer
  0 siblings, 2 replies; 9+ messages in thread
From: zzapper @ 2004-06-22 18:30 UTC (permalink / raw)
  To: zsh-users

Hi,

In a directory full of latex files *.tex and all the *.toc *.dvi etc I
want a widget to only complete *.tex  file eg

vtex some_tex_file.tex

I would normally write a function for this, but I guess I should be
thinking zsh.

How should I do this?


zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-22 18:30 zsh completion of just latex files zzapper
@ 2004-06-22 23:05 ` Sartoo
  2004-06-23  7:01 ` Bart Schaefer
  1 sibling, 0 replies; 9+ messages in thread
From: Sartoo @ 2004-06-22 23:05 UTC (permalink / raw)
  To: zsh-users

* zzapper wrote:
> Hi,
Hi, 
> In a directory full of latex files *.tex and all the *.toc *.dvi etc I
> want a widget to only complete *.tex  file eg
 
> vtex some_tex_file.tex

> I would normally write a function for this, but I guess I should be
> thinking zsh.
 
> How should I do this?

#v+
compctl -g '*.tex*' + -g '*(-/)' {la,v}tex pdflatex
#v-

I discovered this line in my ~/.zshrc and it works well, well enough for
me, maybe also for you.

For further information you have to RTFM zshcompctl(1).

> zzapper (vim, cygwin, wiki & zsh)

Sartoo

-- 
Mitleid gibt's umsonst mein Freund  -
Neid, muss man sich verdienen.
  -- BO Nr.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-22 18:30 zsh completion of just latex files zzapper
  2004-06-22 23:05 ` Sartoo
@ 2004-06-23  7:01 ` Bart Schaefer
  2004-06-23  7:08   ` Pierre HABOUZIT
  2004-06-23  7:59   ` zzapper
  1 sibling, 2 replies; 9+ messages in thread
From: Bart Schaefer @ 2004-06-23  7:01 UTC (permalink / raw)
  To: zsh-users

On Tue, 22 Jun 2004, zzapper wrote:

> In a directory full of latex files *.tex and all the *.toc *.dvi etc I
> want a widget to only complete *.tex  file eg
> 
> vtex some_tex_file.tex
> 
> How should I do this?

Assuming (a) that you're using compsys rather than compctl and (b) that 
there isn't already a specialized completer for "vtex", the way to do this
is with the zstyle mechanism, specifically the file-patterns style.  The
example in the manual is very similar to this:

zstyle ':completion:*:*:vtex:*' file-patterns \
	'*.tex:tex-files' '*.toc:toc-files *.dvi:dvi-files' '%p:all-files'

This means to first try to complete tex files, then (simultaneously, note
that the next two specs are both in the same string) toc or dvi files if
there are no tex, and finally all files.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-23  7:01 ` Bart Schaefer
@ 2004-06-23  7:08   ` Pierre HABOUZIT
  2004-06-29 15:29     ` Bart Schaefer
  2004-06-23  7:59   ` zzapper
  1 sibling, 1 reply; 9+ messages in thread
From: Pierre HABOUZIT @ 2004-06-23  7:08 UTC (permalink / raw)
  To: zsh-users

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

> Assuming (a) that you're using compsys rather than compctl and (b) that 
> there isn't already a specialized completer for "vtex", the way to do this
> is with the zstyle mechanism, specifically the file-patterns style.  The
> example in the manual is very similar to this:
> 
> zstyle ':completion:*:*:vtex:*' file-patterns \
> 	'*.tex:tex-files' '*.toc:toc-files *.dvi:dvi-files' '%p:all-files'
> 
> This means to first try to complete tex files, then (simultaneously, note
> that the next two specs are both in the same string) toc or dvi files if
> there are no tex, and finally all files.

I would like to do something like that but that creates a new group
name. for me it's not with vtex at all, but for kghostview (a gv like)

I would like to have two groups :

---- PostScript or PDF files

printing on my screen before the file list.
(btw I have the correct formats in my .zshrc)

is that possible ?

-- 
Pierre Habouzit
 
http://www.madism.org/

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-23  7:01 ` Bart Schaefer
  2004-06-23  7:08   ` Pierre HABOUZIT
@ 2004-06-23  7:59   ` zzapper
  2004-06-23 15:39     ` zzapper
  1 sibling, 1 reply; 9+ messages in thread
From: zzapper @ 2004-06-23  7:59 UTC (permalink / raw)
  To: zsh-users

On Wed, 23 Jun 2004 00:01:01 -0700 (PDT),  wrote:

>On Tue, 22 Jun 2004, zzapper wrote:
>
>> In a directory full of latex files *.tex and all the *.toc *.dvi etc I
>> want a widget to only complete *.tex  file eg
>> 
>> vtex some_tex_file.tex
>> 
>> How should I do this?
>
>Assuming (a) that you're using compsys rather than compctl and (b) that 
>there isn't already a specialized completer for "vtex", the way to do this
>is with the zstyle mechanism, specifically the file-patterns style.  The
>example in the manual is very similar to this:
>
>zstyle ':completion:*:*:vtex:*' file-patterns \
>	'*.tex:tex-files' '*.toc:toc-files *.dvi:dvi-files' '%p:all-files'
>
>This means to first try to complete tex files, then (simultaneously, note
>that the next two specs are both in the same string) toc or dvi files if
>there are no tex, and finally all files.
>
Pardon my ignorance, do I have 2 choose between the two methods of
completion compsys and compctl, can I mix them, do I have to activate
one or the other?

(Sorry a lot of zsh help still baffles me, I'll get there but I just
haven't grasped the principles)

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-23  7:59   ` zzapper
@ 2004-06-23 15:39     ` zzapper
  2004-06-23 19:08       ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: zzapper @ 2004-06-23 15:39 UTC (permalink / raw)
  To: zsh-users

On Wed, 23 Jun 2004 08:59:30 +0100,  wrote:


>>
>>zstyle ':completion:*:*:vtex:*' file-patterns \
>>	'*.tex:tex-files' '*.toc:toc-files *.dvi:dvi-files' '%p:all-files'
>>
>>This means to first try to complete tex files, then (simultaneously, note
>>that the next two specs are both in the same string) toc or dvi files if
>>there are no tex, and finally all files.
>>
to be more specifc the above method didn't work for while the "old"
method from Sartoo worked just fine

compctl -g '*.tex*' + -g '*(-/)' {la,v}tex pdflatex

zzapper (vim, cygwin, wiki & zsh)
--

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tips/tip.php?tip_id=305  Best of Vim Tips


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-23 15:39     ` zzapper
@ 2004-06-23 19:08       ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2004-06-23 19:08 UTC (permalink / raw)
  To: zsh-users

On Wed, 23 Jun 2004, zzapper wrote:

> Pardon my ignorance, do I have 2 choose between the two methods of
> completion compsys and compctl, can I mix them, do I have to activate
> one or the other?

You have to activate compsys (by calling "compinit" from your ~/.zshrc) in 
order to use it; the default is compctl.

Once activated, compsys can be told to fall back on compctl for anything
that it's not able to handle, but there is no way to have compctl tried
first and then fall back on compsys.

(I believe the compsys fallback to compctl happens without any need for
special intervention, that is, you have to set a style to turn it _off_.
The style name is "use-compctl".)

On Wed, 23 Jun 2004, zzapper wrote:

> On Wed, 23 Jun 2004 08:59:30 +0100,  wrote:
> 
> >>zstyle ':completion:*:*:vtex:*' file-patterns \
> >>	'*.tex:tex-files' '*.toc:toc-files *.dvi:dvi-files' '%p:all-files'
> >>
> to be more specifc the above method didn't work for while the "old"
> method from Sartoo worked just fine

I suspect that means you've not called "compinit".

	autoload -U compinit
	compinit


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-23  7:08   ` Pierre HABOUZIT
@ 2004-06-29 15:29     ` Bart Schaefer
  2004-06-29 16:25       ` Pierre HABOUZIT
  0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2004-06-29 15:29 UTC (permalink / raw)
  To: zsh-users

On Wed, 23 Jun 2004, Pierre HABOUZIT wrote:

> [I, that is Bart, wrote:]
> > zstyle ':completion:*:*:vtex:*' file-patterns \
> > 	'*.tex:tex-files' '*.toc:toc-files *.dvi:dvi-files' '%p:all-files'
> 
> I would like to do something like that but that creates a new group
> name.

That's essentially what the above example does, except that it doesn't
supply descriptions for the groups.

In the doc for the file-patterns style, you'll find:

     The TAGs of all strings in the value will be offered by _files and
     used when looking up other styles.  Any TAGs in the same word will
     be offered at the same time and before later words.  If no `:TAG'
     is given the `files' tag will be used.

     The TAG may also be followed by an optional second colon and a
     description, which will be used for the `%d' in the value of the
     format style (if that is set) instead of the default description
     supplied by the completion function.  If the description given
     here contains itself a `%d', that is replaced with the description
     supplied by the completion function.

So something like:

 zstyle ':completion:*:*:kghostview:*' file-patterns \
     '*.(ps|pdf):pspdf-files:PostScript\ or\ PDF\ files' \
     '%p:all-files:all\ other\ files'


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: zsh completion of just latex files
  2004-06-29 15:29     ` Bart Schaefer
@ 2004-06-29 16:25       ` Pierre HABOUZIT
  0 siblings, 0 replies; 9+ messages in thread
From: Pierre HABOUZIT @ 2004-06-29 16:25 UTC (permalink / raw)
  To: zsh-users

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

>      '*.(ps|pdf):pspdf-files:PostScript\ or\ PDF\ files' \
ok, I only missed the :PostScript\ or\ PDF\ files' part.
thank you very much !
-- 
Pierre Habouzit
 
http://www.madism.org/

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-06-29 16:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-22 18:30 zsh completion of just latex files zzapper
2004-06-22 23:05 ` Sartoo
2004-06-23  7:01 ` Bart Schaefer
2004-06-23  7:08   ` Pierre HABOUZIT
2004-06-29 15:29     ` Bart Schaefer
2004-06-29 16:25       ` Pierre HABOUZIT
2004-06-23  7:59   ` zzapper
2004-06-23 15:39     ` zzapper
2004-06-23 19:08       ` Bart Schaefer

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).