Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: New zsh user, I have a few questions.

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

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   

Messages sorted by: Reverse Date, Date, Thread, Author