Update grmlzshrc.html
[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>September, 2014</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 % GRML_DISPLAY_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 Deprecated. Use <b>GRML_DISPLAY_BATTERY</b> instead.
70 <p></p>
71 </dd>
72 <dt><b>COMMAND_NOT_FOUND</b></dt><dd>
73 A non zero value activates a handler, which is called when a command can not
74 be found. The handler is defined by GRML_ZSH_CNF_HANDLER (see below).
75 <p></p>
76 </dd>
77 <dt><b>GRML_DISPLAY_BATTERY</b></dt><dd>
78 If set to a value greater than zero, <i>grmlzshrc</i> will put the battery status
79 into the right hand side interactive prompt. Supported OSes are <i>GNU/Linux</i>,
80 <i>FreeBSD</i>, <i>OpenBSD</i> and <i>Darwin</i>.
81 <p></p>
82 </dd>
83 <dt><b>GRML_ZSH_CNF_HANDLER</b></dt><dd>
84 This variable contains the handler to be used by COMMAND_NOT_FOUND (see above)
85 and defaults to "/usr/share/command-not-found/command-not-found".
86 <p></p>
87 </dd>
88 <dt><b>GRMLSMALL_SPECIFIC</b></dt><dd>
89 Set this to zero to remove items in zsh config, which do not work in
90 grml-small.
91 <p></p>
92 </dd>
93 <dt><b>HISTFILE</b></dt><dd>
94 Where zsh saves the history. Default: ${HOME}/.zsh_history.
95 <p></p>
96 </dd>
97 <dt><b>HISTSIZE</b></dt><dd>
98 Number of commands to be kept in the history. On a Grml-CD this defaults to
99 500, on a hard disk installation to 5000.
100 <p></p>
101 </dd>
102 <dt><b>MAILCHECK</b></dt><dd>
103 Sets the frequency in seconds for zsh to check for new mail. Defaults to 30.
104 A value of zero turns off checking.
105 <p></p>
106 </dd>
107 <dt><b>NOCOR</b></dt><dd>
108 Non zero values deactivate automatic correction of commands.
109 <p></p>
110 </dd>
111 <dt><b>NOMENU</b></dt><dd>
112 If set to zero (default), allows selection from a menu, if there are at least
113 five possible options of completion.
114 <p></p>
115 </dd>
116 <dt><b>NOPRECMD</b></dt><dd>
117 A non zero value disables precmd and preexec commands. These are functions
118 that are run before every command (setting xterm/screen titles etc.).
119 <p></p>
120 </dd>
121 <dt><b>REPORTTIME</b></dt><dd>
122 Show time (user, system and cpu) used by external commands, if they run longer
123 than the defined number of seconds (default: 5).
124 <p></p>
125 </dd>
126 <dt><b>SAVEHIST</b></dt><dd>
127 Number of commands to be stored in ${HISTFILE}. Defaults to 1000 on a Grml-CD
128 and to 10000 on an installation on hard disk.
129 <p></p>
130 </dd>
131 <dt><b>watch</b></dt><dd>
132 As in tcsh(1) an array of login/logout events to be reported by the shell
133 builtin "log". For details see zshparam(1). Defaults to (notme root).
134 <p></p>
135 </dd>
136 <dt><b>ZSH_NO_DEFAULT_LOCALE</b></dt><dd>
137 Import "/etc/default/locale", if set to zero (default).
138 <p></p>
139 </dd>
140 <dt><b>ZSH_PROFILE_RC</b></dt><dd>
141 A non zero value causes shell functions to be profiled. The results can be
142 obtained with the zprof builtin command (see zshmodules(1) for details).
143 <p></p>
144 </dd>
145 <dt><b>COMPDUMPFILE</b></dt><dd>
146 Specifies the location of the completion dump file. Default: $HOME/.zcompdump.
147 </dd>
148 </dl>
149 <h1>FEATURE DESCRIPTION</h1>
150 <p>
151 This is an in depth description of non-standard features implemented by
152 <i>grmlzshrc</i>.
153 </p>
154 <h2>DIRSTACK HANDLING</h2>
155 <p>
156 The dirstack in <i>grmlzshrc</i> has a persistent nature. It is stored into a
157 file each time zsh's working directory is changed. That file can be configured
158 via the <b>DIRSTACKFILE</b> variable and it defaults to <b>~/.zdirs</b>. The
159 <b>DIRSTACKSIZE</b> variable defaults to <b>20</b> in this setup.
160 </p>
161 <p>
162 The <b>DIRSTACKFILE</b> is loaded each time zsh starts, therefore freshly started
163 zshs inherit the dirstack of the zsh that most recently updated
164 <b>DIRSTACKFILE</b>.
165 </p>
166 <h2>DIRECTORY BASED PROFILES</h2>
167 <p>
168 If you need to perform certain actions each time you enter certain
169 directory-trees, this is the feature you are looking for.
170 </p>
171 <h3>Initialisation</h3>
172 <p>
173 To initialise the system, you need to call the function `chpwd_profiles' at
174 some point in your `zshrc.local'; preferably <b>after</b> you configured the
175 system. The configuration of the system is described further below.
176 </p>
177 <p>
178 If you need to do initialisations the first time `chpwd_profiles' is called
179 (which should be in your configuration file), you can do that in a function
180 called "chpwd_profiles_init". That function needs to be defined <b>before</b>
181 `chpwd_profiles' is called for this to work.
182 </p>
183 <p>
184 During the <b>first</b> call of `chpwd_profiles' (and therefore all its profile
185 functions) the parameter `$CHPWD_PROFILES_INIT' exists and is set to `1'. In
186 all other cases, the parameter does not exist at all.
187 </p>
188 <h3>Styles and Profile-names</h3>
189 <p>
190 To store its configuration, the system uses <b>functions</b> and <b>styles</b>
191 (zsh's context sensitive configuration system), such as this:
192 </p>
193 <p>
194
195 </p>
196 <pre>
197 zstyle ':chpwd:profiles:/usr/src/grml(|/|/*)'   profile grml
198 zstyle ':chpwd:profiles:/usr/src/debian(|/|/*)' profile debian
199 </pre>
200 <p>
201 When that's done and you enter a directory that matches the pattern in the
202 third part of the context, a function called chpwd_profile_grml, for example,
203 is called (if it exists).
204 </p>
205 <p>
206 If no pattern matches (read: no profile is detected) the profile is set to
207 'default', which means chpwd_profile_default is attempted to be called.
208 </p>
209 <p>
210 A word about the context (the ':chpwd:profiles:*' stuff in the zstyle command)
211 which is used: The third part in the context is matched against ${PWD}. That's
212 why using a pattern such as /foo/bar(|/|/*) makes sense. Because that way the
213 profile is detected for all these values of ${PWD}:
214
215 </p>
216 <pre>
217   /foo/bar
218   /foo/bar/
219   /foo/bar/baz
220 </pre>
221 <p>
222 So, if you want to make double damn sure a profile works in /foo/bar and
223 everywhere deeper in that tree, just use (|/|/*) and be happy.
224 </p>
225 <p>
226 The name of the detected profile will be available in a variable called
227 'profile' in your functions. You don't need to do anything, it'll just be
228 there.
229 </p>
230 <h3>Controlling Profile Execution</h3>
231 <p>
232 During its initialisation run, the system creates a parameter $CHPWD_PROFILE,
233 which is set to the profile that was is currently active (the default value is
234 "default"). That way you can avoid running code for a profile that is already
235 active, by running code such as the following at the start of your function:
236
237 </p>
238 <pre>
239 function chpwd_profile_grml() {
240     [[ ${profile} == ${CHPWD_PROFILE} ]] &amp;&amp; return 1
241   ...
242 }
243 </pre>
244 <p>
245 If you know you are going to do that all the time for each and every
246 directory-profile function you are ever going to write, you may also set the
247 `re-execute' style to `false' (which only defaults to `true' for backwards
248 compatibility), like this:
249
250 </p>
251 <pre>
252   zstyle ':chpwd:profiles:*' re-execute false
253 </pre>
254 <h3>Signaling availabily/profile changes</h3>
255 <p>
256 If you use this feature and need to know whether it is active in your current
257 shell, there are several ways to do that. Here are two simple ways:
258 </p>
259 <p>
260 a) If knowing if the profiles feature is active when zsh starts is good
261 enough for you, you can use the following snippet:
262 </p>
263 <p>
264 (( ${+functions[chpwd_profiles]} )) &amp;&amp; print "directory profiles active"
265 </p>
266 <p>
267 b) If that is not good enough, and you would prefer to be notified whenever a
268 profile changes, you can solve that by making sure you start <b>every</b>
269 profile function you create like this:
270 </p>
271 <p>
272 function chpwd_profile_myprofilename() {
273     [[ ${profile} == ${CHPWD_PROFILE} ]] &amp;&amp; return 1
274     print "chpwd(): Switching to profile: $profile"
275   ...
276 }
277 </p>
278 <p>
279 That makes sure you only get notified if a profile is <b>changed</b>, not
280 everytime you change directory. (To avoid this, you may also set the newer
281 `re-execute' style like described further above instead of the test on top of
282 the function.
283 </p>
284 <h3>Leaving Profiles</h3>
285 <p>
286 When the system switches from one profile to another, it executes a function
287 named "chpwd_leave_profile_&lt;PREVIOUS-PROFILE-NAME&gt;()" before calling the
288 profile-function for the new profile.
289 </p>
290 <h3>Version requirement</h3>
291 <p>
292 This feature requires zsh <i>4.3.3</i> or newer.
293 </p>
294 <h2>ACCEPTLINE WRAPPER</h2>
295 <p>
296 The <i>accept-line</i> wiget is the one that is taking action when the <b>return</b>
297 key is hit. <i>grmlzshrc</i> uses a wrapper around that widget, which adds new
298 functionality.
299 </p>
300 <p>
301 This wrapper is configured via styles. That means, you issue commands, that look
302 like:
303
304 </p>
305 <pre>
306 zstyle 'context' style value
307 </pre>
308 <p>
309 The context namespace, that we are using is 'acceptline'. That means, the actual
310 context for your commands look like: <b>':acceptline:&lt;subcontext&gt;'</b>.
311 </p>
312 <p>
313 Where <b>&lt;subcontext&gt;</b> is one of: <b>default</b>, <b>normal</b>, <b>force</b>, <b>misc</b>
314 or <b>empty</b>.
315 </p>
316 <h3>Recognized Contexts</h3>
317 <dl>
318 <dt><b>default</b></dt><dd>
319 This is the value, the context is initialized with.
320 The <i>compwarnfmt and //rehash</i> styles are looked up in this context.
321 <p></p>
322 </dd>
323 <dt><b>normal</b></dt><dd>
324 If the first word in the command line is either a command, alias, function,
325 builtin or reserved word, you are in this context.
326 <p></p>
327 </dd>
328 <dt><b>force</b></dt><dd>
329 This is the context, that is used if you hit enter again, after being warned
330 about the existence of a _completion for the non-existing command you
331 entered.
332 <p></p>
333 </dd>
334 <dt><b>empty</b></dt><dd>
335 This is the context, you are in if the command line is empty or only
336 consists of whitespace.
337 <p></p>
338 </dd>
339 <dt><b>misc</b></dt><dd>
340 This context is in effect, if you entered something that does not match any
341 of the above. (e.g.: variable assignments).
342 </dd>
343 </dl>
344 <h3>Available Styles</h3>
345 <dl>
346 <dt><b>nocompwarn</b></dt><dd>
347 If you set this style to true, the warning about non existent commands,
348 for which completions exist will not be issued. (Default: <b>false</b>)
349 <p></p>
350 </dd>
351 <dt><b>compwarnfmt</b></dt><dd>
352 The message, that is displayed to warn about the _completion issue.
353 (default: <b>'%c will not execute and completion %f exists.'</b>)
354 '%c' is replaced by the command name, '%f' by the completion's name.
355 <p></p>
356 </dd>
357 <dt><b>rehash</b></dt><dd>
358 If this is set, we'll force rehashing, if appropriate. (Defaults to
359 <b>true</b> in <i>grmlzshrc</i>).
360 <p></p>
361 </dd>
362 <dt><b>actions</b></dt><dd>
363 This can be a list of wigdets to call in a given context. If you need a
364 specific order for these to be called, name them accordingly. The default value
365 is an <b>empty list</b>.
366 <p></p>
367 </dd>
368 <dt><b>default_action</b></dt><dd>
369 The name of a widget, that is called after the widgets from 'actions'.
370 By default, this will be '.accept-line' (which is the built-in accept-line
371 widget).
372 <p></p>
373 </dd>
374 <dt><b>call_default</b></dt><dd>
375 If true in the current context, call the widget in the 'default_action'
376 style. (The default is <b>true</b> in all contexts.)
377 </dd>
378 </dl>
379 <h2>PROMPT</h2>
380 <p>
381 The <i>grmlzshrc</i> now supplies three prompt themes compatible with zsh's
382 <b>promptinit</b> system. The three themes are called <b>grml</b>, <b>grml-large</b> and
383 <b>grml-chroot</b>.
384 </p>
385 <p>
386 By default, <b>grml</b> is used, unless <i>$GRMLPROMPT</i> is set to a value larger
387 than zero, in which case <b>grml-large</b> is used. Lastly, if <i>$GRML_CHROOT</i> is
388 non-empty, <b>grml-chroot</b> is used.
389 </p>
390 <p>
391 As usual, with promtinit themes, the user may switch to a different theme using
392 the <i>prompt</i> utility:
393
394 </p>
395 <pre>
396     prompt grml-large
397 </pre>
398 <p>
399 That will use the <b>grml-large</b> prompt theme.
400 </p>
401 <p>
402 The themes are highly customisable. The main source of documentation about
403 customisation is the main <b>grml</b> theme's doc-string, that is available via
404 the following command:
405
406 </p>
407 <pre>
408     prompt -h grml
409 </pre>
410 <p>
411 The other themes also come with doc-strings, but the main theme's is the
412 canonical reference about all of them.
413 </p>
414 <p>
415 This feature requires version <i>4.3.7</i> of the shell. Older versions will use
416 the classic grml prompt as a fallback.
417 </p>
418 <p>
419 A note to people who like customisation: If you are <b>not</b> using a prompt
420 theme for your customisation, but you're either statically setting $PS1 (or
421 $PROMPT) or you're constructing one of those variables in zsh's \`precmd()'
422 function, make sure you are turning the zsh's prompt theme system <b>off</b>
423 before doing so. A correct example customisation could look like this:
424
425 </p>
426 <pre>
427     # Turn the prompt system off:
428     prompt off
429     # Customise the prompt yourself:
430     PS1='%~ %# '
431 </pre>
432 <p>
433 You also add your own tokens by using the \`grml_theme_add_token()' function.
434 Call the function without arguments for detailed documentation about that
435 procedure.
436 </p>
437 <h2>GNU/SCREEN STATUS SETTING</h2>
438 <p>
439 <i>grmlzshrc</i> sets screen's hardstatus lines to the currently running command
440 or <b>'zsh'</b> if the shell is idling at its prompt. If the current working
441 directory is inside a repository unter version control, screen status is set
442 to: <b>'zsh: &lt;repository name&gt;'</b> via zsh's vcs_info.
443 </p>
444 <h2>PERSISTENT HISTORY</h2>
445 <p>
446 If you got commands you consider important enough to be included in every
447 shell's history, you can put them into ~/.important_commands and they will be
448 available via the usual history lookup widgets.
449 </p>
450 <h1>REFERENCE</h1>
451 <h2>ENVIRONMENT VARIABLES</h2>
452 <p>
453 <i>grmlzshrc</i> sets some environment variables, which influence the
454 behaviour of applications.
455 </p>
456 <dl>
457 <dt><b>COLORTERM</b></dt><dd>
458 Set to "yes". Some applications read this to learn about properties
459 of the terminal they are running in.
460 <p></p>
461 </dd>
462 <dt><b>EDITOR</b></dt><dd>
463 If not already set, sets the default editor. Falls back to vi(1),
464 if vim(1) is not available.
465 <p></p>
466 </dd>
467 <dt><b>LESS_TERMCAP_*</b></dt><dd>
468 Some environment variables that add colour support to less(1) for viewing
469 man pages. See termcap(5) for details.
470 <p></p>
471 </dd>
472 <dt><b>MAIL</b></dt><dd>
473 The mailbox file for the current user is set to /var/mail/$USER, if not
474 already set otherwise.
475 <p></p>
476 </dd>
477 <dt><b>PAGER</b></dt><dd>
478 Set less(1) as default pager, if not already set to something different.
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 management of a file or directory using standard unix programs.
671 The target file name is the original name plus a time stamp attached. Symlinks
672 and file attributes like mode, 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 necessary 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>grml_vcs_info_toggle_colour()</b></dt><dd>
744 Toggles between coloured and uncoloured formats in vcs_info configuration.
745 This is useful with prompts that break if colour codes are in vcs_info
746 format expansions (like the `clint' prompt and every other prompt that
747 uses %v to expand the contents of `$vcs_into_msg_0_'). If you are using
748 customised vcs_info formats, you shouldn't be using this function, since
749 it will set all formats to grml's default values (either coloured or plain)
750 again.
751 <p></p>
752 </dd>
753 <dt><b>hgdi()</b></dt><dd>
754 Use GNU diff with options -ubwd for mercurial.
755 <p></p>
756 </dd>
757 <dt><b>hgstat()</b></dt><dd>
758 Displays diffstat between the revision given as argument and tip (no
759 argument means last revision).
760 <p></p>
761 </dd>
762 <dt><b>hidiff()</b></dt><dd>
763 Outputs highlighted diff; needs highstring(1).
764 <p></p>
765 </dd>
766 <dt><b>is4()</b></dt><dd>
767 Returns true, if zsh version is equal or greater than 4, else false.
768 <p></p>
769 </dd>
770 <dt><b>is41()</b></dt><dd>
771 Returns true, if zsh version is equal or greater than 4.1, else false.
772 <p></p>
773 </dd>
774 <dt><b>is42()</b></dt><dd>
775 Returns true, if zsh version is equal or greater than 4.2, else false.
776 <p></p>
777 </dd>
778 <dt><b>is425()</b></dt><dd>
779 Returns true, if zsh version is equal or greater than 4.2.5, else false.
780 <p></p>
781 </dd>
782 <dt><b>is43()</b></dt><dd>
783 Returns true, if zsh version is equal or greater than 4.3, else false.
784 <p></p>
785 </dd>
786 <dt><b>is433()</b></dt><dd>
787 Returns true, if zsh version is equal or greater than 4.3.3, else false.
788 <p></p>
789 </dd>
790 <dt><b>isdarwin()</b></dt><dd>
791 Returns true, if running on darwin, else false.
792 <p></p>
793 </dd>
794 <dt><b>isfreebsd()</b></dt><dd>
795 Returns true, if running on FreeBSD, else false.
796 <p></p>
797 </dd>
798 <dt><b>isgrml()</b></dt><dd>
799 Returns true, if running on a grml system, else false.
800 <p></p>
801 </dd>
802 <dt><b>isgrmlcd()</b></dt><dd>
803 Returns true, if running on a grml system from a live cd, else false.
804 <p></p>
805 </dd>
806 <dt><b>isgrmlsmall()</b></dt><dd>
807 Returns true, if run on grml-small, else false.
808 <p></p>
809 </dd>
810 <dt><b>islinux()</b></dt><dd>
811 Returns true, if running on Linux, else false.
812 <p></p>
813 </dd>
814 <dt><b>iso2utf()</b></dt><dd>
815 Changes every occurrence of the string iso885915 or ISO885915 in
816 environment variables to UTF-8.
817 <p></p>
818 </dd>
819 <dt><b>isopenbsd()</b></dt><dd>
820 Returns true, if running on OpenBSD, else false.
821 <p></p>
822 </dd>
823 <dt><b>isutfenv()</b></dt><dd>
824 Returns true, if run within an utf environment, else false.
825 <p></p>
826 </dd>
827 <dt><b>mkcd()</b></dt><dd>
828 Creates directory including parent directories, if necessary. Then changes
829 current working directory to it.
830 <p></p>
831 </dd>
832 <dt><b>modified()</b></dt><dd>
833 Lists files in current directory, which have been modified within the
834 last N days. N is an integer to be passed as first and only argument.
835 If no argument is specified N is set to 1.
836 <p></p>
837 </dd>
838 <dt><b>nt()</b></dt><dd>
839 A helper function for the "e" glob qualifier to list all files newer
840 than a reference file.
841
842 Example usages:
843 <pre>
844 % NTREF=/reference/file
845 % ls -l *(e:nt:)
846 % # Inline:
847 % ls -l *(e:'nt /reference/file':)
848 </pre>
849 <p></p>
850 </dd>
851 <dt><b>profile()</b></dt><dd>
852 Runs a command in zsh with profiling enabled (See startup variable
853 ZSH_PROFILE_RC above).
854 <p></p>
855 </dd>
856 <dt><b>salias()</b></dt><dd>
857 Creates an alias whith sudo prepended, if $EUID is not zero. Run "salias -h"
858 for details. See also xunfunction() below.
859 <p></p>
860 </dd>
861 <dt><b>simple-extract()</b></dt><dd>
862 Tries to uncompress/unpack given files with the appropriate programs. If an URI
863 starting with https, http or ftp is provided simple-extract tries to download
864 and then uncompress/unpack the file. The choice is made along the filename
865 ending. simple-extract will not delete the original archive (even on .gz,.bz2 or
866 .xz) unless you use the '-d' option.
867 <p></p>
868 </dd>
869 <dt><b>sll()</b></dt><dd>
870 Prints details of symlinks given as arguments.
871 <p></p>
872 </dd>
873 <dt><b>ssl-cert-fingerprints</b></dt><dd>
874 Prints the SHA512, SHA256, SHA1 and MD5 digest of a x509 certificate.
875 First and only parameter must be a file containing a certificate. Use
876 /dev/stdin as file if you want to pipe a certificate to these
877 functions.
878 <p></p>
879 </dd>
880 <dt><b>ssl-cert-info</b></dt><dd>
881 Prints all information of a x509 certificate including the SHA512,
882 SHA256, SHA1 and MD5 digests. First and only parameter must be a file
883 containing a certificate. Use /dev/stdin as file if you want to pipe a
884 certificate to this function.
885 <p></p>
886 </dd>
887 <dt><b>ssl-cert-sha512(), ssl-cert-sha256(), ssl-cert-sha1(), ssl-cert-md5()</b></dt><dd>
888 Prints the SHA512, SHA256, SHA1 respective MD5 digest of a x509
889 certificate. First and only parameter must be a file containing a
890 certificate. Use /dev/stdin as file if you want to pipe a certificate
891 to this function.
892 <p></p>
893 </dd>
894 <dt><b>Start(), Restart(), Stop(), Force-Reload(), Reload()</b></dt><dd>
895 Functions for controlling daemons.
896 <pre>
897 Example usage:
898 % Restart ssh
899 </pre>
900 <p></p>
901 </dd>
902 <dt><b>trans()</b></dt><dd>
903 Translates a word from german to english (-D) or vice versa (-E).
904 <p></p>
905 </dd>
906 <dt><b>uchange()</b></dt><dd>
907 Shows upstreams changelog of a given package in $PAGER.
908 <p></p>
909 </dd>
910 <dt><b>uprint()</b></dt><dd>
911 Works around the "print -l ${(u)foo}"-limitation on zsh older than 4.2.
912 <p></p>
913 </dd>
914 <dt><b>utf2iso()</b></dt><dd>
915 Changes every occurrence of the string UTF-8 or utf-8 in environment
916 variables to iso885915.
917 <p></p>
918 </dd>
919 <dt><b>vim()</b></dt><dd>
920 Wrapper for vim(1). It tries to set the title and hands vim the environment
921 variable VIM_OPTIONS on the command line. So the user may define command
922 line options, she always wants, in her .zshrc.local.
923 <p></p>
924 </dd>
925 <dt><b>whatwhen()</b></dt><dd>
926 Searches the history for a given pattern and lists the results by date.
927 The first argument is the search pattern. The second and third ones are
928 optional and denote a search range (default: -100).
929 <p></p>
930 </dd>
931 <dt><b>xcat()</b></dt><dd>
932 Tries to cat(1) file(s) given as parameter(s). Always returns true.
933 See also xunfunction() below.
934 <p></p>
935 </dd>
936 <dt><b>xsource()</b></dt><dd>
937 Tries to source the file(s) given as parameter(s). Always returns true.
938 See zshbuiltins(1) for a detailed description of the source command.
939 See also xunfunction() below.
940 <p></p>
941 </dd>
942 <dt><b>xtrename()</b></dt><dd>
943 Changes the title of xterm window from within screen(1). Run without
944 arguments for details.
945 <p></p>
946 </dd>
947 <dt><b>xunfunction()</b></dt><dd>
948 Removes the functions salias, xcat, xsource, xunfunction and zrcautoload.
949 <p></p>
950 </dd>
951 <dt><b>zrcautoload()</b></dt><dd>
952 Wrapper around the autoload builtin. Loads the definitions of functions
953 from the file given as argument. Searches $fpath for the file. See also
954 xunfunction() above.
955 <p></p>
956 </dd>
957 <dt><b>zrclocal()</b></dt><dd>
958 Sources /etc/zsh/zshrc.local and ${HOME}/.zshrc.local. These are the files
959 where own modifications should go. See also zshbuiltins(1) for a description
960 of the source command.
961 </dd>
962 </dl>
963 <h2>ALIASES</h2>
964 <p>
965 <i>grmlzshrc</i> comes with a wide array of predefined aliases to ease the user's
966 life. A few aliases (like those involving <i>grep</i> or <i>ls</i>) use the option
967 <i>--color=auto</i> for colourizing output. That option is part of <b>GNU</b>
968 implementations of these tools, and will only be used if such an implementation
969 is detected.
970 </p>
971 <dl>
972 <dt><b>acp</b> (<i>apt-cache policy</i>)</dt><dd>
973 With no arguments prints out the priorities of each source. If a package name
974 is given, it displays detailed information about the priority selection of the
975 package.
976 <p></p>
977 </dd>
978 <dt><b>acs</b> (<i>apt-cache search</i>)</dt><dd>
979 Searches debian package lists for the regular expression provided as argument.
980 The search includes package names and descriptions. Prints out name and short
981 description of matching packages.
982 <p></p>
983 </dd>
984 <dt><b>acsh</b> (<i>apt-cache show</i>)</dt><dd>
985 Shows the package records for the packages provided as arguments.
986 <p></p>
987 </dd>
988 <dt><b>adg</b> (<i>apt-get dist-upgrade</i>)</dt><dd>
989 Performs an upgrade of all installed packages. Also tries to automatically
990 handle changing dependencies with new versions of packages. As this may change
991 the install status of (or even remove) installed packages, it is potentially
992 dangerous to use dist-upgrade; invoked by sudo, if necessary.
993 <p></p>
994 </dd>
995 <dt><b>ag</b> (<i>apt-get upgrade</i>)</dt><dd>
996 Downloads and installs the newest versions of all packages currently installed
997 on the system. Under no circumstances are currently installed packages removed,
998 or packages not already installed retrieved and installed. New versions of
999 currently installed packages that cannot be upgraded without changing the install
1000 status of another package will be left at their current version. An update must
1001 be performed first (see au below); run by sudo, if necessary.
1002 <p></p>
1003 </dd>
1004 <dt><b>agi</b> (<i>apt-get install</i>)</dt><dd>
1005 Downloads and installs or upgrades the packages given on the command line.
1006 If a hyphen is appended to the package name, the identified package will be
1007 removed if it is installed. Similarly a plus sign can be used to designate a
1008 package to install. This may be useful to override decisions made by apt-get's
1009 conflict resolution system.
1010 A specific version of a package can be selected for installation by following
1011 the package name with an equals and the version of the package to select. This
1012 will cause that version to be located and selected for install. Alternatively a
1013 specific distribution can be selected by following the package name with a slash
1014 and the version of the distribution or the Archive name (stable, testing, unstable).
1015 Gets invoked by sudo, if user id is not 0.
1016 <p></p>
1017 </dd>
1018 <dt><b>ati</b> (<i>aptitude install</i>)</dt><dd>
1019 Aptitude is a terminal-based package manager with a command line mode similar to
1020 apt-get (see agi above); invoked by sudo, if necessary.
1021 <p></p>
1022 </dd>
1023 <dt><b>au</b> (<i>apt-get update</i>)</dt><dd>
1024 Resynchronizes the package index files from their sources. The indexes of
1025 available packages are fetched from the location(s) specified in
1026 /etc/apt/sources.list. An update should always be performed before an
1027 upgrade or dist-upgrade; run by sudo, if necessary.
1028 <p></p>
1029 </dd>
1030 <dt><b>da</b> (<i>du -sch</i>)</dt><dd>
1031 Prints the summarized disk usage of the arguments as well as a grand total
1032 in human readable format.
1033 <p></p>
1034 </dd>
1035 <dt><b>dbp</b> (<i>dpkg-buildpackage</i>)</dt><dd>
1036 Builds binary or source packages from sources (See: dpkg-buildpackage(1)).
1037 <p></p>
1038 </dd>
1039 <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>
1040 Prints installed Packages sorted by size (descending).
1041 <p></p>
1042 </dd>
1043 <dt><b>dir</b> (<i>ls -lSrah</i>)</dt><dd>
1044 Lists files (including dot files) sorted by size (biggest last) in long and
1045 human readable output format.
1046 <p></p>
1047 </dd>
1048 <dt><b>ge</b> (<i>grep-excuses</i>)</dt><dd>
1049 Searches the testing excuses files for a specific maintainer (See:
1050 grep-excuses(1)).
1051 <p></p>
1052 </dd>
1053 <dt><b>grep</b> (<i>grep --color=auto</i>)</dt><dd>
1054 Shows grep output in nice colors, if available.
1055 <p></p>
1056 </dd>
1057 <dt><b>grml-version</b> (<i>cat /etc/grml_version</i>)</dt><dd>
1058 Prints version of running grml.
1059 <p></p>
1060 </dd>
1061 <dt><b>hbp</b> (<i>hg-buildpackage</i>)</dt><dd>
1062 Helper program to maintain Debian packages with mercurial.
1063 <p></p>
1064 </dd>
1065 <dt><b>http</b> (<i>python -m SimpleHTTPServer</i>)</dt><dd>
1066 Basic HTTP server implemented in python. Listens on port 8000/tcp and
1067 serves current directory. Implements GET and HEAD methods.
1068 <p></p>
1069 </dd>
1070 <dt><b>insecscp</b> (<i>scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"</i>)</dt><dd>
1071 scp with possible man-in-the-middle attack enabled. This is convenient, if the targets
1072 host key changes frequently, for example on virtualized test- or development-systems.
1073 To be used only inside trusted networks, of course.
1074 <p></p>
1075 </dd>
1076 <dt><b>insecssh</b> (<i>ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"</i>)</dt><dd>
1077 ssh with possible man-in-the-middle attack enabled
1078 (for an explanation see insecscp above).
1079 <p></p>
1080 </dd>
1081 <dt><b>help-zshglob</b> (<i>H-Glob()</i>)</dt><dd>
1082 Runs the function H-Glob() to expand or explain wildcards.
1083 <p></p>
1084 </dd>
1085 <dt><b>j</b> (<i>jobs -l</i>)</dt><dd>
1086 Prints status of jobs in the current shell session in long format.
1087 <p></p>
1088 </dd>
1089 <dt><b>l</b> (<i>ls -l --color=auto</i>)</dt><dd>
1090 Lists files in long output format with indicator for filetype appended
1091 to filename. If the terminal supports it, with colored output.
1092 <p></p>
1093 </dd>
1094 <dt><b>la</b> (<i>ls -la --color=auto</i>)</dt><dd>
1095 Lists files in long colored output format. Including file names
1096 starting with ".".
1097 <p></p>
1098 </dd>
1099 <dt><b>lad</b> (<i>ls -d .*(/)</i>)</dt><dd>
1100 Lists the dot directories (not their contents) in current directory.
1101 <p></p>
1102 </dd>
1103 <dt><b>lh</b> (<i>ls -hAl --color=auto</i>)</dt><dd>
1104 Lists files in long and human readable output format in nice colors,
1105 if available. Includes file names starting with "." except "." and
1106 "..".
1107 <p></p>
1108 </dd>
1109 <dt><b>ll</b> (<i>ls -l --color=auto</i>)</dt><dd>
1110 Lists files in long colored output format.
1111 <p></p>
1112 </dd>
1113 <dt><b>llog</b> (<i>$PAGER /var/log/syslog</i>)</dt><dd>
1114 Opens syslog in pager.
1115 <p></p>
1116 </dd>
1117 <dt><b>ls</b> (<i>ls -C --color=auto</i>)</dt><dd>
1118 Lists directory, entries are listed by columns and an indicator for
1119 file type is appended to each file name. Additionally the output is
1120 colored, if the terminal supports it.
1121 <p></p>
1122 </dd>
1123 <dt><b>lsa</b> (<i>ls -a .*(.)</i>)</dt><dd>
1124 Lists dot files in current working directory.
1125 <p></p>
1126 </dd>
1127 <dt><b>lsbig</b> (<i>ls -flh *(.OL[1,10])</i>)</dt><dd>
1128 Displays the ten biggest files (long and human readable output format).
1129 <p></p>
1130 </dd>
1131 <dt><b>lsd</b> (<i>ls -d *(/)</i>)</dt><dd>
1132 Shows directories.
1133 <p></p>
1134 </dd>
1135 <dt><b>lse</b> (<i>ls -d *(/^F)</i>)</dt><dd>
1136 Shows empty directories.
1137 <p></p>
1138 </dd>
1139 <dt><b>lsl</b> (<i>ls -l *(@)</i>)</dt><dd>
1140 Lists symbolic links in current directory.
1141 <p></p>
1142 </dd>
1143 <dt><b>lsnew</b> (<i>ls -rl *(D.om[1,10])</i>)</dt><dd>
1144 Displays the ten newest files (long output format).
1145 <p></p>
1146 </dd>
1147 <dt><b>lsnewdir</b> (<i>ls -rthdl *(/om[1,10]) .*(D/om[1,10])</i>)</dt><dd>
1148 Displays the ten newest directories and ten newest .directories.
1149 <p></p>
1150 </dd>
1151 <dt><b>lsold</b> (<i>ls -rtlh *(D.om[1,10])</i>)</dt><dd>
1152 Displays the ten oldest files (long output format).
1153 <p></p>
1154 </dd>
1155 <dt><b>lsolddir</b> (<i>ls -rthdl *(/Om[1,10]) .*(D/Om[1,10])</i>)</dt><dd>
1156 Displays the ten oldest directories and ten oldest .directories.
1157 <p></p>
1158 </dd>
1159 <dt><b>lss</b> (<i>ls -l *(s,S,t)</i>)</dt><dd>
1160 Lists files in current directory that have the setuid, setgid or sticky bit
1161 set.
1162 <p></p>
1163 </dd>
1164 <dt><b>lssmall</b> (<i>ls -Srl *(.oL[1,10])</i>)</dt><dd>
1165 Displays the ten smallest files (long output format).
1166 <p></p>
1167 </dd>
1168 <dt><b>lsw</b> (<i>ls -ld *(R,W,X.^ND/)</i>)</dt><dd>
1169 Displays all files which are world readable and/or world writable and/or
1170 world executable (long output format).
1171 <p></p>
1172 </dd>
1173 <dt><b>lsx</b> (<i>ls -l *(*)</i>)</dt><dd>
1174 Lists only executable files.
1175 <p></p>
1176 </dd>
1177 <dt><b>mdstat</b> (<i>cat /proc/mdstat</i>)</dt><dd>
1178 Lists all active md (i.e. linux software raid) devices with some information
1179 about them.
1180 <p></p>
1181 </dd>
1182 <dt><b>mq</b> (<i>hg -R $(readlink -f $(hg root)/.hg/patches)</i>)</dt><dd>
1183 Executes the commands on the versioned patch queue from current repository.
1184 <p></p>
1185 </dd>
1186 <dt><b>rmcdir</b> (<i>'cd ..; rmdir $OLDPWD || cd $OLDPWD</i>)</dt><dd>
1187 rmdir current working directory
1188 <p></p>
1189 </dd>
1190 <dt><b>screen</b> (<i>/usr/bin/screen -c ${HOME}/.screenrc</i>)</dt><dd>
1191 If invoking user is root, starts screen session with /etc/grml/screenrc
1192 as config file. If invoked by a regular user, start a screen session
1193 with users .screenrc config if it exists, else use /etc/grml/screenrc_grml
1194 as configuration.
1195 <p></p>
1196 </dd>
1197 <dt><b>su</b> (<i>sudo su</i>)</dt><dd>
1198 If user is running a Grml live system, don't ask for any password, if she
1199 wants a root shell.
1200 <p></p>
1201 </dd>
1202 <dt><b>term2iso</b> (<i>echo 'Setting terminal to iso mode' ; print -n '\e%@'</i>)</dt><dd>
1203 Sets mode from UTF-8 to ISO 2022 (See:
1204 <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html#term">http://www.cl.cam.ac.uk/~mgk25/unicode.html#term</a>).
1205 <p></p>
1206 </dd>
1207 <dt><b>term2utf</b> (<i>echo 'Setting terminal to utf-8 mode'; print -n '\e%G'</i>)</dt><dd>
1208 Sets mode from ISO 2022 to UTF-8 (See:
1209 <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html#term">http://www.cl.cam.ac.uk/~mgk25/unicode.html#term</a>).
1210 <p></p>
1211 </dd>
1212 <dt><b>tlog</b> (<i>tail -f /var/log/syslog</i>)</dt><dd>
1213 Prints syslog continuously (See tail(1)).
1214 <p></p>
1215 </dd>
1216 <dt><b>up</b> (<i>aptitude update ; aptitude safe-upgrade</i>)</dt><dd>
1217 Performs a system update followed by a system upgrade using aptitude; run
1218 by sudo, if necessary. See au and ag above.
1219 <p></p>
1220 </dd>
1221 <dt><b>url-quote</b> (<i>autoload -U url-quote-magic ; zle -N self-insert url-quote-magic</i>)</dt><dd>
1222 After calling, characters of URLs as typed get automatically escaped, if necessary, to
1223 protect them from the shell.
1224 <p></p>
1225 </dd>
1226 <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>
1227 Reboots using kexec(8) and thus reduces boot time by skipping hardware initialization of BIOS/firmware.
1228 <p></p>
1229 </dd>
1230 <dt><b>...</b> (<i>cd ../../</i>)</dt><dd>
1231 Changes current directory two levels higher.
1232 </dd>
1233 </dl>
1234 <h1>AUXILIARY FILES</h1>
1235 <p>
1236 This is a set of files, that - if they exist - can be used to customize the
1237 behaviour of <i>grmlzshrc</i>.
1238 </p>
1239 <dl>
1240 <dt><b>.zshrc.pre</b></dt><dd>
1241 Sourced at the very beginning of <i>grmlzshrc</i>. Among other things, it can
1242 be used to permantenly change <i>grmlzshrc</i>'s STARTUP VARIABLES (see above):
1243
1244 <pre>
1245 # show battery status in RPROMPT
1246 GRML_DISPLAY_BATTERY=1
1247 # always load the complete setup, even for root
1248 GRML_ALWAYS_LOAD_ALL=1
1249 </pre>
1250 <p></p>
1251 </dd>
1252 <dt><b>.zshrc.local</b></dt><dd>
1253 Sourced right before loading <i>grmlzshrc</i> is finished. There is a global
1254 version of this file (/etc/zsh/zshrc.local) which is sourced before the
1255 user-specific one.
1256 <p></p>
1257 </dd>
1258 <dt><b>.zdirs</b></dt><dd>
1259 Directory listing for persistent dirstack (see above).
1260 <p></p>
1261 </dd>
1262 <dt><b>.important_commands</b></dt><dd>
1263 List of commands, used by persistent history (see above).
1264 </dd>
1265 </dl>
1266 <h1>INSTALLATION ON NON-DEBIAN SYSTEMS</h1>
1267 <p>
1268 On Debian systems (<a href="http://www.debian.org">http://www.debian.org</a>) - and possibly Ubuntu
1269 (<a href="http://www.ubuntu.com">http://www.ubuntu.com</a>) and similar systems - it is very easy to get
1270 <i>grmlzshrc</i> via grml's .deb repositories.
1271 </p>
1272 <p>
1273 On non-debian systems, that is not an option, but all is not lost:
1274
1275 </p>
1276 <pre>
1277 % wget -O .zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
1278 </pre>
1279 <p>
1280 If you would also like to get separate function files (which you can put into
1281 your <b>$fpath</b>), you can browse and download them at:
1282 </p>
1283 <p>
1284 <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>
1285 </p>
1286 <h1>ZSH REFCARD TAGS</h1>
1287 <p>
1288 If you read <i>grmlzshrc</i>'s code you may notice strange looking comments in
1289 it. These are there for a purpose. grml's zsh-refcard is automatically
1290 generated from the contents of the actual configuration file. However, we need
1291 a little extra information on which comments and what lines of code to take
1292 into account (and for what purpose).
1293 </p>
1294 <p>
1295 Here is what they mean:
1296 </p>
1297 <p>
1298 List of tags (comment types) used:
1299 </p>
1300 <dl>
1301 <dt><b>#a#</b></dt><dd>
1302 Next line contains an important alias, that should be included in the
1303 grml-zsh-refcard. (placement tag: @@INSERT-aliases@@)
1304 <p></p>
1305 </dd>
1306 <dt><b>#f#</b></dt><dd>
1307 Next line contains the beginning of an important function. (placement
1308 tag: @@INSERT-functions@@)
1309 <p></p>
1310 </dd>
1311 <dt><b>#v#</b></dt><dd>
1312 Next line contains an important variable. (placement tag:
1313 @@INSERT-variables@@)
1314 <p></p>
1315 </dd>
1316 <dt><b>#k#</b></dt><dd>
1317 Next line contains an important keybinding. (placement tag:
1318 @@INSERT-keybindings@@)
1319 <p></p>
1320 </dd>
1321 <dt><b>#d#</b></dt><dd>
1322 Hashed directories list generation: <i>start</i>: denotes the start of a list of
1323 'hash -d' definitions. <i>end</i>: denotes its end. (placement tag:
1324 @@INSERT-hasheddirs@@)
1325 <p></p>
1326 </dd>
1327 <dt><b>#A#</b></dt><dd>
1328 Abbreviation expansion list generation: <i>start</i>: denotes the beginning of
1329 abbreviations. <i>end</i>: denotes their end.
1330
1331 Lines within this section that end in '#d .*' provide extra documentation to
1332 be included in the refcard. (placement tag: @@INSERT-abbrev@@)
1333 <p></p>
1334 </dd>
1335 <dt><b>#m#</b></dt><dd>
1336 This tag allows you to manually generate refcard entries for code lines that
1337 are hard/impossible to parse.
1338 Example:
1339
1340 <pre>
1341 #m# k ESC-h Call the run-help function
1342 </pre>
1343
1344 That would add a refcard entry in the keybindings table for 'ESC-h' with the
1345 given comment.
1346
1347 So the syntax is: #m# &lt;section&gt; &lt;argument&gt; &lt;comment&gt;
1348 <p></p>
1349 </dd>
1350 <dt><b>#o#</b></dt><dd>
1351 This tag lets you insert entries to the 'other' hash. Generally, this should
1352 not be used. It is there for things that cannot be done easily in another way.
1353 (placement tag: @@INSERT-other-foobar@@)
1354 </dd>
1355 </dl>
1356 <p>
1357 All of these tags (except for m and o) take two arguments, the first
1358 within the tag, the other after the tag:
1359 </p>
1360 <p>
1361 #&lt;tag&gt;&lt;section&gt;# &lt;comment&gt;
1362 </p>
1363 <p>
1364 Where &lt;section&gt; is really just a number, which are defined by the @secmap
1365 array on top of 'genrefcard.pl'. The reason for numbers instead of names is,
1366 that for the reader, the tag should not differ much from a regular comment.
1367 For zsh, it is a regular comment indeed. The numbers have got the following
1368 meanings:
1369 </p>
1370 <dl>
1371 <dt><b>0</b></dt><dd>
1372 <i>default</i>
1373 <p></p>
1374 </dd>
1375 <dt><b>1</b></dt><dd>
1376 <i>system</i>
1377 <p></p>
1378 </dd>
1379 <dt><b>2</b></dt><dd>
1380 <i>user</i>
1381 <p></p>
1382 </dd>
1383 <dt><b>3</b></dt><dd>
1384 <i>debian</i>
1385 <p></p>
1386 </dd>
1387 <dt><b>4</b></dt><dd>
1388 <i>search</i>
1389 <p></p>
1390 </dd>
1391 <dt><b>5</b></dt><dd>
1392 <i>shortcuts</i>
1393 <p></p>
1394 </dd>
1395 <dt><b>6</b></dt><dd>
1396 <i>services</i>
1397 </dd>
1398 </dl>
1399 <p>
1400 So, the following will add an entry to the 'functions' table in the 'system'
1401 section, with a (hopefully) descriptive comment:
1402
1403 </p>
1404 <pre>
1405 #f1# Edit an alias via zle
1406 edalias() {
1407 </pre>
1408 <p>
1409
1410 It will then show up in the @@INSERT-aliases-system@@ replacement tag that can
1411 be found in 'grml-zsh-refcard.tex.in'. If the section number is omitted, the
1412 'default' section is assumed. Furthermore, in 'grml-zsh-refcard.tex.in'
1413 @@INSERT-aliases@@ is exactly the same as @@INSERT-aliases-default@@. If you
1414 want a list of <b>all</b> aliases, for example, use @@INSERT-aliases-all@@.
1415 </p>
1416 <h1>CONTRIBUTING</h1>
1417 <p>
1418 If you want to help to improve grml's zsh setup, clone the grml-etc-core
1419 repository from git.grml.org:
1420
1421 </p>
1422 <pre>
1423 % git clone git://git.grml.org/grml-etc-core.git
1424 </pre>
1425 <p>
1426 Make your changes, commit them; use '<b>git format-patch</b>' to create a series
1427 of patches and send those to the following address via '<b>git send-email</b>':
1428
1429 </p>
1430 <pre>
1431 grml-etc-core@grml.org
1432 </pre>
1433 <p>
1434 Doing so makes sure the right people get your patches for review and
1435 possibly inclusion.
1436 </p>
1437 <h1>STATUS</h1>
1438 <p>
1439 This manual page is the <b>reference</b> manual for <i>grmlzshrc</i>.
1440 </p>
1441 <p>
1442 That means that in contrast to the existing refcard it should document <b>every</b>
1443 aspect of the setup.
1444 </p>
1445 <p>
1446 This manual is currently not complete. If you want to help improving it, visit
1447 the following pages:
1448 </p>
1449 <p>
1450 <a href="http://wiki.grml.org/doku.php?id=zshrcmanual">http://wiki.grml.org/doku.php?id=zshrcmanual</a>
1451 </p>
1452 <p>
1453 <a href="http://lists.mur.at/pipermail/grml/2009-August/004609.html">http://lists.mur.at/pipermail/grml/2009-August/004609.html</a>
1454 </p>
1455 <p>
1456 Contributions are highly welcome.
1457 </p>
1458 <h1>AUTHORS</h1>
1459 <p>
1460 This manpage was written by Frank Terbeck &lt;<a href="mailto:ft@grml.org">ft@grml.org</a>&gt;, Joerg Woelke
1461 &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
1462 Beckert &lt;<a href="mailto:abe@deuxchevaux.org">abe@deuxchevaux.org</a>&gt;.
1463 </p>
1464 <h1>COPYRIGHT</h1>
1465 <p>
1466 Copyright (c) 2009-2013 Grml project &lt;<a href="http://grml.org">http://grml.org</a>&gt;
1467 </p>
1468 <p>
1469 This manpage is distributed under the terms of the GPL version 2.
1470 </p>
1471 <p>
1472 Most parts of grml's zshrc are distributed under the terms of GPL v2, too,
1473 except for <b>accept-line()</b> which are distributed under the same conditions
1474 as zsh itself (which is BSD-like).
1475 </p>
1476 </div>
1477 <!-- xhtml code generated by txt2tags 2.6 (http://txt2tags.org) -->
1478 <!-- cmdline: txt2tags -\-target xhtml -\-css-sugar -\-style t2t-modern.css -o- grmlzshrc.t2t -->
1479 </body></html>