Update grmlzshrc.html + grml-zsh-refcard.pdf for current grml-zshrc
[grml.org.git] / zsh / grmlzshrc.html
1 <?xml version="1.0"
2 ?>
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <title>GRMLZSHRC</title>
7 <meta name="generator" content="http://txt2tags.org" />
8 <link rel="stylesheet" type="text/css" href="t2t-modern.css" />
9 </head>
10 <body>
11 <div class="header" id="header">
12 <h1>GRMLZSHRC</h1>
13 <h3>July, 2011</h3>
14 </div>
15 <div class="body" id="body">
16 <h1>NAME</h1>
17 <p>
18 grmlzshrc - Grml's zsh setup
19 </p>
20 <h1>SYNOPSIS</h1>
21 <p>
22 <i>zsh</i> [<b>options</b>]...
23 </p>
24 <h1>DESCRIPTION</h1>
25 <p>
26 The Grml project provides a fairly exhaustive interactive setup (referred to
27 as <i>grmlzshrc</i> throughout this document) for the amazing unix shell zsh
28 (<a href="http://zsh.sourceforge.net">http://zsh.sourceforge.net</a>). This is the reference manual for that
29 setup.
30 </p>
31 <p>
32 To use <i>grmlzshrc</i>, you need at least version 3.1.7 of zsh (although not all
33 features are enabled in every version).
34 </p>
35 <p>
36 <i>grmlzshrc</i> behaves differently depending on which user loads it. For the
37 root user (<b>EUID</b> == 0) only a subset of features is loaded by default. This
38 behaviour can be altered by setting the <b>GRML_ALWAYS_LOAD_ALL</b> STARTUP
39 VARIABLE (see below).
40 </p>
41 <p>
42 Users may want to keep an up-to-date version of the setup (possibly from the
43 git-sources) in <i>~/.zshrc</i>. If that happens on a system where the global
44 zshrc is also a <i>grmlzshrc</i> (but possibly an older one), you can inhibit
45 loading the global version by doing:
46
47 </p>
48 <pre>
49 echo setopt no_global_rcs &gt;&gt; ~/.zshenv
50 </pre>
51 <p>
52 Note, that this will disable <i>ANY</i> global files, except for the global
53 zshenv file.
54 </p>
55 <h1>STARTUP VARIABLES</h1>
56 <p>
57 Some of the behaviour of <i>grmlzshrc</i> can be altered by setting certain shell
58 variables. These may be set temporarily when starting zsh like this:
59
60 </p>
61 <pre>
62 % BATTERY=1 zsh
63 </pre>
64 <p>
65 Or by setting them permanently in <b>zshrc.pre</b> (See AUXILIARY FILES below).
66 </p>
67 <dl>
68 <dt><b>BATTERY</b></dt><dd>
69 If set to a value greater than zero and <i>acpi</i> installed, <i>grmlzshrc</i> will
70 put the battery status into the right hand side interactive prompt.
71 <p></p>
72 </dd>
73 <dt><b>COMMAND_NOT_FOUND</b></dt><dd>
74 A non zero value activates a handler, which is called when a command can not
75 be found. The handler is defined by GRML_ZSH_CNF_HANDLER (see below).
76 <p></p>
77 </dd>
78 <dt><b>GRML_ZSH_CNF_HANDLER</b></dt><dd>
79 This variable contains the handler to be used by COMMAND_NOT_FOUND (see above)
80 and defaults to "/usr/share/command-not-found/command-not-found".
81 <p></p>
82 </dd>
83 <dt><b>GRMLSMALL_SPECIFIC</b></dt><dd>
84 Set this to zero to remove items in zsh config, which do not work in
85 grml-small.
86 <p></p>
87 </dd>
88 <dt><b>HISTFILE</b></dt><dd>
89 Where zsh saves the history. Default: ${HOME}/.zsh_history.
90 <p></p>
91 </dd>
92 <dt><b>HISTSIZE</b></dt><dd>
93 Number of commands to be kept in the history. On a Grml-CD this defaults to
94 500, on a hard disk installation to 5000.
95 <p></p>
96 </dd>
97 <dt><b>MAILCHECK</b></dt><dd>
98 Sets the frequency in seconds for zsh to check for new mail. Defaults to 30.
99 A value of zero turns off checking.
100 <p></p>
101 </dd>
102 <dt><b>NOCOR</b></dt><dd>
103 Non zero values deactivate automatic correction of commands.
104 <p></p>
105 </dd>
106 <dt><b>NOMENU</b></dt><dd>
107 If set to zero (default), allows selection from a menu, if there are at least
108 five possible options of completion.
109 <p></p>
110 </dd>
111 <dt><b>NOPRECMD</b></dt><dd>
112 A non zero value disables precmd and preexec commands. These are functions
113 that are run before every command (setting xterm/screen titles etc.).
114 <p></p>
115 </dd>
116 <dt><b>REPORTTIME</b></dt><dd>
117 Show time (user, system and cpu) used by external commands, if they run longer
118 than the defined number of seconds (default: 5).
119 <p></p>
120 </dd>
121 <dt><b>SAVEHIST</b></dt><dd>
122 Number of commands to be stored in ${HISTFILE}. Defaults to 1000 on a Grml-CD
123 and to 10000 on an installation on hard disk.
124 <p></p>
125 </dd>
126 <dt><b>watch</b></dt><dd>
127 As in tcsh(1) an array of login/logout events to be reported by the shell
128 builtin "log". For details see zshparam(1). Defaults to (notme root).
129 <p></p>
130 </dd>
131 <dt><b>ZSH_NO_DEFAULT_LOCALE</b></dt><dd>
132 Import "/etc/default/locale", if set to zero (default).
133 <p></p>
134 </dd>
135 <dt><b>ZSH_PROFILE_RC</b></dt><dd>
136 A non zero value causes shell functions to be profiled. The results can be
137 obtained with the zprof builtin command (see zshmodules(1) for details).
138 </dd>
139 </dl>
140 <h1>FEATURE DESCRIPTION</h1>
141 <p>
142 This is an in depth description of non-standard features implemented by
143 <i>grmlzshrc</i>.
144 </p>
145 <h2>DIRSTACK HANDLING</h2>
146 <p>
147 The dirstack in <i>grmlzshrc</i> has a persistent nature. It is stored into a
148 file each time zsh's working directory is changed. That file can be configured
149 via the <b>DIRSTACKFILE</b> variable and it defaults to <b>~/.zdirs</b>. The
150 <b>DIRSTACKSIZE</b> variable defaults to <b>20</b> in this setup.
151 </p>
152 <p>
153 The <b>DIRSTACKFILE</b> is loaded each time zsh starts, therefore freshly started
154 zshs inherit the dirstack of the zsh that most recently updated
155 <b>DIRSTACKFILE</b>.
156 </p>
157 <h2>DIRECTORY BASED PROFILES</h2>
158 <p>
159 If you need to perform certain actions each time you enter certain
160 directory-trees, this is the feature you are looking for.
161 </p>
162 <h3>Initialisation</h3>
163 <p>
164 To initialise the system, you need to call the function `chpwd_profiles' at
165 some point in your `zshrc.local'; preferably <b>after</b> you configured the
166 system. The configuration of the system is described further below.
167 </p>
168 <p>
169 If you need to do initialisations the first time `chpwd_profiles' is called
170 (which should be in your configuration file), you can do that in a function
171 called "chpwd_profiles_init". That function needs to be defined <b>before</b>
172 `chpwd_profiles' is called for this to work.
173 </p>
174 <p>
175 During the <b>first</b> call of `chpwd_profiles' (and therefore all its profile
176 functions) the parameter `$CHPWD_PROFILES_INIT' exists and is set to `1'. In
177 all other cases, the parameter does not exist at all.
178 </p>
179 <h3>Styles and Profile-names</h3>
180 <p>
181 To store its configuration, the system uses <b>functions</b> and <b>styles</b>
182 (zsh's context sensitive configuration system), such as this:
183 </p>
184 <p>
185
186 </p>
187 <pre>
188 zstyle ':chpwd:profiles:/usr/src/grml(|/|/*)'   profile grml
189 zstyle ':chpwd:profiles:/usr/src/debian(|/|/*)' profile debian
190 </pre>
191 <p>
192 When that's done and you enter a directory that matches the pattern in the
193 third part of the context, a function called chpwd_profile_grml, for example,
194 is called (if it exists).
195 </p>
196 <p>
197 If no pattern matches (read: no profile is detected) the profile is set to
198 'default', which means chpwd_profile_default is attempted to be called.
199 </p>
200 <p>
201 A word about the context (the ':chpwd:profiles:*' stuff in the zstyle command)
202 which is used: The third part in the context is matched against ${PWD}. That's
203 why using a pattern such as /foo/bar(|/|/*) makes sense. Because that way the
204 profile is detected for all these values of ${PWD}:
205
206 </p>
207 <pre>
208   /foo/bar
209   /foo/bar/
210   /foo/bar/baz
211 </pre>
212 <p>
213 So, if you want to make double damn sure a profile works in /foo/bar and
214 everywhere deeper in that tree, just use (|/|/*) and be happy.
215 </p>
216 <p>
217 The name of the detected profile will be available in a variable called
218 'profile' in your functions. You don't need to do anything, it'll just be
219 there.
220 </p>
221 <h3>Controlling Profile Execution</h3>
222 <p>
223 During its initialisation run, the system creates a parameter $CHPWD_PROFILE,
224 which is set to the profile that was is currently active (the default value is
225 "default"). That way you can avoid running code for a profile that is already
226 active, by running code such as the following at the start of your function:
227
228 </p>
229 <pre>
230 function chpwd_profile_grml() {
231     [[ ${profile} == ${CHPWD_PROFILE} ]] &amp;&amp; return 1
232   ...
233 }
234 </pre>
235 <p>
236 If you know you are going to do that all the time for each and every
237 directory-profile function you are ever going to write, you may also set the
238 `re-execute' style to `false' (which only defaults to `true' for backwards
239 compatibility), like this:
240
241 </p>
242 <pre>
243   zstyle ':chpwd:profiles:*' re-execute false
244 </pre>
245 <h3>Signaling availabily/profile changes</h3>
246 <p>
247 If you use this feature and need to know whether it is active in your current
248 shell, there are several ways to do that. Here are two simple ways:
249 </p>
250 <p>
251 a) If knowing if the profiles feature is active when zsh starts is good
252 enough for you, you can use the following snippet:
253 </p>
254 <p>
255 (( ${+functions[chpwd_profiles]} )) &amp;&amp; print "directory profiles active"
256 </p>
257 <p>
258 b) If that is not good enough, and you would prefer to be notified whenever a
259 profile changes, you can solve that by making sure you start <b>every</b>
260 profile function you create like this:
261 </p>
262 <p>
263 function chpwd_profile_myprofilename() {
264     [[ ${profile} == ${CHPWD_PROFILE} ]] &amp;&amp; return 1
265     print "chpwd(): Switching to profile: $profile"
266   ...
267 }
268 </p>
269 <p>
270 That makes sure you only get notified if a profile is <b>changed</b>, not
271 everytime you change directory. (To avoid this, you may also set the newer
272 `re-execute' style like described further above instead of the test on top of
273 the function.
274 </p>
275 <h3>Leaving Profiles</h3>
276 <p>
277 When the system switches from one profile to another, it executes a function
278 named "chpwd_leave_profile_&lt;PREVIOUS-PROFILE-NAME&gt;()" before calling the
279 profile-function for the new profile.
280 </p>
281 <h3>Version requirement</h3>
282 <p>
283 This feature requires zsh <i>4.3.3</i> or newer.
284 </p>
285 <h2>ACCEPTLINE WRAPPER</h2>
286 <p>
287 The <i>accept-line</i> wiget is the one that is taking action when the <b>return</b>
288 key is hit. <i>grmlzshrc</i> uses a wrapper around that widget, which adds new
289 functionality.
290 </p>
291 <p>
292 This wrapper is configured via styles. That means, you issue commands, that look
293 like:
294
295 </p>
296 <pre>
297 zstyle 'context' style value
298 </pre>
299 <p>
300 The context namespace, that we are using is 'acceptline'. That means, the actual
301 context for your commands look like: <b>':acceptline:&lt;subcontext&gt;'</b>.
302 </p>
303 <p>
304 Where <b>&lt;subcontext&gt;</b> is one of: <b>default</b>, <b>normal</b>, <b>force</b>, <b>misc</b>
305 or <b>empty</b>.
306 </p>
307 <h3>Recognized Contexts</h3>
308 <dl>
309 <dt><b>default</b></dt><dd>
310 This is the value, the context is initialized with.
311 The <i>compwarnfmt and //rehash</i> styles are looked up in this context.
312 <p></p>
313 </dd>
314 <dt><b>normal</b></dt><dd>
315 If the first word in the command line is either a command, alias, function,
316 builtin or reserved word, you are in this context.
317 <p></p>
318 </dd>
319 <dt><b>force</b></dt><dd>
320 This is the context, that is used if you hit enter again, after being warned
321 about the existence of a _completion for the non-existing command you
322 entered.
323 <p></p>
324 </dd>
325 <dt><b>empty</b></dt><dd>
326 This is the context, you are in if the command line is empty or only
327 consists of whitespace.
328 <p></p>
329 </dd>
330 <dt><b>misc</b></dt><dd>
331 This context is in effect, if you entered something that does not match any
332 of the above. (e.g.: variable assignments).
333 </dd>
334 </dl>
335 <h3>Available Styles</h3>
336 <dl>
337 <dt><b>nocompwarn</b></dt><dd>
338 If you set this style to true, the warning about non existent commands,
339 for which completions exist will not be issued. (Default: <b>false</b>)
340 <p></p>
341 </dd>
342 <dt><b>compwarnfmt</b></dt><dd>
343 The message, that is displayed to warn about the _completion issue.
344 (default: <b>'%c will not execute and completion %f exists.'</b>)
345 '%c' is replaced by the command name, '%f' by the completion's name.
346 <p></p>
347 </dd>
348 <dt><b>rehash</b></dt><dd>
349 If this is set, we'll force rehashing, if appropriate. (Defaults to
350 <b>true</b> in <i>grmlzshrc</i>).
351 <p></p>
352 </dd>
353 <dt><b>actions</b></dt><dd>
354 This can be a list of wigdets to call in a given context. If you need a
355 specific order for these to be called, name them accordingly. The default value
356 is an <b>empty list</b>.
357 <p></p>
358 </dd>
359 <dt><b>default_action</b></dt><dd>
360 The name of a widget, that is called after the widgets from 'actions'.
361 By default, this will be '.accept-line' (which is the built-in accept-line
362 widget).
363 <p></p>
364 </dd>
365 <dt><b>call_default</b></dt><dd>
366 If true in the current context, call the widget in the 'default_action'
367 style. (The default is <b>true</b> in all contexts.)
368 </dd>
369 </dl>
370 <h2>PROMPT</h2>
371 <p>
372 The <i>grmlzshrc</i> now supplies three prompt themes compatible with zsh's
373 <b>promptinit</b> system. The three themes are called <b>grml</b>, <b>grml-large</b> and
374 <b>grml-chroot</b>.
375 </p>
376 <p>
377 By default, <b>grml</b> is used, unless <i>$GRMLPROMPT</i> is set to a value larger
378 than zero, in which case <b>grml-large</b> is used. Lastly, if <i>$GRML_CHROOT</i> is
379 non-empty, <b>grml-chroot</b> is used.
380 </p>
381 <p>
382 As usual, with promtinit themes, the user may switch to a different theme using
383 the <i>prompt</i> utility:
384
385 </p>
386 <pre>
387     prompt grml-large
388 </pre>
389 <p>
390 That will use the <b>grml-large</b> prompt theme.
391 </p>
392 <p>
393 The themes are highly customisable. The main source of documentation about
394 customisation is the main <b>grml</b> theme's doc-string, that is available via
395 the following command:
396
397 </p>
398 <pre>
399     prompt -h grml
400 </pre>
401 <p>
402 The other themes also come with doc-strings, but the main theme's is the
403 canonical reference about all of them.
404 </p>
405 <p>
406 This feature requires version <i>4.3.7</i> of the shell. Older versions will use
407 the classic grml prompt as a fallback.
408 </p>
409 <p>
410 A note to people who like customisation: If you are <b>not</b> using a prompt
411 theme for your customisation, but you're either statically setting $PS1 (or
412 $PROMPT) or you're constructing one of those variables in zsh's \`precmd()'
413 function, make sure you are turning the zsh's prompt theme system <b>off</b>
414 before doing so. A correct example customisation could look like this:
415
416 </p>
417 <pre>
418     # Turn the prompt system off:
419     prompt off
420     # Customise the prompt yourself:
421     PS1='%~ %# '
422 </pre>
423 <h2>GNU/SCREEN STATUS SETTING</h2>
424 <p>
425 <i>grmlzshrc</i> sets screen's hardstatus lines to the currently running command
426 or <b>'zsh'</b> if the shell is idling at its prompt. If the current working
427 directory is inside a repository unter version control, screen status is set
428 to: <b>'zsh: &lt;repository name&gt;'</b> via zsh's vcs_info.
429 </p>
430 <h2>PERSISTENT HISTORY</h2>
431 <p>
432 If you got commands you consider important enough to be included in every
433 shell's history, you can put them into ~/.important_commands and they will be
434 available via the usual history lookup widgets.
435 </p>
436 <h1>REFERENCE</h1>
437 <h2>ENVIRONMENT VARIABLES</h2>
438 <p>
439 <i>grmlzshrc</i> sets some environment variables, which influence the
440 behaviour of applications.
441 </p>
442 <dl>
443 <dt><b>COLORTERM</b></dt><dd>
444 Set to "yes". Some applications read this to learn about properties
445 of the terminal they are running in.
446 <p></p>
447 </dd>
448 <dt><b>EDITOR</b></dt><dd>
449 If not already set, sets the default editor. Falls back to vi(1),
450 if vim(1) is not available.
451 <p></p>
452 </dd>
453 <dt><b>LESS_TERMCAP_*</b></dt><dd>
454 Some environment variables that add colour support to less(1) for viewing
455 man pages. See termcap(5) for details.
456 <p></p>
457 </dd>
458 <dt><b>MAIL</b></dt><dd>
459 The mailbox file for the current user is set to /var/mail/$USER, if not
460 already set otherwise.
461 <p></p>
462 </dd>
463 <dt><b>PAGER</b></dt><dd>
464 Set less(1) as default pager, if not already set to something different.
465 <p></p>
466 </dd>
467 <dt><b>SHELL</b></dt><dd>
468 Set explicitly to /bin/zsh, to prevent certain terminal emulators to
469 default to /bin/sh or /bin/bash.
470 </dd>
471 </dl>
472 <h2>OPTIONS</h2>
473 <p>
474 Apart from zsh's default options, <i>grmlzshrc</i> sets some options
475 that change the behaviour of zsh. Options that change Z-shell's default
476 settings are marked by &lt;grml&gt;. But note, that zsh's defaults vary depending
477 on its emulation mode (csh, ksh, sh, or zsh). For details, see zshoptions(1).
478 </p>
479 <dl>
480 <dt><b>append_history</b></dt><dd>
481 Zsh sessions, that use <i>grmlzshrc</i>, will append their history list to the
482 history file, rather than replace it. Thus, multiple parallel zsh sessions
483 will all have the new entries from their history lists added to the history
484 file, in the order that they exit. The file will still be periodically
485 re-written to trim it when the number of lines grows 20% beyond the value
486 specified by $SAVEHIST.
487 <p></p>
488 </dd>
489 <dt><b>auto_cd</b> &lt;grml&gt;</dt><dd>
490 If a command is issued that can't be executed as a normal command, and the
491 command is the name of a directory, perform the cd command to that directory.
492 <p></p>
493 </dd>
494 <dt><b>auto_pushd</b> &lt;grml&gt;</dt><dd>
495 Make cd push the old directory onto the directory stack.
496 <p></p>
497 </dd>
498 <dt><b>completeinword</b> &lt;grml&gt;</dt><dd>
499 If the cursor is inside a word, completion is done from both ends;
500 instead of moving the cursor to the end of the word first and starting
501 from there.
502 <p></p>
503 </dd>
504 <dt><b>extended_glob</b> &lt;grml&gt;</dt><dd>
505 Treat the '#', '~' and '^' characters as active globbing pattern characters.
506 <p></p>
507 </dd>
508 <dt><b>extended_history</b> &lt;grml&gt;</dt><dd>
509 Save each command's beginning timestamp (in seconds since the epoch) and the
510 duration (in seconds) to the history file.
511 <p></p>
512 </dd>
513 <dt><b>hash_list_all</b></dt><dd>
514 Whenever a command completion is attempted, make sure the entire command
515 path is hashed first. This makes the first completion slower.
516 <p></p>
517 </dd>
518 <dt><b>histignorealldups</b> &lt;grml&gt;</dt><dd>
519 If a new command line being added to the history list duplicates an
520 older one, the older command is removed from the list, even if it is
521 not the previous event.
522 <p></p>
523 </dd>
524 <dt><b>histignorespace</b> &lt;grml&gt;</dt><dd>
525 Remove command lines from the history list when the first character on
526 the line is a space, or when one of the expanded aliases contains a
527 leading space. Note that the command lingers in the internal history
528 until the next command is entered before it vanishes.
529 <p></p>
530 </dd>
531 <dt><b>longlistjobs</b> &lt;grml&gt;</dt><dd>
532 List jobs in long format by default.
533 <p></p>
534 </dd>
535 <dt><b>nobeep</b> &lt;grml&gt;</dt><dd>
536 Avoid to beep on errors in zsh command line editing (zle).
537 <p></p>
538 </dd>
539 <dt><b>noglobdots</b></dt><dd>
540 A wildcard character never matches a leading '.'.
541 <p></p>
542 </dd>
543 <dt><b>nohup</b> &lt;grml&gt;</dt><dd>
544 Do not send the hangup signal (HUP:1) to running jobs when the shell exits.
545 <p></p>
546 </dd>
547 <dt><b>nonomatch</b> &lt;grml&gt;</dt><dd>
548 If a pattern for filename generation has no matches, do not print an error
549 and leave it unchanged in the argument list. This also applies to file
550 expansion of an initial `~' or `='.
551 <p></p>
552 </dd>
553 <dt><b>notify</b></dt><dd>
554 Report the status of background jobs immediately, rather than waiting until
555 just before printing a prompt.
556 <p></p>
557 </dd>
558 <dt><b>pushd_ignore_dups</b> &lt;grml&gt;</dt><dd>
559 Don't push multiple copies of the same directory onto the directory stack.
560 <p></p>
561 </dd>
562 <dt><b>share_history</b> &lt;grml&gt;</dt><dd>
563 As each line is added to the history file, it is checked to see if anything
564 else was written out by another shell, and if so it is included in the
565 history of the current shell too. Using !-style history, the commands from
566 the other sessions will not appear in the history list unless you explicitly
567 type the "history" command. This option is activated for zsh versions &gt;= 4,
568 only.
569 </dd>
570 </dl>
571 <h2>KEYBINDINGS</h2>
572 <p>
573 Apart from zsh's default key bindings, <i>grmlzshrc</i> comes with its own set of
574 key bindings. Note that bindings like <b>ESC-e</b> can also be typed as <b>ALT-e</b>
575 on PC keyboards.
576 </p>
577 <dl>
578 <dt><b>ESC-e</b></dt><dd>
579 Edit the current command buffer in your favourite editor.
580 <p></p>
581 </dd>
582 <dt><b>ESC-v</b></dt><dd>
583 Deletes a word left of the cursor; seeing '/' as additional word separator.
584 <p></p>
585 </dd>
586 <dt><b>CTRL-x-1</b></dt><dd>
587 Jump right after the first word.
588 <p></p>
589 </dd>
590 <dt><b>CTRL-x-M()</b></dt><dd>
591 Create directory under cursor or the selected area.
592 To select an area press ctrl-@ and use the cursor.
593 Use case: you type "mv abc ~/testa/testb/testc/" and remember that the
594 directory does not exist yet -&gt; press <b>CTRL-xM</b> and problem solved.
595 <p></p>
596 </dd>
597 <dt><b>CTRL-x-p</b></dt><dd>
598 Searches the last occurence of string before the cursor in the command history.
599 <p></p>
600 </dd>
601 <dt><b>CTRL-x-z</b></dt><dd>
602 Display help on keybindings and zsh line editor. Press consecutively to page through content.
603 <p></p>
604 </dd>
605 <dt><b>CTRL-z</b></dt><dd>
606 Brings a job, which got suspended with CTRL-z back to foreground.
607 </dd>
608 </dl>
609 <h2>SHELL FUNCTIONS</h2>
610 <p>
611 <i>grmlzshrc</i> comes with a wide array of defined shell functions to ease the
612 user's life.
613 </p>
614 <dl>
615 <dt><b>855resolution()</b></dt><dd>
616 If 915resolution is available, issues a warning to the user to run it instead
617 to modify the resolution on intel graphics chipsets.
618 <p></p>
619 </dd>
620 <dt><b>accessed()</b></dt><dd>
621 Lists files in current directory, which have been accessed within the
622 last N days. N is an integer to be passed as first and only argument.
623 If no argument is specified N is set to 1.
624 <p></p>
625 </dd>
626 <dt><b>allulimit()</b></dt><dd>
627 Sets all ulimit values to "unlimited".
628 <p></p>
629 </dd>
630 <dt><b>any()</b></dt><dd>
631 Lists processes matching given pattern.
632 <p></p>
633 </dd>
634 <dt><b>asc()</b></dt><dd>
635 Login on the host provided as argument using autossh. Then reattach a GNU screen
636 session if a detached session is around or detach a currently attached screen or
637 else start a new screen.  This is especially useful for roadwarriors using GNU
638 screen and ssh.
639 <p></p>
640 </dd>
641 <dt><b>bk()</b></dt><dd>
642 Simple backup of a file or directory using cp(1). The target file name is the
643 original name plus a time stamp attached. Symlinks and file attributes like mode,
644 ownership and timestamps are preserved.
645 <p></p>
646 </dd>
647 <dt><b>cdrecord()</b></dt><dd>
648 If the original cdrecord is not installed, issues a warning to the user to
649 use the wodim binary instead. Wodim is the debian fork of Joerg Schillings
650 cdrecord.
651 <p></p>
652 </dd>
653 <dt><b>cdt()</b></dt><dd>
654 Creates a temporary directory using mktemp. Then changes current
655 working directory to it.
656 <p></p>
657 </dd>
658 <dt><b>changed()</b></dt><dd>
659 Lists files in current directory, which have been changed within the
660 last N days. N is an integer to be passed as first and only argument.
661 If no argument is specified N is set to 1.
662 <p></p>
663 </dd>
664 <dt><b>check_com()</b></dt><dd>
665 Returns true if given command exists either as program, function, alias,
666 builtin or reserved word. If the option -c is given, only returns true,
667 if command is a program.
668 <p></p>
669 </dd>
670 <dt><b>checkhome()</b></dt><dd>
671 Changes directory to $HOME on first invocation of zsh. This is neccessary on
672 grml systems with autologin.
673 <p></p>
674 </dd>
675 <dt><b>cl()</b></dt><dd>
676 Changes current directory to the one supplied by argument and lists the files
677 in it, including file names starting with ".".
678 <p></p>
679 </dd>
680 <dt><b>dchange()</b></dt><dd>
681 Shows the changelog of given package in $PAGER.
682 <p></p>
683 </dd>
684 <dt><b>dcopyright()</b></dt><dd>
685 Shows the copyright of given package in $PAGER.
686 <p></p>
687 </dd>
688 <dt><b>debian2hd()</b></dt><dd>
689 Tells the user to use grml-debootstrap, if she wants to install debian to
690 harddisk.
691 <p></p>
692 </dd>
693 <dt><b>deswap()</b></dt><dd>
694 A trick from $LINUX-KERNELSOURCE/Documentation/power/swsusp.txt. It brings
695 back interactive responsiveness after suspend, when the system is swapping
696 heavily.
697 <p></p>
698 </dd>
699 <dt><b>dnews()</b></dt><dd>
700 Shows the NEWS file for the given package in $PAGER.
701 <p></p>
702 </dd>
703 <dt><b>edalias()</b></dt><dd>
704 Edit given alias.
705 <p></p>
706 </dd>
707 <dt><b>edfunc()</b></dt><dd>
708 Edit given shell function.
709 <p></p>
710 </dd>
711 <dt><b>freload()</b></dt><dd>
712 Reloads an autoloadable shell function (See autoload in zshbuiltins(1)).
713 <p></p>
714 </dd>
715 <dt><b>hgdi()</b></dt><dd>
716 Use GNU diff with options -ubwd for mercurial.
717 <p></p>
718 </dd>
719 <dt><b>hgstat()</b></dt><dd>
720 Displays diffstat between the revision given as argument and tip (no
721 argument means last revision).
722 <p></p>
723 </dd>
724 <dt><b>hidiff()</b></dt><dd>
725 Outputs highlighted diff; needs highstring(1).
726 <p></p>
727 </dd>
728 <dt><b>is4()</b></dt><dd>
729 Returns true, if zsh version is equal or greater than 4, else false.
730 <p></p>
731 </dd>
732 <dt><b>is41()</b></dt><dd>
733 Returns true, if zsh version is equal or greater than 4.1, else false.
734 <p></p>
735 </dd>
736 <dt><b>is42()</b></dt><dd>
737 Returns true, if zsh version is equal or greater than 4.2, else false.
738 <p></p>
739 </dd>
740 <dt><b>is425()</b></dt><dd>
741 Returns true, if zsh version is equal or greater than 4.2.5, else false.
742 <p></p>
743 </dd>
744 <dt><b>is43()</b></dt><dd>
745 Returns true, if zsh version is equal or greater than 4.3, else false.
746 <p></p>
747 </dd>
748 <dt><b>is433()</b></dt><dd>
749 Returns true, if zsh version is equal or greater than 4.3.3, else false.
750 <p></p>
751 </dd>
752 <dt><b>isdarwin()</b></dt><dd>
753 Returns true, if running on darwin, else false.
754 <p></p>
755 </dd>
756 <dt><b>isgrml()</b></dt><dd>
757 Returns true, if running on a grml system, else false.
758 <p></p>
759 </dd>
760 <dt><b>isgrmlcd()</b></dt><dd>
761 Returns true, if running on a grml system from a live cd, else false.
762 <p></p>
763 </dd>
764 <dt><b>isgrmlsmall()</b></dt><dd>
765 Returns true, if run on grml-small, else false.
766 <p></p>
767 </dd>
768 <dt><b>iso2utf()</b></dt><dd>
769 Changes every occurrence of the string iso885915 or ISO885915 in
770 environment variables to UTF-8.
771 <p></p>
772 </dd>
773 <dt><b>isutfenv()</b></dt><dd>
774 Returns true, if run within an utf environment, else false.
775 <p></p>
776 </dd>
777 <dt><b>mkcd()</b></dt><dd>
778 Creates directory including parent directories, if necessary. Then changes
779 current working directory to it.
780 <p></p>
781 </dd>
782 <dt><b>modified()</b></dt><dd>
783 Lists files in current directory, which have been modified within the
784 last N days. N is an integer to be passed as first and only argument.
785 If no argument is specified N is set to 1.
786 <p></p>
787 </dd>
788 <dt><b>nt()</b></dt><dd>
789 A helper function for the "e" glob qualifier to list all files newer
790 than a reference file.
791
792 Example usages:
793 <pre>
794 % NTREF=/reference/file
795 % ls -l *(e:nt:)
796 % # Inline:
797 % ls -l *(e:'nt /reference/file':)
798 </pre>
799 <p></p>
800 </dd>
801 <dt><b>profile()</b></dt><dd>
802 Runs a command in $SHELL with profiling enabled (See startup variable
803 ZSH_PROFILE_RC above).
804 <p></p>
805 </dd>
806 <dt><b>salias()</b></dt><dd>
807 Creates an alias whith sudo prepended, if $EUID is not zero. Run "salias -h"
808 for details. See also xunfunction() below.
809 <p></p>
810 </dd>
811 <dt><b>simple-extract()</b></dt><dd>
812 Tries to uncompress/unpack given files with the appropriate programs. If an URI
813 starting with https, http or ftp is provided simple-extract tries to download
814 and then uncompress/unpack the file. The choice is made along the filename
815 ending. simple-extract will not delete the original archive (even on .gz,.bz2 or
816 .xz) unless you use the '-d' option.
817 <p></p>
818 </dd>
819 <dt><b>sll()</b></dt><dd>
820 Prints details of symlinks given as arguments.
821 <p></p>
822 </dd>
823 <dt><b>ssl-cert-fingerprints</b></dt><dd>
824 Prints the SHA512, SHA256, SHA1 and MD5 digest of a x509 certificate.
825 First and only parameter must be a file containing a certificate. Use
826 /dev/stdin as file if you want to pipe a certificate to these
827 functions.
828 <p></p>
829 </dd>
830 <dt><b>ssl-cert-info</b></dt><dd>
831 Prints all information of a x509 certificate including the SHA512,
832 SHA256, SHA1 and MD5 digests. First and only parameter must be a file
833 containing a certificate. Use /dev/stdin as file if you want to pipe a
834 certificate to this function.
835 <p></p>
836 </dd>
837 <dt><b>ssl-cert-sha512(), ssl-cert-sha256(), ssl-cert-sha1(), ssl-cert-md5()</b></dt><dd>
838 Prints the SHA512, SHA256, SHA1 respective MD5 digest of a x509
839 certificate. First and only parameter must be a file containing a
840 certificate. Use /dev/stdin as file if you want to pipe a certificate
841 to this function.
842 <p></p>
843 </dd>
844 <dt><b>Start(), Restart(), Stop(), Force-Reload(), Reload()</b></dt><dd>
845 Functions for controlling daemons.
846 <pre>
847 Example usage:
848 % Restart ssh
849 </pre>
850 <p></p>
851 </dd>
852 <dt><b>trans()</b></dt><dd>
853 Translates a word from german to english (-D) or vice versa (-E).
854 <p></p>
855 </dd>
856 <dt><b>uchange()</b></dt><dd>
857 Shows upstreams changelog of a given package in $PAGER.
858 <p></p>
859 </dd>
860 <dt><b>uprint()</b></dt><dd>
861 Works around the "print -l ${(u)foo}"-limitation on zsh older than 4.2.
862 <p></p>
863 </dd>
864 <dt><b>utf2iso()</b></dt><dd>
865 Changes every occurrence of the string UTF-8 or utf-8 in environment
866 variables to iso885915.
867 <p></p>
868 </dd>
869 <dt><b>vim()</b></dt><dd>
870 Wrapper for vim(1). It tries to set the title and hands vim the environment
871 variable VIM_OPTIONS on the command line. So the user may define command
872 line options, she always wants, in her .zshrc.local.
873 <p></p>
874 </dd>
875 <dt><b>whatwhen()</b></dt><dd>
876 Searches the history for a given pattern and lists the results by date.
877 The first argument is the search pattern. The second and third ones are
878 optional and denote a search range (default: -100).
879 <p></p>
880 </dd>
881 <dt><b>xcat()</b></dt><dd>
882 Tries to cat(1) file(s) given as parameter(s). Always returns true.
883 See also xunfunction() below.
884 <p></p>
885 </dd>
886 <dt><b>xsource()</b></dt><dd>
887 Tries to source the file(s) given as parameter(s). Always returns true.
888 See zshbuiltins(1) for a detailed description of the source command.
889 See also xunfunction() below.
890 <p></p>
891 </dd>
892 <dt><b>xtrename()</b></dt><dd>
893 Changes the title of xterm window from within screen(1). Run without
894 arguments for details.
895 <p></p>
896 </dd>
897 <dt><b>xunfunction()</b></dt><dd>
898 Removes the functions salias, xcat, xsource, xunfunction and zrcautoload.
899 <p></p>
900 </dd>
901 <dt><b>zrcautoload()</b></dt><dd>
902 Wrapper around the autoload builtin. Loads the definitions of functions
903 from the file given as argument. Searches $fpath for the file. See also
904 xunfunction() above.
905 <p></p>
906 </dd>
907 <dt><b>zrclocal()</b></dt><dd>
908 Sources /etc/zsh/zshrc.local and ${HOME}/.zshrc.local. These are the files
909 where own modifications should go. See also zshbuiltins(1) for a description
910 of the source command.
911 </dd>
912 </dl>
913 <h2>ALIASES</h2>
914 <p>
915 <i>grmlzshrc</i> comes with a wide array of predefined aliases to ease the user's
916 life. A few aliases (like those involving <i>grep</i> or <i>ls</i>) use the option
917 <i>--color=auto</i> for colourizing output. That option is part of <b>GNU</b>
918 implementations of these tools, and will only be used if such an implementation
919 is detected.
920 </p>
921 <dl>
922 <dt><b>acp</b> (<i>apt-cache policy</i>)</dt><dd>
923 With no arguments prints out the priorities of each source. If a package name
924 is given, it displays detailed information about the priority selection of the
925 package.
926 <p></p>
927 </dd>
928 <dt><b>acs</b> (<i>apt-cache search</i>)</dt><dd>
929 Searches debian package lists for the regular expression provided as argument.
930 The search includes package names and descriptions. Prints out name and short
931 description of matching packages.
932 <p></p>
933 </dd>
934 <dt><b>acsh</b> (<i>apt-cache show</i>)</dt><dd>
935 Shows the package records for the packages provided as arguments.
936 <p></p>
937 </dd>
938 <dt><b>adg</b> (<i>apt-get dist-upgrade</i>)</dt><dd>
939 Performs an upgrade of all installed packages. Also tries to automatically
940 handle changing dependencies with new versions of packages. As this may change
941 the install status of (or even remove) installed packages, it is potentially
942 dangerous to use dist-upgrade; invoked by sudo, if necessary.
943 <p></p>
944 </dd>
945 <dt><b>ag</b> (<i>apt-get upgrade</i>)</dt><dd>
946 Downloads and installs the newest versions of all packages currently installed
947 on the system. Under no circumstances are currently installed packages removed,
948 or packages not already installed retrieved and installed. New versions of
949 currently installed packages that cannot be upgraded without changing the install
950 status of another package will be left at their current version. An update must
951 be performed first (see au below); run by sudo, if necessary.
952 <p></p>
953 </dd>
954 <dt><b>agi</b> (<i>apt-get install</i>)</dt><dd>
955 Downloads and installs or upgrades the packages given on the command line.
956 If a hyphen is appended to the package name, the identified package will be
957 removed if it is installed. Similarly a plus sign can be used to designate a
958 package to install. This may be useful to override decisions made by apt-get's
959 conflict resolution system.
960 A specific version of a package can be selected for installation by following
961 the package name with an equals and the version of the package to select. This
962 will cause that version to be located and selected for install. Alternatively a
963 specific distribution can be selected by following the package name with a slash
964 and the version of the distribution or the Archive name (stable, testing, unstable).
965 Gets invoked by sudo, if user id is not 0.
966 <p></p>
967 </dd>
968 <dt><b>ati</b> (<i>aptitude install</i>)</dt><dd>
969 Aptitude is a terminal-based package manager with a command line mode similar to
970 apt-get (see agi above); invoked by sudo, if necessary.
971 <p></p>
972 </dd>
973 <dt><b>au</b> (<i>apt-get update</i>)</dt><dd>
974 Resynchronizes the package index files from their sources. The indexes of
975 available packages are fetched from the location(s) specified in
976 /etc/apt/sources.list. An update should always be performed before an
977 upgrade or dist-upgrade; run by sudo, if necessary.
978 <p></p>
979 </dd>
980 <dt><b>da</b> (<i>du -sch</i>)</dt><dd>
981 Prints the summarized disk usage of the arguments as well as a grand total
982 in human readable format.
983 <p></p>
984 </dd>
985 <dt><b>dbp</b> (<i>dpkg-buildpackage</i>)</dt><dd>
986 Builds binary or source packages from sources (See: dpkg-buildpackage(1)).
987 <p></p>
988 </dd>
989 <dt><b>debs-by-size</b> (<i>grep-status -FStatus -sInstalled-Size,Package -n "install ok installed" | paste -sd "  \n" | sort -rn</i>)</dt><dd>
990 Prints installed Packages sorted by size (descending).
991 <p></p>
992 </dd>
993 <dt><b>dir</b> (<i>ls -lSrah</i>)</dt><dd>
994 Lists files (including dot files) sorted by size (biggest last) in long and
995 human readable output format.
996 <p></p>
997 </dd>
998 <dt><b>ge</b> (<i>grep-excuses</i>)</dt><dd>
999 Searches the testing excuses files for a specific maintainer (See:
1000 grep-excuses(1)).
1001 <p></p>
1002 </dd>
1003 <dt><b>grep</b> (<i>grep --color=auto</i>)</dt><dd>
1004 Shows grep output in nice colors, if available.
1005 <p></p>
1006 </dd>
1007 <dt><b>grml-version</b> (<i>cat /etc/grml_version</i>)</dt><dd>
1008 Prints version of running grml.
1009 <p></p>
1010 </dd>
1011 <dt><b>hbp</b> (<i>hg-buildpackage</i>)</dt><dd>
1012 Helper program to maintain Debian packages with mercurial.
1013 <p></p>
1014 </dd>
1015 <dt><b>http</b> (<i>python -m SimpleHTTPServer</i>)</dt><dd>
1016 Basic HTTP server implemented in python. Listens on port 8000/tcp and
1017 serves current directory. Implements GET and HEAD methods.
1018 <p></p>
1019 </dd>
1020 <dt><b>insecscp</b> (<i>scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"</i>)</dt><dd>
1021 scp with possible man-in-the-middle attack enabled. This is convenient, if the targets
1022 host key changes frequently, for example on virtualized test- or development-systems.
1023 To be used only inside trusted networks, of course.
1024 <p></p>
1025 </dd>
1026 <dt><b>insecssh</b> (<i>ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"</i>)</dt><dd>
1027 ssh with possible man-in-the-middle attack enabled
1028 (for an explanation see insecscp above).
1029 <p></p>
1030 </dd>
1031 <dt><b>help-zshglob</b> (<i>H-Glob()</i>)</dt><dd>
1032 Runs the function H-Glob() to expand or explain wildcards.
1033 <p></p>
1034 </dd>
1035 <dt><b>j</b> (<i>jobs -l</i>)</dt><dd>
1036 Prints status of jobs in the current shell session in long format.
1037 <p></p>
1038 </dd>
1039 <dt><b>l</b> (<i>ls -lF --color=auto</i>)</dt><dd>
1040 Lists files in long output format with indicator for filetype appended
1041 to filename. If the terminal supports it, with colored output.
1042 <p></p>
1043 </dd>
1044 <dt><b>la</b> (<i>ls -la --color=auto</i>)</dt><dd>
1045 Lists files in long colored output format. Including file names
1046 starting with ".".
1047 <p></p>
1048 </dd>
1049 <dt><b>lad</b> (<i>ls -d .*(/)</i>)</dt><dd>
1050 Lists the dot directories (not their contents) in current directory.
1051 <p></p>
1052 </dd>
1053 <dt><b>lh</b> (<i>ls -hAl --color=auto</i>)</dt><dd>
1054 Lists files in long and human readable output format in nice colors,
1055 if available. Includes file names starting with "." except "." and
1056 "..".
1057 <p></p>
1058 </dd>
1059 <dt><b>ll</b> (<i>ls -l --color=auto</i>)</dt><dd>
1060 Lists files in long colored output format.
1061 <p></p>
1062 </dd>
1063 <dt><b>llog</b> (<i>$PAGER /var/log/syslog</i>)</dt><dd>
1064 Opens syslog in pager.
1065 <p></p>
1066 </dd>
1067 <dt><b>ls</b> (<i>ls -b -CF --color=auto</i>)</dt><dd>
1068 Lists directory printing octal escapes for nongraphic characters.
1069 Entries are listed by columns and an indicator for file type is appended
1070 to each file name. Additionally the output is colored, if the terminal
1071 supports it.
1072 <p></p>
1073 </dd>
1074 <dt><b>lsa</b> (<i>ls -a .*(.)</i>)</dt><dd>
1075 Lists dot files in current working directory.
1076 <p></p>
1077 </dd>
1078 <dt><b>lsbig</b> (<i>ls -flh *(.OL[1,10])</i>)</dt><dd>
1079 Displays the ten biggest files (long and human readable output format).
1080 <p></p>
1081 </dd>
1082 <dt><b>lsd</b> (<i>ls -d *(/)</i>)</dt><dd>
1083 Shows directories.
1084 <p></p>
1085 </dd>
1086 <dt><b>lse</b> (<i>ls -d *(/^F)</i>)</dt><dd>
1087 Shows empty directories.
1088 <p></p>
1089 </dd>
1090 <dt><b>lsl</b> (<i>ls -l *(@)</i>)</dt><dd>
1091 Lists symbolic links in current directory.
1092 <p></p>
1093 </dd>
1094 <dt><b>lsnew</b> (<i>ls -rl *(D.om[1,10])</i>)</dt><dd>
1095 Displays the ten newest files (long output format).
1096 <p></p>
1097 </dd>
1098 <dt><b>lsnewdir</b> (<i>ls -rthdl *(/om[1,10]) .*(D/om[1,10])</i>)</dt><dd>
1099 Displays the ten newest directories and ten newest .directories.
1100 <p></p>
1101 </dd>
1102 <dt><b>lsold</b> (<i>ls -rtlh *(D.om[1,10])</i>)</dt><dd>
1103 Displays the ten oldest files (long output format).
1104 <p></p>
1105 </dd>
1106 <dt><b>lsolddir</b> (<i>ls -rthdl *(/Om[1,10]) .*(D/Om[1,10])</i>)</dt><dd>
1107 Displays the ten oldest directories and ten oldest .directories.
1108 <p></p>
1109 </dd>
1110 <dt><b>lss</b> (<i>ls -l *(s,S,t)</i>)</dt><dd>
1111 Lists files in current directory that have the setuid, setgid or sticky bit
1112 set.
1113 <p></p>
1114 </dd>
1115 <dt><b>lssmall</b> (<i>ls -Srl *(.oL[1,10])</i>)</dt><dd>
1116 Displays the ten smallest files (long output format).
1117 <p></p>
1118 </dd>
1119 <dt><b>lsw</b> (<i>ls -ld *(R,W,X.^ND/)</i>)</dt><dd>
1120 Displays all files which are world readable and/or world writable and/or
1121 world executable (long output format).
1122 <p></p>
1123 </dd>
1124 <dt><b>lsx</b> (<i>ls -l *(*)</i>)</dt><dd>
1125 Lists only executable files.
1126 <p></p>
1127 </dd>
1128 <dt><b>mdstat</b> (<i>cat /proc/mdstat</i>)</dt><dd>
1129 Lists all active md (i.e. linux software raid) devices with some information
1130 about them.
1131 <p></p>
1132 </dd>
1133 <dt><b>mq</b> (<i>hg -R $(readlink -f $(hg root)/.hg/patches)</i>)</dt><dd>
1134 Executes the commands on the versioned patch queue from current repository.
1135 <p></p>
1136 </dd>
1137 <dt><b>rmcdir</b> (<i>'cd ..; rmdir $OLDPWD || cd $OLDPWD</i>)</dt><dd>
1138 rmdir current working directory
1139 <p></p>
1140 </dd>
1141 <dt><b>screen</b> (<i>/usr/bin/screen -c ${HOME}/.screenrc</i>)</dt><dd>
1142 If invoking user is root, starts screen session with /etc/grml/screenrc
1143 as config file. If invoked by a regular user, start a screen session
1144 with users .screenrc config if it exists, else use /etc/grml/screenrc_grml
1145 as configuration.
1146 <p></p>
1147 </dd>
1148 <dt><b>su</b> (<i>sudo su</i>)</dt><dd>
1149 If user is running a grml live-CD, dont ask for any password, if she
1150 wants a root shell.
1151 <p></p>
1152 </dd>
1153 <dt><b>term2iso</b> (<i>echo 'Setting terminal to iso mode' ; print -n '\e%@'</i>)</dt><dd>
1154 Sets mode from UTF-8 to ISO 2022 (See:
1155 <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html#term">http://www.cl.cam.ac.uk/~mgk25/unicode.html#term</a>).
1156 <p></p>
1157 </dd>
1158 <dt><b>term2utf</b> (<i>echo 'Setting terminal to utf-8 mode'; print -n '\e%G'</i>)</dt><dd>
1159 Sets mode from ISO 2022 to UTF-8 (See:
1160 <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html#term">http://www.cl.cam.ac.uk/~mgk25/unicode.html#term</a>).
1161 <p></p>
1162 </dd>
1163 <dt><b>tlog</b> (<i>tail -f /var/log/syslog</i>)</dt><dd>
1164 Prints syslog continuously (See tail(1)).
1165 <p></p>
1166 </dd>
1167 <dt><b>up</b> (<i>aptitude update ; aptitude safe-upgrade</i>)</dt><dd>
1168 Performs a system update followed by a system upgrade using aptitude; run
1169 by sudo, if necessary. See au and ag above.
1170 <p></p>
1171 </dd>
1172 <dt><b>url-quote</b> (<i>autoload -U url-quote-magic ; zle -N self-insert url-quote-magic</i>)</dt><dd>
1173 After calling, characters of URLs as typed get automatically escaped, if necessary, to
1174 protect them from the shell.
1175 <p></p>
1176 </dd>
1177 <dt><b>$(uname -r)-reboot</b> (<i>kexec -l --initrd=/boot/initrd.img-"$(uname -r)" --command-line=\"$(cat /proc/cmdline)\" /boot/vmlinuz-"$(uname -r)"</i>)</dt><dd>
1178 Reboots using kexec(8) and thus reduces boot time by skipping hardware initialization of BIOS/firmware.
1179 <p></p>
1180 </dd>
1181 <dt><b>...</b> (<i>cd ../../</i>)</dt><dd>
1182 Changes current directory two levels higher.
1183 </dd>
1184 </dl>
1185 <h1>AUXILIARY FILES</h1>
1186 <p>
1187 This is a set of files, that - if they exist - can be used to customize the
1188 behaviour of <i>grmlzshrc</i>.
1189 </p>
1190 <dl>
1191 <dt><b>.zshrc.pre</b></dt><dd>
1192 Sourced at the very beginning of <i>grmlzshrc</i>. Among other things, it can
1193 be used to permantenly change <i>grmlzshrc</i>'s STARTUP VARIABLES (see above):
1194
1195 <pre>
1196 # show battery status in RPROMPT
1197 BATTERY=1
1198 # always load the complete setup, even for root
1199 GRML_ALWAYS_LOAD_ALL=1
1200 </pre>
1201 <p></p>
1202 </dd>
1203 <dt><b>.zshrc.local</b></dt><dd>
1204 Sourced right before loading <i>grmlzshrc</i> is finished. There is a global
1205 version of this file (/etc/zsh/zshrc.local) which is sourced before the
1206 user-specific one.
1207 <p></p>
1208 </dd>
1209 <dt><b>.zdirs</b></dt><dd>
1210 Directory listing for persistent dirstack (see above).
1211 <p></p>
1212 </dd>
1213 <dt><b>.important_commands</b></dt><dd>
1214 List of commands, used by persistent history (see above).
1215 </dd>
1216 </dl>
1217 <h1>INSTALLATION ON NON-DEBIAN SYSTEMS</h1>
1218 <p>
1219 On Debian systems (<a href="http://www.debian.org">http://www.debian.org</a>) - and possibly Ubuntu
1220 (<a href="http://www.ubuntu.com">http://www.ubuntu.com</a>) and similar systems - it is very easy to get
1221 <i>grmlzshrc</i> via grml's .deb repositories.
1222 </p>
1223 <p>
1224 On non-debian systems, that is not an option, but all is not lost:
1225
1226 </p>
1227 <pre>
1228 % wget -O .zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
1229 </pre>
1230 <p>
1231 If you would also like to get seperate function files (which you can put into
1232 your <b>$fpath</b>), you can browse and download them at:
1233 </p>
1234 <p>
1235 <a href="http://git.grml.org/?p=grml-etc-core.git;a=tree;f=usr_share_grml/zsh;hb=HEAD">http://git.grml.org/?p=grml-etc-core.git;a=tree;f=usr_share_grml/zsh;hb=HEAD</a>
1236 </p>
1237 <h1>ZSH REFCARD TAGS</h1>
1238 <p>
1239 If you read <i>grmlzshrc</i>'s code you may notice strange looking comments in
1240 it. These are there for a purpose. grml's zsh-refcard is automatically
1241 generated from the contents of the actual configuration file. However, we need
1242 a little extra information on which comments and what lines of code to take
1243 into account (and for what purpose).
1244 </p>
1245 <p>
1246 Here is what they mean:
1247 </p>
1248 <p>
1249 List of tags (comment types) used:
1250 </p>
1251 <dl>
1252 <dt><b>#a#</b></dt><dd>
1253 Next line contains an important alias, that should be included in the
1254 grml-zsh-refcard. (placement tag: @@INSERT-aliases@@)
1255 <p></p>
1256 </dd>
1257 <dt><b>#f#</b></dt><dd>
1258 Next line contains the beginning of an important function. (placement
1259 tag: @@INSERT-functions@@)
1260 <p></p>
1261 </dd>
1262 <dt><b>#v#</b></dt><dd>
1263 Next line contains an important variable. (placement tag:
1264 @@INSERT-variables@@)
1265 <p></p>
1266 </dd>
1267 <dt><b>#k#</b></dt><dd>
1268 Next line contains an important keybinding. (placement tag:
1269 @@INSERT-keybindings@@)
1270 <p></p>
1271 </dd>
1272 <dt><b>#d#</b></dt><dd>
1273 Hashed directories list generation: <i>start</i>: denotes the start of a list of
1274 'hash -d' definitions. <i>end</i>: denotes its end. (placement tag:
1275 @@INSERT-hasheddirs@@)
1276 <p></p>
1277 </dd>
1278 <dt><b>#A#</b></dt><dd>
1279 Abbreviation expansion list generation: <i>start</i>: denotes the beginning of
1280 abbreviations. <i>end</i>: denotes their end.
1281
1282 Lines within this section that end in '#d .*' provide extra documentation to
1283 be included in the refcard. (placement tag: @@INSERT-abbrev@@)
1284 <p></p>
1285 </dd>
1286 <dt><b>#m#</b></dt><dd>
1287 This tag allows you to manually generate refcard entries for code lines that
1288 are hard/impossible to parse.
1289 Example:
1290
1291 <pre>
1292 #m# k ESC-h Call the run-help function
1293 </pre>
1294
1295 That would add a refcard entry in the keybindings table for 'ESC-h' with the
1296 given comment.
1297
1298 So the syntax is: #m# &lt;section&gt; &lt;argument&gt; &lt;comment&gt;
1299 <p></p>
1300 </dd>
1301 <dt><b>#o#</b></dt><dd>
1302 This tag lets you insert entries to the 'other' hash. Generally, this should
1303 not be used. It is there for things that cannot be done easily in another way.
1304 (placement tag: @@INSERT-other-foobar@@)
1305 </dd>
1306 </dl>
1307 <p>
1308 All of these tags (except for m and o) take two arguments, the first
1309 within the tag, the other after the tag:
1310 </p>
1311 <p>
1312 #&lt;tag&gt;&lt;section&gt;# &lt;comment&gt;
1313 </p>
1314 <p>
1315 Where &lt;section&gt; is really just a number, which are defined by the @secmap
1316 array on top of 'genrefcard.pl'. The reason for numbers instead of names is,
1317 that for the reader, the tag should not differ much from a regular comment.
1318 For zsh, it is a regular comment indeed. The numbers have got the following
1319 meanings:
1320 </p>
1321 <dl>
1322 <dt><b>0</b></dt><dd>
1323 <i>default</i>
1324 <p></p>
1325 </dd>
1326 <dt><b>1</b></dt><dd>
1327 <i>system</i>
1328 <p></p>
1329 </dd>
1330 <dt><b>2</b></dt><dd>
1331 <i>user</i>
1332 <p></p>
1333 </dd>
1334 <dt><b>3</b></dt><dd>
1335 <i>debian</i>
1336 <p></p>
1337 </dd>
1338 <dt><b>4</b></dt><dd>
1339 <i>search</i>
1340 <p></p>
1341 </dd>
1342 <dt><b>5</b></dt><dd>
1343 <i>shortcuts</i>
1344 <p></p>
1345 </dd>
1346 <dt><b>6</b></dt><dd>
1347 <i>services</i>
1348 </dd>
1349 </dl>
1350 <p>
1351 So, the following will add an entry to the 'functions' table in the 'system'
1352 section, with a (hopefully) descriptive comment:
1353
1354 </p>
1355 <pre>
1356 #f1# Edit an alias via zle
1357 edalias() {
1358 </pre>
1359 <p>
1360
1361 It will then show up in the @@INSERT-aliases-system@@ replacement tag that can
1362 be found in 'grml-zsh-refcard.tex.in'. If the section number is omitted, the
1363 'default' section is assumed. Furthermore, in 'grml-zsh-refcard.tex.in'
1364 @@INSERT-aliases@@ is exactly the same as @@INSERT-aliases-default@@. If you
1365 want a list of <b>all</b> aliases, for example, use @@INSERT-aliases-all@@.
1366 </p>
1367 <h1>CONTRIBUTING</h1>
1368 <p>
1369 If you want to help to improve grml's zsh setup, clone the grml-etc-core
1370 repository from git.grml.org:
1371
1372 </p>
1373 <pre>
1374 % git clone git://git.grml.org/grml-etc-core.git
1375 </pre>
1376 <p>
1377 Make your changes, commit them; use '<b>git format-patch</b>' to create a series
1378 of patches and send those to the following address via '<b>git send-email</b>':
1379
1380 </p>
1381 <pre>
1382 grml-etc-core@grml.org
1383 </pre>
1384 <p>
1385 Doing so makes sure the right people get your patches for review and
1386 possibly inclusion.
1387 </p>
1388 <h1>STATUS</h1>
1389 <p>
1390 This manual page is the <b>reference</b> manual for <i>grmlzshrc</i>.
1391 </p>
1392 <p>
1393 That means that in contrast to the existing refcard it should document <b>every</b>
1394 aspect of the setup.
1395 </p>
1396 <p>
1397 This manual is currently not complete. If you want to help improving it, visit
1398 the following pages:
1399 </p>
1400 <p>
1401 <a href="http://wiki.grml.org/doku.php?id=zshrcmanual">http://wiki.grml.org/doku.php?id=zshrcmanual</a>
1402 </p>
1403 <p>
1404 <a href="http://lists.mur.at/pipermail/grml/2009-August/004609.html">http://lists.mur.at/pipermail/grml/2009-August/004609.html</a>
1405 </p>
1406 <p>
1407 Contributions are highly welcome.
1408 </p>
1409 <h1>AUTHORS</h1>
1410 <p>
1411 This manpage was written by Frank Terbeck &lt;<a href="mailto:ft@grml.org">ft@grml.org</a>&gt;, Joerg Woelke
1412 &lt;<a href="mailto:joewoe@fsmail.de">joewoe@fsmail.de</a>&gt;, Maurice McCarthy &lt;<a href="mailto:manselton@googlemail.com">manselton@googlemail.com</a>&gt; and Axel
1413 Beckert &lt;<a href="mailto:abe@deuxchevaux.org">abe@deuxchevaux.org</a>&gt;.
1414 </p>
1415 <h1>COPYRIGHT</h1>
1416 <p>
1417 Copyright (c) 2009-2013 Grml project &lt;<a href="http://grml.org">http://grml.org</a>&gt;
1418 </p>
1419 <p>
1420 This manpage is distributed under the terms of the GPL version 2.
1421 </p>
1422 <p>
1423 Most parts of grml's zshrc are distributed under the terms of GPL v2, too,
1424 except for <b>accept-line()</b> which are distributed under the same conditions
1425 as zsh itself (which is BSD-like).
1426 </p>
1427 </div>
1428 <!-- xhtml code generated by txt2tags 2.6 (http://txt2tags.org) -->
1429 <!-- cmdline: txt2tags -\-target xhtml -\-css-sugar -\-style t2t-modern.css -o- grmlzshrc.t2t -->
1430 </body></html>