Added SILC Thread Queue API
[runtime.git] / apps / irssi / docs / special_vars.txt
1 NOTE: This is just a slightly modified file taken from EPIC's help.
2
3 Special Variables and Expandos
4
5 Irssi supports a number of reserved, dynamic variables, sometimes
6 referred to as expandos.  They are special in that the client is
7 constantly updating their values automatically.  There are also
8 numerous variable modifiers available.
9
10    Modifier          Description
11    $variable         A normal variable, expanding to the first match of:
12                      |  1) an internal SET variable
13                      |  2) an environment variable
14    $[num]variable    Expands to the variables value, with 'num' width.  If
15                      | the number is negative, the value is right-aligned.
16                      | The value is padded to meet the width with the
17                      | character given after number (default is space).
18                      | The value is truncated to specified width unless
19                      | '!' character precedes the number. If '.' character
20                      | precedes the number the value isn't padded, just
21                      | truncated.
22    $#variable        Expands to the number of words in $variable. If $variable
23                      | is omitted, it assumes $*
24    $@variable        Expands to the number of characters in $variable. if
25                      | $variable is omitted, it assumes $*
26    $($subvariable)   This is somewhat similar to a pointer, in that the
27                      | value of $subvar is taken as the name of the
28                      | variable to expand to.  Nesting is allowed.
29    ${expression}     Permits the value to be embedded in another string
30                      | unambiguously.
31    $!history!        Expands to a matching entry in the client's command
32                      | history, wildcards allowed.
33
34 Whenever an alias is called, these expandos are set to the arguments passed
35 to it.  If none of these expandos are used in the alias, or the $() form
36 shown above, any arguments passed will automatically be appended to the last
37 command in the alias.
38
39    Expando   Description
40    $*        expands to all arguments passed to an alias
41    $n        expands to argument 'n' passed to an alias (counting from zero)
42    $n-m      expands to arguments 'n' through 'm' passed to an alias
43    $n-       expands to all arguments from 'n' on passed to an alias
44    $-m       expands to all arguments up to 'm' passed to an alias
45    $~        expands to the last argument passed to an alias
46
47 These variables are set and updated dynamically by the client.  The case of
48 $A .. $Z is important.
49
50    Variable   Description
51    $,         last person who sent you a MSG
52    $.         last person to whom you sent a MSG
53    $:         last person to join a channel you are on
54    $;         last person to send a public message to a channel you are on
55    $A         text of your AWAY message, if any
56    $B         body of last MSG you sent
57    $C         current channel
58    $D         last person that NOTIFY detected a signon for
59    $E         idle time
60    $F         time client was started, $time() format
61    $H         current server numeric being processed
62    $I         channel you were last INVITEd to
63    $J         client version text string
64    $K         current value of CMDCHARS
65    $k         first character in CMDCHARS
66    $L         current contents of the input line
67    $M         modes of current channel, if any
68    $N         current nickname
69    $O         value of STATUS_OPER if you are an irc operator
70    $P         if you are a channel operator in $C, expands to a '@'
71    $Q         nickname of whomever you are QUERYing
72    $R         version of current server
73    $S         current server name
74    $T         target of current input (channel or nick of query)
75    $U         value of cutbuffer
76    $V         client release date (format YYYYMMDD)
77    $W         current working directory
78    $X         your /userhost $N address (user@host)
79    $Y         value of REALNAME
80    $Z         time of day (hh:mm, can be changed with /SET timestamp_format)
81    $$         a literal '$'
82
83    $versiontime         prints time of the irssi version in HHMM format
84    $sysname             system name (eg. Linux)
85    $sysrelease          system release (eg. 2.2.18)
86    $sysarch             system architecture (eg. i686)
87    $topic               channel topic
88    $usermode            user mode
89    $cumode              own channel user mode
90    $cumode_space        like $cumode, but gives space if there's no mode.
91    $tag                 server tag
92    $chatnet             chat network of server
93    $winref              window reference number
94    $winname             window name
95    $itemname            like $T, but use item's visible_name which may be
96                         different (eg. $T = !12345chan, $itemname = !chan)
97
98 For example, assume you have the following alias:
99
100    alias blah msg $D Hi there!
101
102 If /blah is passed any arguments, they will automatically be appended to the
103 MSG text.  For example:
104
105    /blah oops                          /* command as entered */
106    "Hi there! oops"                    /* text sent to $D */
107
108 Another useful form is ${}.  In general, variables can be embedded inside
109 strings without problems, assuming the surrounding text could not be
110 misinterpreted as part of the variable name.  This form guarantees that
111 surrounding text will not affect the expression's return value.
112
113    /eval echo foo$Nfoo                 /* breaks, looks for $nfoo */
114    /eval echo foo${N}foo               /* ${N} returns current nickname */
115    fooYourNickfoo                      /* returned by above command */
116