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