Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I came across the following two snippets in zsh:

Snippet 1:

autoload select-word-style
select-word-style shell

Snippet 2:

setopt shwordsplit

My question is, what is the difference between them? (i.e. what do they do?)

Also, is there an index by keyword on the zsh documentation? (e.g. I couldn't easily find information on the documentation about these two snippets).

If such index doesn't exist, does anybody have any suggestions, other than the trivial Google searches or asking on this site, on how to find documentation on keywords such as shwordsplit or select-word-style?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

The best way is zshall(1), which contains documentation on both of these and all zsh features, and is easily search-able in your favorite pager (less is more):

 $ man zshall

          zsh -x -o shwordsplit scr

   runs  the  script  scr,  setting  the XTRACE option by the
   corresponding letter `-x' and the SH_WORD_SPLIT option by name.

[…]

   SH_WORD_SPLIT (-y) <K> <S>
     Causes field splitting to be performed on unquoted parameter
     expansions.  Note that this option has nothing to do with word
     splitting.  (See the section `Parameter Expansion'.)      

and

     The simplest way of configuring the functions is to use
     select-word-style, which can either be called as a normal
     function with the appropriate argument, or invoked as a
     user-defined widget that will prompt for the first character of
     the word style to be used.  The first time it is invoked, the
     eight -match functions will automatically replace the builtin
     versions, so they do not need to be loaded explicitly.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.