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?

1 Answer 1


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


     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.
  • info zsh select-word-style and info zsh shwordsplit sound like much better ways to me. Jan 17, 2018 at 22:39
  • @StéphaneChazelas info isn't necessarily available - it's not installed on my machine and I'm not sure how to get it. Feb 20, 2023 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .