Version 15 of tclvars

Updated 2008-11-21 15:29:50 by LV

http://www.purl.org/tcl/home/man/tcl8.5/TclCmd/tclvars.htm collects the formal reference info for tclvars...


The variables tcl_wordchars and tcl_nonwordchars define what letters are treated as valid for words. The variables are auto-loaded along with the commands they control, such as tcl_endOfWord.

This means that to change the characters that are valid, you must first do something like:

        catch {tcl_endOfWord}

After this, you can then do something like:

    # We want the same behaviour on Windows as on Unix for double-clicking
    set tcl_wordchars {[a-zA-Z0-9_]}
    set tcl_nonwordchars {[^a-zA-Z0-9_]}

MG The defaults for Unix (or rather, non-Windows), according to the docs for Tcl 8.4.9, are actually \w and \W (with \s and \S on Windows), which might differ from the above due to locale. Personally, I tend to use

  set tcl_wordchars {[a-zA-Z0-9' ]}
  set tcl_nonwordchars {[^a-zA-Z0-9']}

for my apps on Windows - I tend to find that gives much more natural behaviour, particularly compared to other apps when you move the cursor a word at a time with Control-Left / Control-Right.

LV [add info on what routines actually use these variables]


  • argc - number of arguments the script was called with
  • argv - list arguments the script was called with

Unlike C, the argv does not include the name of the application itself among the argument list. For that, there is



See also "Tcl syntax help" and "magic names".