zsh-users
 help / color / mirror / code / Atom feed
* New zsh user, I have a few questions.
@ 2002-04-27  2:21 Walter Francis
  2002-04-27  5:24 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Walter Francis @ 2002-04-27  2:21 UTC (permalink / raw)
  To: zsh-users

I'm converting from tcsh to zsh for a few reasons, none them are big reasons 
or anything, just wanting to play, and I like the completion stuff in zsh, 
I've found tcsh's to be a little constraining.  Of coures, that might just 
be me not understanding it.

I have a few questions I bet you zsh gurus will know immediately, most of 
them are tcsh vs zsh kinda questions, so if I've overlooked this stuff 
somewhere, please point me in the right direction.  In case it's not clear, 
these are total (clueless) questions, not gripes.  s/gripe/question/ :)

complete tar 'p/*/t,^d:*.{bz2,gz,tgz}/'

A tcsh completion alias, tar ^D will list files with stated extensions, is 
this possible in zsh?  Added bonus; is it possible to have two aliases, say 
tarx and tart, and for a respective archive, automatically include desired 
flags for tar?  eg:  tart (tab or ^D) lists bz2, gz, tgz archives..  I pick 
a bz2 archive, and it prints tar jtf archive.tar.bz2, etc.

Strangeness in cd (tab) completion, perhaps something I have set wrong.  I 
have two dirs, a test and a testtest, cd test(tab) prints cd test/ rather 
than showing the two options.  I can understand why (test is a complete 
path), but then I hit <bs>t<tab> and it'll complete testtest.  But if I do 
cd tes<tab> I get the two matching directories.  This is, in retrospect, 
probably must misunderstanding by me (again, since test *is* a full path). 
A simple *smack* will put me straight on this question.  :)

What is a 'suggested' cdpath?  This is obviously going to be subjective, but 
  I've found that "cd <tab>" just lists way too many directories to be very 
useful when I have it set as I saw suggested somewhere as (.. ~)..  Is it 
possible to list pwd's subdirectories, then the cdpath directories, such as 
tab one shows pwd's subdirs, tab again shows cdpath?  I can see the merit in 
cdpath, just having 100ish .dotdirs in my ~ makes having that in cdpath too 
verbose to be very useful.  Curious if there is a way to 'tailor' this 
behaviour.

I use screen 100% of the time, and while I'm used to tcsh taking perhaps .2s 
to create a new window, it takes zsh at least 1s to create a new one, ala 
<meta>c in screen.  Not a huge issue, and I suspect it's largish scripts 
(12k total between .zshrc, .zshenv, etc...)  Using screen, do I need to run 
these scripts each time,

I'm sure I'll have more silly questions, but I'm going to do more reading, 
and perhaps get some more pointers to places to look and figure more stuff 
out on my own.

Thanks for any help!

--
Walter Francis
http://theblackmoor.net                  Powered by Red Hat Linux 7.2


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

* Re: New zsh user, I have a few questions.
  2002-04-27  2:21 New zsh user, I have a few questions Walter Francis
@ 2002-04-27  5:24 ` Bart Schaefer
  2002-04-27  6:05   ` Walter Francis
  2002-05-02  7:33   ` Sven Wischnowsky
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Schaefer @ 2002-04-27  5:24 UTC (permalink / raw)
  To: wally, zsh-users

On Apr 26, 10:21pm, Walter Francis wrote:
} Subject: New zsh user, I have a few questions.
}
} I have a few questions I bet you zsh gurus will know immediately, most of 
} them are tcsh vs zsh kinda questions, so if I've overlooked this stuff 
} somewhere, please point me in the right direction.

Firstly, the version (number) of zsh that you're using is important for
answering your questions.  The 4.0 release was relatively recent and
many packaged OS distributions still include 3.0.x versions.

For the remainder of this message, I'm going to assume that you have 4.0.3
or 4.0.4.  If you don't, a lot of what follows won't make sense.

Secondly, it's helpful to know whether you've load the function-based
completion system with `compinit', or are using the default completions,
or have added your own completions with `compctl' commands.  (Some of
what you say below makes me think you're using `compinit', but I'm not
really sure.)

Thirdly, a good place to start looking is Peter W. Stephenson's zsh user
guide:	http://zsh.sunsite.dk/Guide/zshguide.html

} complete tar 'p/*/t,^d:*.{bz2,gz,tgz}/'
} 
} A tcsh completion alias, tar ^D will list files with stated extensions, is 
} this possible in zsh?

