Update date in GRMLZSHRC and add online rule to Makefile
[grml-etc-core.git] / doc / grmlzshrc.t2t
1 GRMLZSHRC
2
3 Oktober, 2009
4
5 %!target: man
6 %!postproc(man): "^(\.TH.*) 1 "  "\1 5 "
7
8
9 = NAME =
10 grmlzshrc - grml's zsh setup
11
12
13 = SYNOPSIS =
14 //zsh// [**options**]...
15
16
17 = DESCRIPTION =
18 The grml project provides a fairly exhaustive interactive setup (referred to
19 as //grmlzshrc// throughout this document) for the amazing unix shell zsh
20 (http://zsh.sourceforge.net). This is the reference manual for that
21 setup.
22
23 To use //grmlzshrc//, you need at least version 3.1.7 of zsh (although not all
24 features are enabled in every version).
25
26 //grmlzshrc// behaves differently depending on which user loads it. For the
27 root user (**EUID** == 0) only a subset of features is loaded by default. This
28 behaviour can be altered by setting the **GRML_ALWAYS_LOAD_ALL** STARTUP
29 VARIABLE (see below). Also the umask(1) for the root user is set to 022,
30 while for regular users it is set to 002. So read/write permissions
31 for the regular user and her group are set for new files (keep that
32 in mind on systems, where regular users share a common group).
33
34 = STARTUP VARIABLES =
35 Some of the behaviour of //grmlzshrc// can be altered by setting certain shell
36 variables. These may be set temporarily when starting zsh like this:
37 \
38 ``` % BATTERY=1 zsh
39
40 Or by setting them permanently in **zshrc.pre** (See AUXILIARY FILES below).
41
42 : **BATTERY**
43 If set to a value greater than zero and //acpi// installed, //grmlzshrc// will
44 put the battery status into the right hand side interactive prompt.
45
46
47 = FEATURE DESCRIPTION =
48 This is an in depth description of non-standard features implemented by
49 //grmlzshrc//.
50
51 == DIRSTACK HANDLING ==
52 The dirstack in //grmlzshrc// has a persistent nature. It is stored into a
53 file each time zsh's working directory is changed. That file can be configured
54 via the **DIRSTACKFILE** variable and it defaults to **~/.zdirs**. The
55 **DIRSTACKSIZE** variable defaults to **20** in this setup.
56
57 The **DIRSTACKFILE** is loaded each time zsh starts, therefore freshly started
58 zshs inherit the dirstack of the zsh that most recently updated
59 **DIRSTACKFILE**.
60
61 == DIRECTORY BASED PROFILES ==
62 If you want certain settings to be active in certain directories (and
63 automatically switch back and forth between them), this is what you want.
64 \
65 ```
66 zstyle ':chpwd:profiles:/usr/src/grml(|/|/*)'   profile grml
67 zstyle ':chpwd:profiles:/usr/src/debian(|/|/*)' profile debian
68 ```
69
70 When that's done and you enter a directory that matches the pattern
71 in the third part of the context, a function called chpwd_profile_grml,
72 for example, is called (if it exists).
73
74 If no pattern matches (read: no profile is detected) the profile is
75 set to 'default', which means chpwd_profile_default is attempted to
76 be called.
77
78 A word about the context (the ':chpwd:profiles:*' stuff in the zstyle
79 command) which is used: The third part in the context is matched against
80 **$PWD**. That's why using a pattern such as /foo/bar(|/|/*) makes sense.
81 Because that way the profile is detected for all these values of **$PWD**:
82 \
83 ```
84 /foo/bar
85 /foo/bar/
86 /foo/bar/baz
87 ```
88
89 So, if you want to make double damn sure a profile works in /foo/bar
90 and everywhere deeper in that tree, just use (|/|/*) and be happy.
91
92 The name of the detected profile will be available in a variable called
93 'profile' in your functions. You don't need to do anything, it'll just
94 be there.
95
96 Then there is the parameter **$CHPWD_PROFILE** which is set to the profile,
97 that was active up to now. That way you can avoid running code for a
98 profile that is already active, by running code such as the following
99 at the start of your function:
100 \
101 ```
102 function chpwd_profile_grml() {
103     [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1
104     ...
105 }
106 ```
107
108 The initial value for **$CHPWD_PROFILE** is 'default'.
109
110 === Signaling availabily/profile changes ===
111
112 If you use this feature and need to know whether it is active in your
113 current shell, there are several ways to do that. Here are two simple
114 ways:
115
116 a) If knowing if the profiles feature is active when zsh starts is
117    good enough for you, you can put the following snippet into your
118    //.zshrc.local//:
119 \
120 ```
121 (( ${+functions[chpwd_profiles]} )) &&
122     print "directory profiles active"
123 ```
124
125 b) If that is not good enough, and you would prefer to be notified
126    whenever a profile changes, you can solve that by making sure you
127    start **every** profile function you create like this:
128 \
129 ```
130 function chpwd_profile_myprofilename() {
131     [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1
132     print "chpwd(): Switching to profile: $profile"
133   ...
134 }
135 ```
136
137 That makes sure you only get notified if a profile is **changed**,
138 not everytime you change directory.
139
140 === Version requirement ===
141 This feature requires zsh //4.3.3// or newer.
142
143
144 == ACCEPTLINE WRAPPER ==
145 The //accept-line// wiget is the one that is taking action when the **return**
146 key is hit. //grmlzshrc// uses a wrapper around that widget, which adds new
147 functionality.
148
149 This wrapper is configured via styles. That means, you issue commands, that look
150 like:
151 \
152 ```
153 zstyle 'context' style value
154 ```
155
156 The context namespace, that we are using is 'acceptline'. That means, the actual
157 context for your commands look like: **':acceptline:<subcontext>'**.
158
159 Where **<subcontext>** is one of: **default**, **normal**, **force**, **misc**
160 or **empty**.
161
162
163 === Recognized Contexts ===
164 : **default**
165 This is the value, the context is initialized with.
166 The //compwarnfmt and //rehash// styles are looked up in this context.
167
168 : **normal**
169 If the first word in the command line is either a command, alias, function,
170 builtin or reserved word, you are in this context.
171
172 : **force**
173 This is the context, that is used if you hit enter again, after being warned
174 about the existence of a _completion for the non-existing command you
175 entered.
176
177 : **empty**
178 This is the context, you are in if the command line is empty or only
179 consists of whitespace.
180
181 : **misc**
182 This context is in effect, if you entered something that does not match any
183 of the above. (e.g.: variable assignments).
184
185
186 === Available Styles ===
187 : **nocompwarn**
188 If you set this style to true, the warning about non existent commands,
189 for which completions exist will not be issued. (Default: **false**)
190
191 : **compwarnfmt**
192 The message, that is displayed to warn about the _completion issue.
193 (default: **'%c will not execute and completion %f exists.'**)
194 '%c' is replaced by the command name, '%f' by the completion's name.
195
196 : **rehash**
197 If this is set, we'll force rehashing, if appropriate. (Defaults to
198 **true** in //grmlzshrc//).
199
200 : **actions**
201 This can be a list of wigdets to call in a given context. If you need a
202 specific order for these to be called, name them accordingly. The default value
203 is an **empty list**.
204
205 : **default_action**
206 The name of a widget, that is called after the widgets from 'actions'.
207 By default, this will be '.accept-line' (which is the built-in accept-line
208 widget).
209
210 : **call_default**
211 If true in the current context, call the widget in the 'default_action'
212 style. (The default is **true** in all contexts.)
213
214
215 == PROMPT ==
216
217
218 == GNU/SCREEN STATUS SETTING ==
219 //grmlzshrc// sets screen's hardstatus lines to the currently running command
220 or **'zsh'** if the shell is idling at its prompt. If the current working
221 directory is inside a repository unter version control, screen status is set
222 to: **'zsh: <repository name>'** via zsh's vcs_info.
223
224
225 == PERSISTENT HISTORY ==
226 If you got commands you consider important enough to be included in every
227 shell's history, you can put them into ~/.important_commands and they will be
228 available via the usual history lookup widgets.
229
230
231 = REFERENCE =
232 == ENVIRONMENT VARIABLES ==
233 //grmlzshrc// sets some environment variables, which influence the
234 behaviour of applications.
235
236 : **BROWSER**
237 If X is running this is set to "firefox", otherwise to "w3m".
238
239 : **COLORTERM**
240 Set to "yes". Some applications read this to learn about properties
241 of the terminal they are running in.
242
243 : **QTDIR**
244 Holds the path to shared files for the C++ application framework QT
245 (version 3 or 4).
246
247
248 == OPTIONS ==
249 Apart from zsh's default options, //grmlzshrc// sets some options
250 that change the behaviour of zsh. Options that change Z-shell's default
251 settings are marked by <grml>. But note, that zsh's defaults vary depending
252 on its emulation mode (csh, ksh, sh, or zsh). For details, see zshoptions(1).
253
254 : **append_history**
255 Zsh sessions, that use //grmlzshrc//, will append their history list to the
256 history file, rather than replace it. Thus, multiple parallel zsh sessions
257 will all have the new entries from their history lists added to the history
258 file, in the order that they exit. The file will still be periodically
259 re-written to trim it when the number of lines grows 20% beyond the value
260 specified by $SAVEHIST.
261
262 : **auto_cd** <grml>
263 If a command is issued that can't be executed as a normal command, and the
264 command is the name of a directory, perform the cd command to that directory.
265
266 : **auto_pushd** <grml>
267 Make cd push the old directory onto the directory stack.
268
269 : **completeinword** <grml>
270 If the cursor is inside a word, completion is done from both ends;
271 instead of moving the cursor to the end of the word first and starting
272 from there.
273
274 : **extended_glob** <grml>
275 Treat the '#', '~' and '^' characters as active globbing pattern characters.
276
277 : **extended_history** <grml>
278 Save each command's beginning timestamp (in seconds since the epoch) and the
279 duration (in seconds) to the history file.
280
281 : **hash_list_all**
282 Whenever a command completion is attempted, make sure the entire command
283 path is hashed first. This makes the first completion slower.
284
285 : **histignorealldups** <grml>
286 If a new command line being added to the history list duplicates an
287 older one, the older command is removed from the list, even if it is
288 not the previous event.
289
290 : **histignorespace** <grml>
291 Remove command lines from the history list when the first character on
292 the line is a space, or when one of the expanded aliases contains a
293 leading space. Note that the command lingers in the internal history
294 until the next command is entered before it vanishes.
295
296 : **longlistjobs** <grml>
297 List jobs in long format by default.
298
299 : **nobeep** <grml>
300 Avoid to beep on errors in zsh command line editing (zle).
301
302 : **noglobdots**
303 A wildcard character never matches a leading '.'.
304
305 : **nohup** <grml>
306 Do not send the hangup signal (HUP:1) to running jobs when the shell exits.
307
308 : **nonomatch** <grml>
309 If a pattern for filename generation has no matches, do not print an error
310 and leave it unchanged in the argument list. This also applies to file
311 expansion of an initial `~' or `='.
312
313 : **notify**
314 Report the status of background jobs immediately, rather than waiting until
315 just before printing a prompt.
316
317 : **pushd_ignore_dups** <grml>
318 Don't push multiple copies of the same directory onto the directory stack.
319
320 : **share_history** <grml>
321 As each line is added to the history file, it is checked to see if anything
322 else was written out by another shell, and if so it is included in the
323 history of the current shell too. Using !-style history, the commands from
324 the other sessions will not appear in the history list unless you explicitly
325 type the "history" command. This option is activated for zsh versions >= 4,
326 only.
327
328
329 == KEYBINDINGS ==
330 Apart from zsh's default key bindings, //grmlzshrc// comes with its own set of
331 key bindings. Note that bindings like **ESC-e** can also be typed as **ALT-e**
332 on PC keyboards.
333
334 : **ESC-e**
335 Edit the current command buffer in your favourite editor.
336
337 : **ESC-v**
338 Deletes a word left of the cursor; seeing '/' as additional word separator.
339
340 : **CTRL-x-1**
341 Jump right after the first word.
342
343 : **CTRL-x-p**
344 Searches the last occurence of string before the cursor in the command history.
345
346 : **CTRL-z**
347 Brings a job, which got suspended with CTRL-z back to foreground.
348
349
350 == SHELL FUNCTIONS ==
351 //grmlzshrc// comes with a wide array of defined shell functions to ease the
352 user's life.
353
354 : **2html()**
355 Converts plaintext files to HTML using vim. The output is written to
356 <filename>.html.
357
358 : **855resolution()**
359 If 915resolution is available, issues a warning to the user to run it instead
360 to modify the resolution on intel graphics chipsets.
361
362 : **agoogle()**
363 Searches for USENET postings from authors using google groups.
364
365 : **allulimit()**
366 Sets all ulimit values to "unlimited".
367
368 : **ansi-colors()**
369 Prints a colored table of available ansi color codes (to be used in escape
370 sequences) and the colors they represent.
371
372 : **aoeu(), asdf(), uiae()**
373 Pressing the 'asdf' keys toggles between dvorak or neon and us keyboard
374 layout.
375
376 : **audioburn()**
377 Burns the files in ~/ripps (see audiorip() below) to an audio CD.
378 Then prompts the user if she wants to remove that directory. You might need
379 to tell audioburn which cdrom device to use like:
380 "DEVICE=/dev/cdrom audioburn"
381
382 : **audiorip()**
383 Creates directory ~/ripps, if it does not exist. Then rips audio CD into
384 it. Then prompts the user if she wants to burn a audio CD with audioburn()
385 (see above). You might need to tell audiorip which cdrom device to use like:
386 "DEVICE=/dev/cdrom audioburn"
387
388 : **bk()**
389 Simple backup of a file or directory using cp(1). The target file name is the
390 original name plus a time stamp attached. Symlinks and file attributes like mode,
391 ownership and timestamps are preserved.
392
393 : **brltty()**
394 The brltty(1) program provides a braille display, so a blind person can access
395 the console screen. This wrapper function works around problems with some
396 environments (f. e. utf8).
397
398 : **cdrecord()**
399 If the original cdrecord is not installed, issues a warning to the user to
400 use the wodim binary instead. Wodim is the debian fork of Joerg Schillings
401 cdrecord.
402
403 : **check_com()**
404 Returns true if given command exists either as program, function, alias,
405 builtin or reserved word. If the option -c is given, only returns true,
406 if command is a program.
407
408 : **checkhome()**
409 Changes directory to $HOME on first invocation of zsh. This is neccessary on
410 grml systems with autologin.
411
412 : **cl()**
413 Changes current directory to the one supplied by argument and lists the files
414 in it, including file names starting with ".".
415
416 : **d()**
417 Presents a numbered listing of the directory stack. Then changes current
418 working directory to the one chosen by the user.
419
420 : **debbug()**
421 Searches the Debian bug tracking system (bugs.debian.org) for Bug numbers,
422 email addresses of submitters or any string given on the command line.
423
424 : **debbugm()**
425 Shows bug report for debian given by number in mailbox format.
426
427 : **debian2hd()**
428 Tells the user to use grml-debootstrap, if she wants to install debian to
429 harddisk.
430
431 : **dirspace()**
432 Shows the disk usage of the directories given in human readable format;
433 defaults to $path.
434
435 : **disassemble()**
436 Translates C source code to assembly and ouputs both.
437
438 : **doc()**
439 Takes packagename as argument. Sets current working directory to
440 /usr/share/doc/<packagename> and prints out a directory listing.
441
442 : **exirename()**
443 Renames image files based on date/time informations in their exif headers.
444
445 : **fir()**
446 Opens given URL with Firefox (Iceweasel on Debian). If there is already an
447 instance of firefox running, attaches to the first window found and opens the
448 URL in a new tab (this even works across an ssh session).
449
450 : **fluxkey-change()**
451 Switches the key combinations for changing current workspace under fluxbox(1)
452 from Alt-[0-9] to Alt-F[0-9] and vice versa by rewriting $HOME/.fluxbox/keys.
453 Requires the window manager to reread configuration to take effect.
454
455 : **genthumbs()**
456 A simple thumbnails generator. Resizes images (i. e. files that end in ".jpg",
457 ".jpeg", ".gif" or ".png") to 100x200. Output files are named "thumb-<original
458 filename>". Creates an index.html with title "Images" showing the
459 thumbnails as clickable links to the respective original file.
460 //Warning:// On start genthumbs() silently removes a possibly existing "index.html"
461 and all files and/or directories beginning with "thumb-" in current directory!
462
463 : **getair()**
464 Tries to download, unpack and run AIR (imaging software) version 1.2.8.
465
466 : **getgizmo()**
467 Tries to download and install Gizmo (VoIP software) for Debian.
468
469 : **getskype()**
470 Tries to download and install Skype (VoIP software) for Debian.
471
472 : **getskypebeta()**
473 Downloads and installs newer version of Skype.
474
475 : **getxlite()**
476 Tries to download and unpack X-lite (VoIP software) from counterpath.com into
477 ~/tmp.
478
479 : **git-get-diff()**
480 Opens a specific git commitdiff from kernel.org in default browser. Tree is
481 chosen by the environment variable GITTREE which defaults to Linus Torvalds'
482 kernel tree.
483
484 : **git-get-commit()**
485 Opens a specific git commit from kernel.org in default browser. The tree to
486 fetch from is controlled by the environment variable GITTREE which defaults
487 to Linus Torvalds' kernel tree.
488
489 : **git-get-plaindiff()**
490 Fetches specific git diff from kernel.org. The tree is controlled by the
491 environment variable GITTREE which defaults to Linus Torvalds' kernel tree.
492
493 : **greph()**
494 Searches the zsh command history for a regular expression.
495
496 : **hex()**
497 Prints the hexadecimal representation of the number supplied as argument
498 (base ten only).
499
500 : **hidiff()**
501 Outputs highlighted diff; needs highstring(1).
502
503 : **hl()**
504 Shows source files in less(1) with syntax highlighting. Run "hl -h"
505 for detailed usage information.
506
507 : **ic_get()**
508 Queries IMAP server (first parameter) for its capabilities. Takes
509 port number as optional second argument.
510
511 : **is4()**
512 Returns true, if zsh version is equal or greater than 4, else false.
513
514 : **is41()**
515 Returns true, if zsh version is equal or greater than 4.1, else false.
516
517 : **is42()**
518 Returns true, if zsh version is equal or greater than 4.2, else false.
519
520 : **is425()**
521 Returns true, if zsh version is equal or greater than 4.2.5, else false.
522
523 : **is43()**
524 Returns true, if zsh version is equal or greater than 4.3, else false.
525
526 : **is433()**
527 Returns true, if zsh version is equal or greater than 4.3.3, else false.
528
529 : **isdarwin()**
530 Returns true, if running on darwin, else false.
531
532 : **isgrml()**
533 Returns true, if running on a grml system, else false.
534
535 : **isgrmlcd()**
536 Returns true, if running on a grml system from a live cd, else false.
537
538 : **isgrmlsmall()**
539 Returns true, if run on grml-small, else false.
540
541 : **iso2utf()**
542 Changes every occurrence of the string iso885915 or ISO885915 in
543 environment variables to UTF-8.
544
545 : **isutfenv()**
546 Returns true, if run within an utf environment, else false.
547
548 : **lcheck()**
549 Lists libraries that define the symbol containing the string given as
550 parameter.
551
552 : **limg()**
553 Lists images (i. e. files ending with ".jpg", ".gif" or ".png") in current
554 directory.
555
556 : **makereadable()**
557 Creates a PostScript and a PDF file (basename as first argument) from
558 source code files.
559
560 : **man2()**
561 Displays manpage in a streched style.
562
563 : **mcd()**
564 Creates directory including parent directories, if necessary. Then changes
565 current working directory to it.
566
567 : **mdiff()**
568 Diffs the two arguments recursively and writes the
569 output (unified format) to a timestamped file.
570
571 : **memusage()**
572 Prints the summarized memory usage in bytes.
573
574 : **minimal-shell()**
575 Spawns a absolute minimal Korn shell. It references no files in /usr, so
576 that file system can be unmounted.
577
578 : **mkaudiocd()**
579 Renames all mp3 files in ~/ripps (see audiorip above) to lowercase and
580 replaces spaces in file names with underscores. Then mkaudiocd()
581 normalizes the files and recodes them to WAV.
582
583 : **mkiso()**
584 Creates an iso9660 filesystem image with Rockridge and Joliet extensions
585 enabled using mkisofs(8). Prompts the user for volume name, filename and
586 target directory.
587
588 : **mkmaildir()**
589 Creates a directory with first parameter as name inside $MAILDIR_ROOT
590 (defaults to $HOME/Mail) and subdirectories cur, new and tmp.
591
592 : **mmake()**
593 Runs "make install" and logs the output under ~/.errorlogs/; useful for
594 a clean deinstall later.
595
596 : **new()**
597 Lists files in current directory, which have been modified within the
598 last N days. N is an integer required as first and only argument.
599
600 : **ogg2mp3_192()**
601 Recodes an ogg file to mp3 with a bitrate of 192.
602
603 : **peval()**
604 Evaluates a perl expression; useful as command line
605 calculator, therefore also available as "calc".
606
607 : **plap()**
608 Lists all occurrences of the string given as argument in current $PATH.
609
610 : **purge()**
611 Removes typical temporary files (i. e. files like "*~", ".*~", "#*#", "*.o",
612 "a.out", "*.core", "*.cmo", "*.cmi" and ".*.swp") from current directory.
613 Asks for confirmation.
614
615 : **readme()**
616 Opens all README-like files in current working directory with the program
617 defined in the $PAGER environment variable.
618
619 : **refunc()**
620 Reloads functions given as parameters.
621
622 : **regcheck()**
623 Checks whether a regular expression (first parameter) matches a string
624 (second parameter) using perl.
625
626 : **salias()**
627 Creates an alias whith sudo prepended, if $EUID is not zero. Run "salias -h"
628 for details. See also xunfunction() below.
629
630 : **selhist()**
631 Greps the history for the string provided as parameter and shows the numbered
632 findings in default pager. On exit of the pager the user is prompted for a
633 number. The shells readline buffer is then filled with the corresponding
634 command line.
635
636 : **show-archive()**
637 Lists the contents of a (compressed) archive with the appropriate programs.
638 The choice is made along the filename extension.
639
640 : **shtar()**
641 Lists the content of a gzipped tar archive in default pager.
642
643 : **shzip()**
644 Shows the content of a zip archive in default pager.
645
646 : **simple-extract()**
647 Tries to uncompress/unpack given file with the appropriate programs. The
648 choice is made along the filename ending.
649
650 : **slow_print()**
651 Prints the arguments slowly by sleeping 0.08 seconds between each character.
652
653 : **smartcompress()**
654 Compresses/archives the file given as first parameter. Takes an optional
655 second argument, which denotes the compression/archive type as typical
656 filename extension; defaults to "tar.gz".
657
658 : **smart-indent()**
659 Indents C source code files given; uses Kernighan & Ritchie style.
660
661 : **sshot()**
662 Creates directory named shots in user's home directory, if it does not yet
663 exist and changes current working directory to it. Then sleeps 5 seconds,
664 so you have plenty of time to switch desktops/windows. Then makes a screenshot
665 of the current desktop. The result is stored in ~/shots to a timestamped
666 jpg file.
667
668 : **ssl-cert-fingerprints**
669 Prints the SHA512, SHA256, SHA1 and MD5 digest of a x509 certificate.
670 First and only parameter must be a file containing a certificate. Use
671 /dev/stdin as file if you want to pipe a certificate to these
672 functions.
673
674 : **ssl-cert-info**
675 Prints all information of a x509 certificate including the SHA512,
676 SHA256, SHA1 and MD5 digests. First and only parameter must be a file
677 containing a certificate. Use /dev/stdin as file if you want to pipe a
678 certificate to this function.
679
680 : **ssl-cert-sha512(), ssl-cert-sha256(), ssl-cert-sha1(), ssl-cert-md5()**
681 Prints the SHA512, SHA256, SHA1 respective MD5 digest of a x509
682 certificate. First and only parameter must be a file containing a
683 certificate. Use /dev/stdin as file if you want to pipe a certificate
684 to this function.
685
686 : **startx()**
687 Initializes an X session using startx(1) if /etc/X11/xorg.conf exists, else
688 issues a Warning to use the grml-x(1) script. Can be overridden by using
689 /usr/bin/startx directly.
690
691 : **status()**
692 Shows some information about current system status.
693
694 : **swspeak()**
695 Sets up software synthesizer by calling swspeak-setup(8). Kernel boot option
696 swspeak must be set for this to work.
697
698 : **trans()**
699 Translates a word from german to english (-D) or vice versa (-E).
700
701 : **udiff()**
702 Makes a unified diff of the command line arguments trying hard to find a
703 smaller set of changes. Descends recursively into subdirectories. Ignores
704 hows some information about current status.
705
706 : **uopen()**
707 Downloads and displays a file using a suitable program for its
708 Content-Type.
709
710 : **uprint()**
711 Works around the "print -l ${(u)foo}"-limitation on zsh older than 4.2.
712
713 : **urlencode()**
714 Takes a string as its first argument and prints it RFC 2396 URL encoded to
715 standard out.
716
717 : **utf2iso()**
718 Changes every occurrence of the string UTF-8 or utf-8 in environment
719 variables to iso885915.
720
721 : **viless()**
722 Vim as pager.
723
724 : **vim()**
725 Wrapper for vim(1). It tries to set the title and hands vim the environment
726 variable VIM_OPTIONS on the command line. So the user may define command
727 line options, she always wants, in her .zshrc.local.
728
729 : **vman()**
730 Use vim(1) as manpage reader.
731
732 : **xcat()**
733 Tries to cat(1) file(s) given as parameter(s). Always returns true.
734 See also xunfunction() below.
735
736 : **xinit()**
737 Initializes an X session using xinit(1) if /etc/X11/xorg.conf exists, else
738 issues a Warning to use the grml-x(1) script. Can be overridden by using
739 /usr/bin/xinit directly.
740
741 : **xsource()**
742 Tries to source the file(s) given as parameter(s). Always returns true.
743 See zshbuiltins(1) for a detailed description of the source command.
744 See also xunfunction() below.
745
746 : **xtrename()**
747 Changes the title of xterm window from within screen(1). Run without
748 arguments for details.
749
750 : **xunfunction()**
751 Removes the functions salias, xcat, xsource, xunfunction and zrcautoload.
752
753 : **zg()**
754 Search for patterns in grml's zshrc using perl. zg takes no or exactly one
755 option plus a non empty pattern. Run zg without any arguments for a listing
756 of available command line switches. For a zshrc not in /etc/zsh, set the
757 GRML_ZSHRC environment variable.
758
759 : **zrcautoload()**
760 Wrapper around the autoload builtin. Loads the definitions of functions
761 from the file given as argument. Searches $fpath for the file. See also
762 xunfunction() above.
763
764 : **zrclocal()**
765 Sources /etc/zsh/zshrc.local and ${HOME}/.zshrc.local. These are the files
766 where own modifications should go. See also zshbuiltins(1) for a description
767 of the source command.
768
769
770 == ALIASES ==
771 //grmlzshrc// comes with a wide array of predefined aliases to ease the user's
772 life. A few aliases (like those involving //grep// or //ls//) use the option
773 //--color=auto// for colourizing output. That option is part of **GNU**
774 implementations of these tools, and will only be used if such an implementation
775 is detected.
776
777 : **acp** (//apt-cache policy//)
778 With no arguments prints out the priorities of each source. If a package name
779 is given, it displays detailed information about the priority selection of the
780 package.
781
782 : **acs** (//apt-cache search//)
783 Searches debian package lists for the regular expression provided as argument.
784 The search includes package names and descriptions. Prints out name and short
785 description of matching packages.
786
787 : **acsh** (//apt-cache show//)
788 Shows the package records for the packages provided as arguments.
789
790 : **adg** (//apt-get dist-upgrade//)
791 Performs an upgrade of all installed packages. Also tries to automatically
792 handle changing dependencies with new versions of packages. As this may change
793 the install status of (or even remove) installed packages, it is potentially
794 dangerous to use dist-upgrade; invoked by sudo, if necessary.
795
796 : **ag** (//apt-get upgrade//)
797 Downloads and installs the newest versions of all packages currently installed
798 on the system. Under no circumstances are currently installed packages removed,
799 or packages not already installed retrieved and installed. New versions of
800 currently installed packages that cannot be upgraded without changing the install
801 status of another package will be left at their current version. An update must
802 be performed first (see au below); run by sudo, if necessary.
803
804 : **agi** (//apt-get install//)
805 Downloads and installs or upgrades the packages given on the command line.
806 If a hyphen is appended to the package name, the identified package will be
807 removed if it is installed. Similarly a plus sign can be used to designate a
808 package to install. This may be useful to override decisions made by apt-get's
809 conflict resolution system.
810 A specific version of a package can be selected for installation by following
811 the package name with an equals and the version of the package to select. This
812 will cause that version to be located and selected for install. Alternatively a
813 specific distribution can be selected by following the package name with a slash
814 and the version of the distribution or the Archive name (stable, testing, unstable).
815 Gets invoked by sudo, if user id is not 0.
816
817 : **ati** (//aptitude install//)
818 Aptitude is a terminal-based package manager with a command line mode similar to
819 apt-get (see agi above); invoked by sudo, if necessary.
820
821 : **au** (//apt-get update//)
822 Resynchronizes the package index files from their sources. The indexes of
823 available packages are fetched from the location(s) specified in
824 /etc/apt/sources.list. An update should always be performed before an
825 upgrade or dist-upgrade; run by sudo, if necessary.
826
827 : **calc** (//peval//)
828 Evaluates a perl expression (see peval() above); useful as a command line
829 calculator.
830
831 : **CH** (//./configure --help//)
832 Lists available compilation options for building program from source.
833
834 : **cmplayer** (//mplayer -vo fbdev//)
835 Video player with framebuffer as video output device, so you can watch
836 videos on a virtual tty. Hint: Using fbdev2 allows you to use the shell
837 while watching a movie.
838
839 : **CO** (//./configure//)
840 Prepares compilation for building program from source.
841
842 : **da** (//du -sch//)
843 Prints the summarized disk usage of the arguments as well as a grand total
844 in human readable format.
845
846 : **default** (//echo -en [ escape sequence ]//)
847 Sets font of xterm to "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-15"
848 using escape sequence.
849
850 : **dir** (//ls -lSrah//)
851 Lists files (including dot files) sorted by size (biggest last) in long and
852 human readable output format.
853
854 : **fblinks** (//links2 -driver fb//)
855 A Web browser on the framebuffer device. So you can browse images and click
856 links on the virtual tty.
857
858 : **fbmplayer** (//mplayer -vo fbdev -fs -zoom//)
859 Fullscreen Video player with the framebuffer as video output device. So you
860 can watch videos on a virtual tty.
861
862 : **g** (//git//)
863 Revision control system by Linus Torvalds.
864
865 : **grep** (//grep --color=auto//)
866 Shows grep output in nice colors, if available.
867
868 : **GREP** (//grep -i --color=auto//)
869 Case insensitive grep with colored output.
870
871 : **grml-rebuildfstab** (//rebuildfstab -v -r -config//)
872 Scans for new devices and updates /etc/fstab according to the findings.
873
874 : **grml-version** (//cat /etc/grml_version//)
875 Prints version of running grml.
876
877 : **http** (//python -m SimpleHTTPServer//)
878 Basic HTTP server implemented in python. Listens on port 8000/tcp and
879 serves current directory. Implements GET and HEAD methods.
880
881 : **insecscp** (//scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"//)
882 scp with possible man-in-the-middle attack enabled. This is convenient, if the targets
883 host key changes frequently, for example on virtualized test- or development-systems.
884 To be used only inside trusted networks, of course.
885
886 : **insecssh** (//ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"//)
887 ssh with possible man-in-the-middle attack enabled
888 (for an explanation see insecscp above).
889
890 : **help-zshglob** (//H-Glob()//)
891 Runs the function H-Glob() to expand or explain wildcards.
892
893 : **hide** (//echo -en [ escape sequence ]//)
894 Tries to hide xterm window using escape sequence.
895
896 : **huge** (//echo -en [ escape sequence ]//)
897 Sets huge font in xterm ("-misc-fixed-medium-r-normal-*-*-210-*-*-c-*-iso8859-15")
898 using escape sequence.
899
900 : **j** (//jobs -l//)
901 Prints status of jobs in the current shell session in long format.
902
903 : **l** (//ls -lF --color=auto//)
904 Lists files in long output format with indicator for filetype appended
905 to filename. If the terminal supports it, with colored output.
906
907 : **la** (//ls -la --color=auto//)
908 Lists files in long colored output format. Including file names
909 starting with ".".
910
911 : **lad** (//ls -d .*(/)//)
912 Lists the dot directories (not their contents) in current directory.
913
914 : **large** (//echo -en [ escape sequence ]//)
915 Sets large font in xterm ("-misc-fixed-medium-r-normal-*-*-150-*-*-c-*-iso8859-15")
916 using escape sequence.
917
918 : **lh** (//ls -hAl --color=auto//)
919 Lists files in long and human readable output format in nice colors,
920 if available. Includes file names starting with "." except "." and
921 "..".
922
923 : **ll** (//ls -l --color=auto//)
924 Lists files in long colored output format.
925
926 : **ls** (//ls -b -CF --color=auto//)
927 Lists directory printing octal escapes for nongraphic characters.
928 Entries are listed by columns and an indicator for file type is appended
929 to each file name. Additionally the output is colored, if the terminal
930 supports it.
931
932 : **lsa** (//ls -a .*(.)//)
933 Lists dot files in current working directory.
934
935 : **lsbig** (//ls -flh *(.OL[1,10])//)
936 Displays the ten biggest files (long and human readable output format).
937
938 : **lsd** (//ls -d *(/)//)
939 Shows directories.
940
941 : **lse** (//ls -d *(/^F)//)
942 Shows empty directories.
943
944 : **lsl** (//ls -l *(@)//)
945 Lists symbolic links in current directory.
946
947 : **lsnew** (//ls -rl *(D.om[1,10])//)
948 Displays the ten newest files (long output format).
949
950 : **lsold** (//ls -rtlh *(D.om[1,10])//)
951 Displays the ten oldest files (long output format).
952
953 : **lss** (//ls -l *(s,S,t)//)
954 Lists files in current directory that have the setuid, setgid or sticky bit
955 set.
956
957 : **lssmall** (//ls -Srl *(.oL[1,10])//)
958 Displays the ten smallest files (long output format).
959
960 : **lsw** (//ls -ld *(R,W,X.^ND/)//)
961 Displays all files which are world readable and/or world writable and/or
962 world executable (long output format).
963
964 : **lsx** (//ls -l *(*)//)
965 Lists only executable files.
966
967 : **md** (//mkdir -p//)
968 Creates directory including parent directories, if necessary
969
970 : **medium** (//echo -en [ escape sequence ]//)
971 Sets medium sized font
972 ("-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-15") in xterm
973 using escape sequence.
974
975 : **screen** (///usr/bin/screen -c ${HOME}/.screenrc//)
976 If invoking user is root, starts screen session with /etc/grml/screenrc
977 as config file. If invoked by a regular user, start a screen session
978 with users .screenrc config if it exists, else use /etc/grml/screenrc_grml
979 as configuration.
980
981 : **rw-** (//chmod 600//)
982 Grants read and write permission of a file to the owner and nobody else.
983
984 : **rwx** (//chmod 700//)
985 Grants read, write and execute permission of a file to the owner and nobody
986 else.
987
988 : **r--** (//chmod 644//)
989 Grants read and write permission of a file to the owner and read-only to
990 anybody else.
991
992 : **r-x** (//chmod 755//)
993 Grants read, write and execute permission of a file to the owner and
994 read-only plus execute permission to anybody else.
995
996 : **semifont** (//echo -en [ escape sequence ]//)
997 Sets font of xterm to
998 "-misc-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-iso8859-15" using
999 escape sequence.
1000
1001 : **small** (//echo -en [ escape sequence ]//)
1002 Sets small xterm font ("6x10") using escape sequence.
1003
1004 : **smartfont** (//echo -en [ escape sequence ]//)
1005 Sets font of xterm to "-artwiz-smoothansi-*-*-*-*-*-*-*-*-*-*-*-*" using
1006 escape sequence.
1007
1008 : **su** (//sudo su//)
1009 If user is running a grml live-CD, dont ask for any password, if she
1010 wants a root shell.
1011
1012 : **tiny** (//echo -en [ escape sequence ]//)
1013 Sets tiny xterm font
1014 ("-misc-fixed-medium-r-normal-*-*-80-*-*-c-*-iso8859-15") using escape
1015 sequence.
1016
1017 : **truec** (//truecrypt [ mount options ]//)
1018 Mount a truecrypt volume with some reasonable mount options
1019 ("rw,sync,dirsync,users,uid=1000,gid=users,umask=077" and "utf8", if
1020 available).
1021
1022 : **up** (//aptitude update ; aptitude safe-upgrade//)
1023 Performs a system update followed by a system upgrade using aptitude; run
1024 by sudo, if necessary. See au and ag above.
1025
1026 : **?** (//qma zshall//)
1027 Runs the grml script qma (quick manual access) to build the collected man
1028 pages for the z-shell. This compressed file is kept at
1029 ~/man/zshall.txt.lzo Once it is built, the second use of the alias '?' is
1030 fast. See "man qma" for further information.
1031
1032
1033 = AUXILIARY FILES =
1034 This is a set of files, that - if they exist - can be used to customize the
1035 behaviour of //grmlzshrc//.
1036
1037 : **.zshrc.pre**
1038 Sourced at the very beginning of //grmlzshrc//. Among other things, it can
1039 be used to permantenly change //grmlzshrc//'s STARTUP VARIABLES (see above):
1040 \
1041 ```
1042 # show battery status in RPROMPT
1043 BATTERY=1
1044 # always load the complete setup, even for root
1045 GRML_ALWAYS_LOAD_ALL=1
1046 ```
1047
1048 : **.zshrc.local**
1049 Sourced right before loading //grmlzshrc// is finished. There is a global
1050 version of this file (/etc/zsh/zshrc.local) which is sourced before the
1051 user-specific one.
1052
1053 : **.zdirs**
1054 Directory listing for persistent dirstack (see above).
1055
1056 : **.important_commands**
1057 List of commands, used by persistent history (see above).
1058
1059
1060 = INSTALLATION ON NON-DEBIAN SYSTEMS =
1061 On Debian systems (http://www.debian.org) - and possibly Ubuntu
1062 (http://www.ubuntu.com) and similar systems - it is very easy to get
1063 //grmlzshrc// via grml's .deb repositories.
1064
1065 On non-debian systems, that is not an option, but all is not lost:
1066 \
1067 ```
1068 % wget -O .zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
1069 ```
1070
1071 If you would also like to get seperate function files (which you can put into
1072 your **$fpath**), you can browse and download them at:
1073
1074 http://git.grml.org/?p=grml-etc-core.git;a=tree;f=usr_share_grml/zsh;hb=HEAD
1075
1076 = ZSH REFCARD TAGS =
1077 If you read //grmlzshrc//'s code you may notice strange looking comments in
1078 it. These are there for a purpose. grml's zsh-refcard is automatically
1079 generated from the contents of the actual configuration file. However, we need
1080 a little extra information on which comments and what lines of code to take
1081 into account (and for what purpose).
1082
1083 Here is what they mean:
1084
1085 List of tags (comment types) used:
1086 : **#a#**
1087 Next line contains an important alias, that should be included in the
1088 grml-zsh-refcard. (placement tag: @@INSERT-aliases@@)
1089
1090 : **#f#**
1091 Next line contains the beginning of an important function. (placement
1092 tag: @@INSERT-functions@@)
1093
1094 : **#v#**
1095 Next line contains an important variable. (placement tag:
1096 @@INSERT-variables@@)
1097
1098 : **#k#**
1099 Next line contains an important keybinding. (placement tag:
1100 @@INSERT-keybindings@@)
1101
1102 : **#d#**
1103 Hashed directories list generation: //start//: denotes the start of a list of
1104 'hash -d' definitions. //end//: denotes its end. (placement tag:
1105 @@INSERT-hasheddirs@@)
1106
1107 : **#A#**
1108 Abbreviation expansion list generation: //start//: denotes the beginning of
1109 abbreviations. //end//: denotes their end.
1110 \
1111 Lines within this section that end in '#d .*' provide extra documentation to
1112 be included in the refcard. (placement tag: @@INSERT-abbrev@@)
1113
1114 : **#m#**
1115 This tag allows you to manually generate refcard entries for code lines that
1116 are hard/impossible to parse.
1117 Example:
1118 \
1119 ```
1120 #m# k ESC-h Call the run-help function
1121 ```
1122 \
1123 That would add a refcard entry in the keybindings table for 'ESC-h' with the
1124 given comment.
1125 \
1126 So the syntax is: #m# <section> <argument> <comment>
1127
1128 : **#o#**
1129 This tag lets you insert entries to the 'other' hash. Generally, this should
1130 not be used. It is there for things that cannot be done easily in another way.
1131 (placement tag: @@INSERT-other-foobar@@)
1132
1133
1134 All of these tags (except for m and o) take two arguments, the first
1135 within the tag, the other after the tag:
1136
1137 #<tag><section># <comment>
1138
1139 Where <section> is really just a number, which are defined by the @secmap
1140 array on top of 'genrefcard.pl'. The reason for numbers instead of names is,
1141 that for the reader, the tag should not differ much from a regular comment.
1142 For zsh, it is a regular comment indeed. The numbers have got the following
1143 meanings:
1144
1145 : **0**
1146 //default//
1147
1148 : **1**
1149 //system//
1150
1151 : **2**
1152 //user//
1153
1154 : **3**
1155 //debian//
1156
1157 : **4**
1158 //search//
1159
1160 : **5**
1161 //shortcuts//
1162
1163 : **6**
1164 //services//
1165
1166
1167 So, the following will add an entry to the 'functions' table in the 'system'
1168 section, with a (hopefully) descriptive comment:
1169 \
1170 ```
1171 #f1# Edit an alias via zle
1172 edalias() {
1173 ```
1174 \
1175 It will then show up in the @@INSERT-aliases-system@@ replacement tag that can
1176 be found in 'grml-zsh-refcard.tex.in'. If the section number is omitted, the
1177 'default' section is assumed. Furthermore, in 'grml-zsh-refcard.tex.in'
1178 @@INSERT-aliases@@ is exactly the same as @@INSERT-aliases-default@@. If you
1179 want a list of **all** aliases, for example, use @@INSERT-aliases-all@@.
1180
1181
1182 = CONTRIBUTING =
1183 If you want to help to improve grml's zsh setup, clone the grml-etc-core
1184 repository from git.grml.org:
1185 \
1186 ``` % git clone git://git.grml.org/grml-etc-core.git
1187
1188 Make your changes, commit them; use '**git format-patch**' to create a series
1189 of patches and send those to the following address via '**git send-email**':
1190 \
1191 ``` grml-etc-core@grml.org
1192
1193 Doing so makes sure the right people get your patches for review and
1194 possibly inclusion.
1195
1196
1197 = STATUS =
1198 This manual page is the **reference** manual for //grmlzshrc//.
1199
1200 That means that in contrast to the existing refcard it should document **every**
1201 aspect of the setup.
1202
1203 This manual is currently not complete. If you want to help improving it, visit
1204 the following pages:
1205
1206 http://wiki.grml.org/doku.php?id=zshrcmanual
1207
1208 http://lists.mur.at/pipermail/grml/2009-August/004609.html
1209
1210 Contributions are highly welcome.
1211
1212
1213 = AUTHORS =
1214 This manpage was written by Frank Terbeck <ft@grml.org>, Joerg Woelke
1215 <joewoe@fsmail.de>, Maurice McCarthy <manselton@googlemail.com> and Axel
1216 Beckert <abe@deuxchevaux.org>.
1217
1218
1219 = COPYRIGHT =
1220 Copyright (c) 2009, grml project <http://grml.org>
1221
1222 This manpage is distributed under the terms of the GPL version 2.
1223
1224 Most parts of grml's zshrc are distributed under the terms of GPL v2, too,
1225 except for **accept-line()** and **vcs_info()**, which are distributed under
1226 the same conditions as zsh itself (which is BSD-like).