If you're already using `compinit', the tar completion that is included
does this (and several other useful things) right out of the box -- but
only if you supply the options to the `tar' command before pressing TAB.
E.g., after `tar tzf ' zsh completes *.tar.gz or *.tgz files, but after
`tar xIf ' it completes *.tar.bz2 files, and after `tar --' it completes
tar options; but after just plain `tar ' it completes any file name.

The trailing spaces (or lack) are significant in the examples above.

} Added bonus; is it possible to have two aliases, say tarx and tart,
} and for a respective archive, automatically include desired flags for
} tar?

Yes.  Zsh normally expands aliases internally before attempting completion,
so if the alias expands to a tar command, the tar completion is used.

This can, of course, be turned off if you prefer to treat each alias as a
separate command for completion purposes.  See the COMPLETE_ALIASES option
(`setopt complete_aliases').

} Strangeness in cd (tab) completion, perhaps something I have set wrong.  I 
} have two dirs, a test and a testtest, cd test(tab) prints cd test/ rather 
} than showing the two options.

This almost certainly means that you have the REC_EXACT option set.  Unset
it again (`unsetopt rec_exact' or `setopt no_rec_exact').  (BTW, `setopt'
ignores case and discards underscores; `setopt NOrecexact' is the same.)

} What is a 'suggested' cdpath?  This is obviously going to be subjective

In fact it's completely subjective.  It should be set to the directories
into whose subdiretories you `cd' frequently, and that's about all that
can be said about it.

} I've found that "cd <tab>" just lists way too many directories to be very 
} useful when I have it set as I saw suggested somewhere as (.. ~)..  Is it 
} possible to list pwd's subdirectories, then the cdpath directories, such as 
} tab one shows pwd's subdirs, tab again shows cdpath?

You can do almost anything if you try hard enough, but the short answer
is that there's no built-in mechanism for making different numbers of
TABs show different subsets of the possible completions.  However, you
*can* cause the listing to be segregated into subsets and control the
order in which those subsets are listed, or whether they are listed at
all.  This is all done with the `zstyle' command (again assuming you use
`compinit').

You want the `group-name' and `group-order' styles, something like this:

zstyle ':completion:*' group-name ''	# Special case, see doc example
zstyle ':completion::complete:cd::' group-order \
	local-directories path-directories

See also the `tag-order' style.

} I can see the merit in cdpath, just having 100ish .dotdirs in my ~
} makes having that in cdpath too verbose to be very useful.

Hmm, the default is to not show dotfiles when completing unless you have
explicitly typed the first dot.  Is there some other reason that you've
enabled them?  Perhaps `unsetopt globdots' would be a good idea?

} I use screen 100% of the time, and while I'm used to tcsh taking perhaps
} .2s  to create a new window, it takes zsh at least 1s to create a new one

You probably want to tell screen to NOT create login shells when it
creates new windows, and then segregate commands in your ~/.z* files
so that any settings that can be inherited through the environment
(such as setting of $path) are done only in ~/.zlogin or ~/.zprofile.

You can also try the `zcompile' command or the `zrecompile' function
(see the "User Contributions" chapter in the docs) to increase the speed
of loading your init files.  

I hope this was helpful; good luck.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: New zsh user, I have a few questions.
  2002-04-27  5:24 ` Bart Schaefer
@ 2002-04-27  6:05   ` Walter Francis
  2002-05-02  7:33   ` Sven Wischnowsky
  1 sibling, 0 replies; 4+ messages in thread
From: Walter Francis @ 2002-04-27  6:05 UTC (permalink / raw)
  To: Bart Schaefer, zsh-users

Bart Schaefer wrote:

> For the remainder of this message, I'm going to assume that you have 4.0.3
> or 4.0.4.  If you don't, a lot of what follows won't make sense.

Ack!  As usual I never provide enough info.. :)  4.0.4.

> Secondly, it's helpful to know whether you've load the function-based
> completion system with `compinit', or are using the default completions,
> or have added your own completions with `compctl' commands.  (Some of
> what you say below makes me think you're using `compinit', but I'm not
> really sure.)

compinit, yes.  I found a set of zsh startup scripts somewhere, can't recall 
where now, but they set up quite a bit of stuff.  I should have done this 
first, but I've put the scripts I'm using on http://theblackmoor.net/zsh

I've made a few changes since I posted the message (been doing some reading 
:) had have answered a few of my own questions, but will likely make more 
changes based on your help :)

> Thirdly, a good place to start looking is Peter W. Stephenson's zsh user
> guide:	http://zsh.sunsite.dk/Guide/zshguide.html

Bookmarked, reading after this message :)


> If you're already using `compinit', the tar completion that is included
> does this (and several other useful things) right out of the box -- but
> only if you supply the options to the `tar' command before pressing TAB.
> E.g., after `tar tzf ' zsh completes *.tar.gz or *.tgz files, but after
> `tar xIf ' it completes *.tar.bz2 files, and after `tar --' it completes
> tar options; but after just plain `tar ' it completes any file name.

DOH!  Works great, a fine example of my not rtfm'ing.

> This almost certainly means that you have the REC_EXACT option set.  Unset
> it again (`unsetopt rec_exact' or `setopt no_rec_exact').  (BTW, `setopt'
> ignores case and discards underscores; `setopt NOrecexact' is the same.)

Interestingly, just setopt doesn't show this, but when I did unsetopt 
rec_exact it responded as infered.

> Hmm, the default is to not show dotfiles when completing unless you have
> explicitly typed the first dot.  Is there some other reason that you've
> enabled them?  Perhaps `unsetopt globdots' would be a good idea?

Aha, yes, it was set in the zshrc I started with, it's now removed.  And now 
it works perfectly!  I'm going to have to look at all the opts this file is 
setting up and see exactly what they're doing..  Didn't consider that.


> You probably want to tell screen to NOT create login shells when it
> creates new windows, and then segregate commands in your ~/.z* files
> so that any settings that can be inherited through the environment
> (such as setting of $path) are done only in ~/.zlogin or ~/.zprofile.

Aha, I had been trying to poke around and do just this, had just been 
thinking about it, hadn't looked into screen yet.

> You can also try the `zcompile' command or the `zrecompile' function
> (see the "User Contributions" chapter in the docs) to increase the speed
> of loading your init files.  

This I shall, I noticed the delay was about half with no .zshrc (and thus no 
aliases, prompt script, etc..), I'll check out compiling the scripts.

> I hope this was helpful; good luck.

Very, thank you :)  I've also been skimming the list and have found a 
plethora of neat stuff, I'm taking notes and/or adding it to my zshrc, etc, 
because I never remember anything.  :)

Cheers.

-- 
Walter Francis
http://theblackmoor.net                  Powered by Red Hat Linux 7.2


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

* Re: New zsh user, I have a few questions.
  2002-04-27  5:24 ` Bart Schaefer
  2002-04-27  6:05   ` Walter Francis
@ 2002-05-02  7:33   ` Sven Wischnowsky
  1 sibling, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2002-05-02  7:33 UTC (permalink / raw)
  To: zsh-users


Just a little addition:

Bart Schaefer wrote:

> On Apr 26, 10:21pm, Walter Francis wrote:
> 
> ...
> 
> } I've found that "cd <tab>" just lists way too many directories to be very 
> } useful when I have it set as I saw suggested somewhere as (.. ~)..  Is it 
> } possible to list pwd's subdirectories, then the cdpath directories, such as 
> } tab one shows pwd's subdirs, tab again shows cdpath?
> 
> You can do almost anything if you try hard enough, but the short answer
> is that there's no built-in mechanism for making different numbers of
> TABs show different subsets of the possible completions.  However, you
> *can* cause the listing to be segregated into subsets and control the
> order in which those subsets are listed, or whether they are listed at
> all.  This is all done with the `zstyle' command (again assuming you use
> `compinit').
> 
> You want the `group-name' and `group-order' styles, something like this:
> 
> zstyle ':completion:*' group-name ''	# Special case, see doc example
> zstyle ':completion::complete:cd::' group-order \
> 	local-directories path-directories
> 
> See also the `tag-order' style.

Yes, tag-order should be interesting here (there even is an example
for it for completion after cd in Peter's guide). And then have a look
at the _next_tags widget (normally bound to ^Xn) to see how to switch
from one group of matches to the next.


Bye
  Sven

-- 
Sven Wischnowsky                          wischnow@berkom.de


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

end of thread, other threads:[~2002-05-02  7:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-27  2:21 New zsh user, I have a few questions Walter Francis
2002-04-27  5:24 ` Bart Schaefer
2002-04-27  6:05   ` Walter Francis
2002-05-02  7:33   ` Sven Wischnowsky

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