refcard


Page 1 Zsh Reference Card Version 4.2
Contents general in part 1, concentrating on bash and zsh in parts 2 and 3. programs, links to external resources, and a glossary.
1 General information, references The contents of the book are as follows; where noted with page
2 Grammar (shell syntax) references to this card they expand on the brief hints here. Zsh manual pages
3 Patterns: globbing and qualifiers To access documentation from within the shell, use the man
4 Options Part 1 (Introducing the Shell) contains the following chapters: command with one of the following arguments:
5 Options cont.; option aliases, single letter options 1 Introduction to Shells zsh Introduction, startup and shutdown
zshmisc Syntax, redirection, functions, jobs, tests
6 Expansion: basic forms, history, prompts 2 Using Shell Features Together
zshexpn Expansion and substitution
7 Expansion: variables: forms and flags 3 More Shell Features
zshparam Parameters (variables)
8 Shell variables: set by shell, used by shell (c.f. page 2)
zshoptions Options to the shell
9 Test operators; numeric expressions
zshbuiltins Shell builtin commands
10 Completion: contexts, completers, tags Part 2 (Using bash and zsh) contains the following chapters:
zshzle The line editor, excluding completion
11 Completion cont.: tags cont, styles 4 Entering and Editing the Command Line
zshcompwid The low-level completion facitilities
12 Completion cont.: styles cont, utility functions (c.f. pages 6 and 13)
zshcompsys The new completion system (more readable)
13 Zsh line editor (zle) 5 Starting the Shell
zshcompctl The old completion system (deprecated)
(c.f. pages 4 and 5)
zshmodules Modules loadable with zmodload
Notes 6 More About Shell History
zshtcpsys Functions for using raw TCP via builtins
The descriptions here are very brief. You will not be able to learn (c.f. pages 6 and 8)
zshzftpsys Functions for using FTP via builtins
shell syntax from them; see the various references below. In 7 Prompts
zshcontrib Contributed functions for zle etc.
particular the completion system is extremely rich and the (c.f. page 6)
zshall Everything in one large manual page
descriptions of its utility functions are the barest memory joggers. 8 Files and Directories
(c.f. page 9)
Mailing lists
The start and end of each section is aligned with page boundaries, 9 Pattern Matching
zsh-users@zsh.org: users mailing list for general questions
so you can print out only the parts you want to refer to. (c.f. page 3)
and tips; to join, mail
10 Completion
zsh-users-subscribe@zsh.org.
References (c.f pages 10 through 12)
Zsh manual: Supplied with the shell: should be installed in Unix 11 Jobs and Processes
zsh-workers@zsh.org: mailing list for bug reports, patches
manual page and info formats. Texinfo generates PS or PDF; (c.f. page 6)
and developers discussions; to join, mail
available as separate doc bundle from same place as the shell.
zsh-workers-subscribe@zsh.org. New developers with
Part3 (Extending the Shell) contains the following chapters:
some Unix/Linux experience are welcome.
http://zsh.sourceforge.net/: Site with much 12 Variables
information about zsh, including HTML manual and a more user- (c.f. pages 7 and 8)
friendly guide to the shell, as well as the FAQ. 13 Scripting and Functions
(c.f. page 2)
Zsh wiki: http://www.zshwiki.org/: Extensible zsh web 14 Writing Editor Commands
pages written by users. (c.f page 13)
15 Writing Completion Functions
From Bash to Z Shell: Conquering the Command Line, by (c.f. pages 10 through 12)
Oliver Kiddle, Jerry Peek and Peter Stephenson, Apress, ISBN 1
59059 376 6. Introduction to interactive use of Unix shells in The three appendices contain short descriptions of standard Unix
Page 2 Zsh Reference Card Version 4.2
}
Grammar
List is any sequence of sublists (including just one) if listi1; then[;] listt1; Non-portable alternative.
[ elif listi2; then listt2; ]
separated by ; or newline. ; and newline are always
&
select name [ in word ź];
interchangeable except in ;;.
[ else listt3; ]
do list;
fi
done
Sublist is any sequence of pipelines (including just one)
If listi1 is true, execute listt1; else if listi2 is true
Print menu of words, read a number, set name to selected word,
connected by && or ||.
execute listt2; else execute listt3.
execute list until end of input. Portable but rare.
Pipeline is any sequence of simple commands connected by |.
for name [ in word ź ]
(list[;])
do list;
Execute list in a subshell (a new process where nothing that
Command is either a simple command (a command word)
done
happens affects the current shell).
followed optionally by word ź or one of the special commands
Execute list with variable name set to each of word ź in turn
below.
If in ź is omitted the positional parameters are used.
{list[;]}
Execute list (no new process: simply separates list from what' s
Word is any text that produces a single word when expanded;
for name in word ź; { list }
around and can take redirections).
word ź is any number of these separated by whitespace.
foreach name ( word ź ) [;]
list;
function nameword {[;] list[;] }
Name is a shell identifier: an alphabetic character or _ followed
end
nameword () {[;] list[;] }
by any sequence of alphanumeric characters or _. Non-portable alternative forms.
Define function named nameword; executes list when run;
running nameword word1 ź makes word1 ź available as $1
while listw; do listd; done
[ ź ] indicates optional; dots on their own line mean any
etc. in function body. list must end with [;] or newline for
While listw is true execute listd.
number of repetitions of the line just above.
portability. nameword can be repeated to define multiple
functions (rare, non-portable).
until listu; do listd; done
Bold text is to be typed literally.
Non-portable: while listu is not true execute listd.
time [ pipeline ]
Status true or false is determined by: for commands, the
Report time for pipeline if given else totals for current shell.
repeat numexp; do list; done
return status; for pipelines the last command; for sublists the last
repeat numexp sublist
pipeline; for lists the last sublist that was executed.
[[ condition ]]
Non-portable: repeat list or sublist numexp times.
Evaluate condition (see below), gives status true or false.
sublist1 && sublist2 [ && sublist3 ź ]
case word in
Execute sublists until one is false.
[(] pattern1[|pattern2...]) [;] list ;;
&
sublist1 || sublist2 [ || sublist2 ź ]
esac
Execute sublists until one is true. Note strings of
Try matching word against every pattern in turn until success.
&& sublists can contain || sublists and vice versa; they are parsed
Execute the corresponding list. ;& instead of && means fall
left to right.
through to next list.
command1 | command2 [ | command3 & ]
case word {
Execute command1, sending its output to the input of
[(] pattern1[|pattern2...]) [;] list ;;
command2, and so on (a pipeline). &
Page 3 Zsh Reference Card Version 4.2
Pattern matching (globbing) KSH_GLOB operators (patterns may contain | for alternatives): S Setgid
@(pat) Group patterns t Sticky bit
Basic patterns:
* Any string *(pat) Zero or more occurrences of pat fspec Has chmod-style permissions spec
? Any character +(pat) One or more occurrences of pat estring Evaluation string returns true status
[class] Any single character from class ?(pat) Zero or one occurrences of pat +cmd Same but cmd must be alphanumeric or _
[^class] Any single character not from class !(pat) Anything but the pattern pat ddev Device number dev (major*256 + minor)
Any number between num1 and num2 l[-+]num Link count is (less than, greater than) num
<-num2> from 0; to infinity. Globbing flags with EXTENDED_GLOB: U Owned by current effective UID
**/ Directories to any level (#i) Match case insensitively G Owned by current effective GID
(pat1) Group patterns (#l) Lower case matches upper case uuid Owned by given uid (may be )
(pat1|pat2) pat1 or pat2 (any number of |' s) (#I) Match case sensitively ggid Owned by given gid (may be )
(#b) Parentheses set match, mbegin, mend a[Mwhms][-+]n Access time in given units (see below)
(#B) Parentheses no longer set arrays m[Mwhms][-+]n Modification time in given units
Character classes may contain any character or the following
(#m) Match in MATCH, MBEGIN, MEND c[Mwhms][-+]n Inode change time in given units
special patterns in any mix; literal ą must be first; literal ^ must
(#M) Don' t use MATCH etc. L[kmp][-+]n Size in given units (see below)
not be first:
(#anum) Match with num approximations ^ Negate following qualifiers
a-b A character in the range a to b
(#s) Match only at start of test string - Toggle following links (first one turns on)
[:alnum:] An alphanumeric character
(#e) Match only at end of test string M Mark directories
[:alpha:] An alphabetic character
T Mark directories, links, special files
(#qexpr) expr is a a set of glob qualifiers (below)
[:ascii:] A character in the ASCII character set
N Whole pattern expands to empty if no match
[:blank:] A space or tab
D Leading dots may be matched
Glob qualifiers (in parentheses after file name pattern):
[:cntrl:] A control character
n Sort numbers numerically
/ Directory
[:digit:] A decimal digit
o[nLlamcd] Order by given code (as below; may repeat)
F Non-empty directory; for empty use (/^F)
[:graph:] A printable character other than whitespace
O[nLlamcd] Order by reverse of given code
. Plain file
[:lower:] A lower case letter
[num] Select numth file in current order
@ Symbolic link
[:print:] A printable character
[num1,num2] Select num1th to num2th file (as arrays)
= Socket
[:punct:] A punctuation character
p Name pipe (FIFO) :X History modifier X; may have more
[:space:] Any whitespace character
* Executable plain file Time units are Month, week, hour, minute, second; default is day.
[:upper:] An upper case letter
% Special file
Size units are kilobytes, megabytes or 512-byte blocks (p); default
[:xdigit:] A hexadecimal digit
%b Block special file
is bytes; upper case means the same as lower case.
%c Character special file
Extended patterns (option EXTENDED_GLOB must be set): Order codes are name (default), size, link count, access time,
r Readable by owner (N.B. not current user)
^pat Anything that doesn' t match pat modification time, inode change time, directory depth.
Writeable by owner
pat1^pat2 Match pat1 then anything other than pat2w
x Executable by owner
pat1~pat2 Anything matching pat1 but not pat2
A Readable by members of file' s group
X# Zero or more occurrences of element X
I Writeable by members of file' s group
X## One or more occurrences of element X
E Executable by members of file' s group
R World readable
W World writeable
X World executable
s Setuid
Page 4 Zsh Reference Card Version 4.2
Options CSH_NULL_GLOB One glob must succeed, failures go INTERACTIVE_ # on interactive line for comment
DVORAK Dvorak keyboard for correction COMMENTS
Set options with setopt, unset with unsetopt. Asterisk
KSH_ARRAYS Indexing etc. for arrays like ksh
EMACS Same as bindkey -e
indicates on by default for native zsh.
KSH_AUTOLOAD Function file includes function name
*EQUALS Expand =cmd to /path/to/cmd
*ALIASES Expand aliases
KSH_GLOB See globbing above
ERR_EXIT Exit shell on non-zero status
ALL_EXPORT Export all variables to environment
KSH_OPTION_PRINT Show all options plus on or off
ERR_RETURN Return from function instead
*ALWAYS_LAST_PROMPT Completion lists after prompt
KSH_TYPESET No word splitting in typeset etc.
*EVAL_LINE_NO $LINENO counts inside eval code
ALWAYS_TO_END On completion go to end of word
*LIST_AMBIGUOUS List completions when ambiguous
*APPEND_HISTORY History appends to existing file *EXEC Execute commands
*LIST_BEEP Beep on ambiguous completion
EXTENDED_GLOB See globbing section above
AUTO_CD Directory as command does cd
LIST_PACKED More compact completion lists
EXTENDED_HISTORY Timestamps saved to history file
AUTO_CONTINUE Jobs are continued when disowned
LIST_ROWS_FIRST List completions across
*FLOW_CONTROL Use ^S/^Q style flow control
*AUTO_LIST List ambiguous completions
*LIST_TYPES File types listed in completion
*FUNCTION_ARGZER0 $0 in function is its name
*AUTO_MENU Menu complete after two tabs
LOCAL_OPTIONS Options reset on function return
AUTO_NAME_DIRS Variables always can be %~ abbrevs *GLOB Use globbing as described above
LOCAL_TRAPS Traps reset on function return
*AUTO_PARAM_KEYS Magic completion for parameters *GLOBAL_EXPORT Exported variables not made local
LOGIN Shell is login shell
*GLOBAL_RCS Execute /etc/z* files
*AUTO_PARAM_SLASH $dirname completes with /
LONG_LIST_JOBS More verbose listing of jobs
GLOB_ASSIGN var=* expands, assigns array
AUTO_PUSHD cd uses directory stack too
MAGIC_EQUAL_SUBST Special expansion after all =
GLOB_COMPLETE Patterns are active in completion
*AUTO_REMOVE_SLASH Trailing / in completion removed
MAIL_WARNING Warn if mail file timestamp changed
GLOB_DOTS Patterns may match leading dots
AUTO_RESUME cmd can resume job %cmd
MARK_DIRS Append / to globbed directories
GLOB_SUBST Substituted characters may glob
*BAD_PATTERN Errors on pattern syntax; else literal
MENU_COMPLETE Cycle through ambiguous matches
*HASH_CMDS Store command location for speed
*BANG_HIST ! style history allowed
MONITOR Shell has job control enabled
*HASH_DIRS Store for all commands in dir
*BARE_GLOB_QUAL Glob qualifiers with bare parens
*MULTIOS Multiple redirections are special
*HASH_LIST_ALL Store all on first completion
BASH_AUTO_LIST List completions on second tab
*NOMATCH Error if glob fails to match
HIST_ALLOW_CLOBBER On clobber error, up arrow to retry
*BEEP Beep on all errors
*NOTIFY Asynchronous job control messages
*HIST_BEEP Beep when going beyond history
*BG_NICE Background jobs at lower priority
NULL_GLOB Failed globs are removed from line
HIST_EXPIRE_DUPS_ Duplicate history entries lost first
BRACE_CCL X{ab} expands to Xa Xb
NUMERIC_GLOB_SORT Numbers in globs sorted numerically
FIRST
BSD_ECHO No echo escapes unles -e given
OCTAL_ZEROES Leading zeros in integers force octal
HIST_FIND_NO_DUPS History search finds once only
*CASE_GLOB Glob case sensitively
OVERSTRIKE Start line editor in overstrike mode
HIST_IGNORE_ALL_ Remove all earlier duplicate lines
C_BASES Output hexadecimal with 0x
PATH_DIRS dir/cmd can be found in $PATH
CDABLE_VARS cd var works if $var is directoryDUPS
HIST_IGNORE_DUPS Remove duplicate of previous line POSIX_BUILTINS Illogical command behaviour
CHASE_DOTS Resolve .. in cd
HIST_IGNORE_SPACE Don' t store lines starting with space PRINT_EIGHT_BIT Print all 8-bit characters directly
CHASE_LINKS Resolve symbolic links in cd
HIST_NO_FUNCTIONS Don' t store shell functions PRINT_EXIT_VALUE Return status printed unless zero
*CHECK_JOBS Check jobs before exiting shell
HIST_NO_STORE Don' t store history and fc PRIVILEGED Special behaviour on setuid/setgid
*CLOBBER Allow redirections to overwrite
Special treatment of ! in prompt
COMPLETE_ALIASES Completion uses unexpanded aliasesHIST_REDUCE_BLANKS Trim multiple insgnificant blanks PROMPT_BANG
HIST_SAVE_NO_DUPS Remove duplicates when saving *PROMPT_CR Prompt always at start of line
COMPLETE_IN_WORD Completion works inside words
HIST_VERIFY Show ! history line for editing *PROMPT_PERCENT % escapes expanded in prompts
CORRECT Correct spelling of commands
*HUP Send SIGHUP to proceses on exit PROMPT_SUBST $ expansion etc. in prompts
CORRECT_ALL Correct spelling of all arguments
IGNORE_BRACES Don' t use {a,b} expansions PUSHD_IGNORE_DUPS Don' t push dir multiply on stack
CSH_JUNKIE_HISTORY Single ! for previous command
IGNORE_EOF Ignore ^D (stty eof char) PUSHD_MINUS Reverse sense of  and + in pushd
CSH_JUNKIE_LOOPS list; end for do...done
INC_APPEND_HISTORY Save history line by line PUSHD_SILENT No non-err messages from pushd
CSH_JUNKIE_QUOTES No newlines in quotes
INTERACTIVE Shell is interactive PUSHD_TO_HOME pushd with no argument goes to ~
CSH_NULLCMD Redirections with no commands fail
Page 5 Zsh Reference Card Version 4.2
RC_EXPAND_PARAM X$array gives Xelt1 Xelt2 etc. Single letter options (used with set as well as setopt): -l LOGIN
-m MONITOR
RC_QUOTES '' inside single quotes gives ' -0 CORRECT
-n NO_EXEC
-1 PRINT_EXIT_VALUE
*RCS Run startup files
-p PRIVILEGED
-2 NO_BAD_PATTERN
REC_EXACT Exact completion matches are good
-r RESTRICTED
-3 NO_NO_MATCH
RESTRICTED Shell has restricted capabilities
-s SHIN_STDIN
-4 GLOB_DOTS
RM_STAR_SILENT Don' t warn on rm *
-t SINGLE_COMMAND
-5 NOTIFY
RM_STAR_WAIT Wait before asking if rm * is OK
-u NO_UNSET
-6 BG_NICE
SHARE_HISTORY Save and restore history per line
-v VERBOSE
-7 IGNORE_EOF
SH_FILE_EXPANSION ~ etc. expansion done early
-w CHASE_LINKS
-8 MARK_DIRS
SH_GLOB Disables non-extended zsh globs
-x XTRACE
-9 AUTO_LIST
SHIN_STDIN Shell input comes from stdin
-y SH_WORD_SPLIT
-B NO_BEEP
SH_NULL_CMD Commandless redirections like sh
Note also -A to set arrays, -b to end option processing, -c to
-C NO_CLOBBER
SH_OPTION_LETTERS Single letter options are like sh
-D PUSHD_TO_HOME pass a single command, -m to set pattern argument, -o to specify
*SHORT_LOOPS for words; list works
-E PUSHD_SILENT
long name (may repeat), -s to sort positional parameters.
SH_WORD_SPLIT Split non-array variables yuckily
-F NO_GLOB
SINGLE_COMMAND Execute one command then exit
-G NULL_GLOB
SINGLE_LINE_ZLE Line editing on single line (bad tty)
-H RM_STAR_SILENT
SUN_KEYBOARD_HACK Unmatched ` at end of line ignored
-I IGNORE_BRACES
TRANSIENT_RPROMPT Right prompt goes away after edit
-J AUTO_CD
TRAPS_ASYNC Traps may run when waiting -K NO_BANG_HIST
TYPESET_SILENT Silent on typeset foo -L SUN_KEYBOARD_HACK
*UNSET Unset variables OK, treat as empty -M SINGLE_LINE_ZLE
VERBOSE Output commands to be executed -N AUTO_PUSHD
-O CORRECT_ALL
VI Same as bindkey -v
-P RC_EXPAND_PARAM
XTRACE Show trace of execution with $PS4
-Q PATH_DIRS
ZLE Line editor used to input lines
-R LONG_LIST_JOBS
-S REC_EXACT
Option aliases (native zsh on right):
-T CDABLE_VARS
BRACE_EXPAND NO_IGNORE_BRACES
-U MAIL_WARNING
DOT_GLOB GLOB_DOTS
-V NO_PROMPT_CR
HASH_ALL HASH_CMDS
-W AUTO_RESUME
HIST_APPEND APPEND_HISTORY
-X LIST_TYPES
HIST_EXPAND BANG_HIST
-Y MENU_COMPLETE
LOG NO_HIST_NO_FUNCTIONS
-Z ZLE
MAIL_WARN MAIL_WARNING
-a ALL_EXPORT
ONE_CMD SINGLE_COMMAND
-e ERR_EXIT
PHYSICAL CHASE_LINKS
-f NO_RCS
PROMPT_VARS PROMPT_SUBST
-g HIST_IGNORE_SPACE
STDIN SHIN_STDIN
-h HIST_IGNORE_DUPS
TRACK_ALL HASH_CMDS
-i INTERACTIVE
-k INTERACTIVE_COMMENTS
Page 6 Zsh Reference Card Version 4.2
Expansion Modifiers on arguments (can omit word selector): %M Full host name
Basic forms of expansion in the order they order: !!:1:h Trailing path component removed %m Host name to first dot or n dots
!expr History expansion !!:1:t Only trailing path component left %N Name of script, function, sourced file
alias Alias expansion !!:1:r File extension .ext removed %n Name of user (same as $USERNAME)
<(cmds) Replaced by file with output from cmds !!:1:e Only extension ext left %S %s Start (stop) standout mode
!!:1:p Print result but don' t execute %T Time of day, 24-hour format
=(cmds) Same but can be reread (use for diff)
!!:1:q Quote from further substitution %U %u Start (stop) underline mode (patchy support)
>(cmds) Replaced by file with input to cmds
!!:1:Q Strip one level of quotes %v nth component of $psvar array
$var Variable substitution
!!:1:x Quote and also break at whitespace %W Date as middle-endian MM/DD/YY
${var} Same but protected, allows more options
!!:1:l Convert to all lower case
%w Date as DAY DD
$(cmds) Replaced by output of cmds
!!:1:u Convert to all upper case
`cmds` Older form of same, harder to nest %y Login terminal without /dev
!!:1:s/s1/s2/ Replace string s1 by s2
$((expr)) Arithmetic result of evaluating expr %_ Parser state (continuation lines, debug)
Same but global
!!:1:gs/s2/s2/
%~ Like %/, %d but with tilde substitution
X{a,b}Y XaY Xby (N.B. does no pattern matching)
!!:1:& Use same s1 and s2 on new target
%{esc%} Escape sequence esc doesn' t move cursor
X{1..3}Y X1Y X2y X3y
X{08..10}Y X08Y X09y X10y %X(.tstr.fstr)tstr if test X gives n, else fstr
~user, ~dir User home, named dir (dir is var name) Most modifiers work on variables (e.g ${var:h}) or in glob
%=cmd /full/path/to/cmd qualifiers (e.g. *(:h)), the following only work there:
%>str> Truncate to n on right, str on right if so
pattern Glob file names, as above ${var:fm} Repeat modifier m till stops changing
${var:F:N:m} Same but no more than N times
Test characters in %X(.tstr.fstr): ! Privileged; # uid n; ?
${var:wm} Apply modifer m to words of string
History expansion:
last status n; _ at least n nested constructs; / at least n $PWD
!! Immediately preceding line (all of it) ${var:W:sep:m}Same but words are separated by sep
elements; ~ same with ~ subst; D month is n; d day of month is n;
!{!} Same but protected, may have args in {}
! Line just referred to, default !! Prompt expansion (with PROMPT_PERCENT, on by default); may g effective gid is n; j at least n jobs; L $SHLVL at least n; l at
least n chars on line so far; S $SECONDS at least n; T hours is n;
!13 Line numbered 13 (history shows nos.) take a decimal number n (default 0) immediately after the %:
t minutes is n; v at least n components in $psvar; w day of
!-2 Command two before current %! %h Current history event number
week is n (Sunday = 0).
%# # if superuser, else %
!cmd Last command beginning cmd
%% A single %
!?str Last command containing str
!# Current command line so far %) A ) (use with %X(.tstr.fstr))
%* Time in 24-hour format with seconds
%/ %d $PWD; n gives trailing parts, -n leading
Word selectors:
!!:0 Extract argument 0 (command word) %c %. %C Deprecated alternatives, differ by default n
!!:1 Argument numbered 1 (first cmd arg) %? Return status of last command
!!:^ Also argument 1 %@ %t Time of day in am/pm format
!!:$ Last command argument %B (%b) Start (stop) bold face mode
!:% Word found by !?str (needs correct line) %D %D{str} Date as YY-MM-DD, optional strftime spec
!!:2-4 Word 2 to 4 inclusive %E Clear to end of line
!!:-4 Words 0 to 4 inclusive %i Script/function line number ($LINENO)
!!:* Words 1 to $ inclusive %j Number of jobs as listed by jobs
!!:2* Words 2 to $ inclusive %L Shell depth ($SHLVL)
!!:2- Words 2 to $-1 inclusive
%l Login terminal without /dev or
/dev/tty
Page 7 Zsh Reference Card Version 4.2
Parameter (Variable) Expansion q Quote result with backslashes Order of rules:
Basic forms: str will also be expanded; most forms work on qq Quote result with single quotes 1. Nested substitution: from inside out
words of array separately: qqq Quote result with double quotes 2. Subscripts: ${arr[3]} extract word; ${str[2]}
qqqq Quote result with $'...'
${var} Substitute contents of var, no splitting extract character; ${arr[2,4]}, ${str[4,8]}
Q Strip quotes from result
${+var} 1 if var is set, else 0 extract range; -1 is last word/char, -2 previous etc.
t Output type of variable (see below)
${var:-str} $var if non-null, else str 3. ${(P)var} replaces name with value
u Unique: remove duplicates after first
${var-str} $var if set (even if null) else str 4. $array joins array, may use (j:str:)
Upper case result
${var:=str} $var if non-null, else str and set var to itU 5. Nested subscript e.g. ${${var[2,4]}[1]}
v Include value in result; may have (kv)
${var::=str} Same but always use str 6. #, %, / etc. modifications
V Visible representation of special chars
${var:?str} $var if non-null else error, abort 7. Join if not joined and (j:str:), (F)
w Count words with ${#var}
${var:+str} str if $var is non-null 8. Split if (s), (z), (z), =
W Same but empty words count
${var#pat} min match of pat removed from head 9. Split if SH_WORD_SPLIT
X Report parsing errors (normally ignored)
${var##pat} max match of pat removed from head 10. Apply (u)
z Split to words using shell grammar
${var%pat} min match of pat removed from tail 11. Apply (o), (O)
p Following forms recognize print \-escapes
${var%%pat} max match of pat removed from tail 12. Apply (e)
j:str: Join words with str between
${var:#pat} $var unless pat matches, then empty 13. Apply (l.str.), (r.str.)
l:x: Pad with spaces on left to width x
${var/p/r} One occurrence of p replaced by r 14. If single word needed for context, join with $IFS[1].
l:x::s1: Same but pad with repeated s1
${var//p/r} All occurrences of p replaced by r
l:x::s1::s2: Same but s2 used once before any s1s
${#var} Length of var in words (array) or bytes Types shown with (t) have basic type scalar, array,
r:x::s1::s2: Pad on right, otherwise same as l forms
${^var} Expand elements like brace expansion integer, float, assocation, then hyphen-separated words
s:str: Split to array on occurrences of str
${=var} Split words of result like lesser shells from following list:
S With patterns, search substrings
${~var} Allow globbing, file expansion on result local Parameter is local to function
I:exp: With patterns, match expth occurrence
${${var%p}#q} Apply %p then #q to $var left Left justified with typeset -L
B With patterns, include match beginning
right_blanks Right justified with typeset -R
E With patterns, include match end
Parameter flags in parentheses, immediately after left brace: right_zeros Right justified with typeset -Z
M With patterns, include matched portion
% Expand %s in result as in prompts lower Lower case forced with typeset -l
N With patterns, include length of match
@ Array expand even in double quotes
upper Upper case forced with typeset -u
R With patterns, include unmatched part (rest)
A Create array parameter with ${...=...}
readonly Read-only, typeset -r or readonly
Delimeters shown as :str: may be any pair of chars or matched tag
a Array index order, so Oa is reversed
Tagged as typeset -t (no special effect)
parenthses (str), {str}, [str], .
c Count characters for ${#var}
export Exported with export, typeset -x
C Capitalize result
unique Elements unique with typeset -U
e Do parameter, comand, arith expansion
hide Variable not special in func (typeset -h)
f Split result to array on newlines
hideval typeset hides value (typeset -H)
F Join arrays with newlines between elements
special Variable special to shell
i oi or Oi sort case independently
k For associative array, result is keys
L Lower case result
n on or On sort numerically
o Sort into ascending order
O Sort into descending order
P Interpret result as parameter name, get value
Page 8 Zsh Reference Card Version 4.2
Printed at start of first line of output; see
Parameters (Variables) =USERNAME Name for $UID, set if root =PS1, PROMPT,
VENDOR Operating system vendor (compile time) prompt above for escape sequences for all PSs
Parameters set by shell, = denotes special to shell (may not be
ZSH_NAME Base name of command used to start shell =PS2, PROMPT2 Printed for continuation lines
reused except by hiding with typeset -h in functions)
ZSH_VERSION Version number of shell =PS3, PROMPT3 Print within select loop
=! Process ID of last background process
=PS4, PROMPT4 For tracing execution (xtrace option)
=# Number of arguments to script or function
=ARGC Same Parameters used by the shell if set: : indicates arrays with =psvar : Used with %nv in prompts
=$ Process ID of main shell process corresponding colon-separated paths e.g. cdpath and CDPATH: =READNULLCMD Command used when only input redir given
=- String of single letter options set ARGV0 Export to set name of external command REPORTTIME Show report if command takes this long (s)
=* Positional parameters BAUD Baud rate: compensation for slow terminals REPLY Used to return a value e.g. by read
=argv Same =cdpath : Directories searched for cd target reply Used to return array value
=@ Same, but does splitting in double quotes =COLUMNS Width of screen =RPS1, RPROMPTPrinted on right of screen for first line
=? Status of last command DIRSTACKSIZE Maximum size of stack for pushd =RPS2, Printed on right of screeen for continuation
=0 Name of shell, usually reflects functions RPROMPT2 line
ENV File to source when started as sh or ksh
=_ Last argument of previous command SAVEHIST Max number of history lines saved
FCEDIT Default editor used by fc
CPUTYPE Machine type (run time) =SPROMPT Prompt when correcting spelling
=fignore : List of suffixes ignored in file completion
=EGID Effective GID (via system call), set if root STTY Export with stty arguments to command
=fpath : Directories to search for autoloading
=EUID Effective UID (via system call), set if root =TERM Type of terminal in use (xterm etc.)
=histchars History, quick replace, comment chars
=ERRNO Last system error number TIMEFMT Format for reporting usage with time
=HISTCHARS Same, deprecated
=GID Real group ID (via system call), set if root
HISTFILE File for reading and writing shell history TMOUT Send SIGALRM after seconds of inactivity
HISTCMD The current history line number
=HISTSIZE Number of history lines kept internally TMPPREFIX Path prefix for shell' s temporary files
HOST The host name
=HOME Home directory for ~ and default cd target =watch : List of users or all, notme to watch for
=LINENO Line number in shell, function
=IFS Characters that separate fields in words WATCHFMT Format of reports for $watch
LOGNAME Login name (exported by default)
KEYTIMEOUT Time to wait for rest of key seq (1/100 s) =WORDCHARS Chars considered parts of word by zle
MACHTYPE Machine type (compile time)
=LANG Locale (usual variable, LC_* override) ZBEEP String to replace beeps in line editor
OLDPWD Previous directory
=LC_ALL Locale (overrides LANG, LC_*) ZDOTDIR Used for startup files instead of ~ if set
=OPTARG Argument for option handled by getopts
=LC_COLLATE Locale for sorting etc.
=OPTIND Index of positional parameter in getopts
=LC_CTYPE Locale for character handling
OSTYPE Operating system type (compile time)
=LC_MESSAGES Locale for messages
=pipestatus Array giving statuses of last pipeline
=LC_NUMERIC Locale for decimal point, thousands
=PPID Process ID of parent of main shell
=LC_TIME Locale for date and time
PWD Current directory
=LINES Height of screen
=RANDOM A pseudo-random number, repeating
LISTMAX Number of completions shown w/o asking
=SECONDS Seconds since shell started
LOGCHECK Interval for checking $watch
=SHLVL Depth of current shell
MAIL Mail file to check ($mailpath overrides)
signals Array giving names of signals
MAILCHECK Mail check interval, secs (before prompt)
=status Status of last command
=mailpath : List of files to check for new mail
=TRY_BLOCK_ In always block, 1 if error in try block
=manpath : Directories to find manual, used by man
ERROR
=module_path :Directories for zmodload to find modules
TTY Terminal associated with shell if any
=NULLCMD Command used if only redirection given
=TTYIDLE Time for which terminal has been idle
=path : Command search path
=UID Real user ID (via system call), set if root
=POSTEDIT Termcap strings sent to terminal after edit
Page 9 Zsh Reference Card Version 4.2
Tests and numeric expressions != True if string a does not match pattern b
" : (true/false separator for ternary operator)
< True if string a sorts before string b
Usually used after if, while, until or with && or ||, but the status " =, +=, -=, *=, /=, %=, **=, &=, ^=, |=, <<=, >>=,
> True if string a sorts after string b
may be useful anywhere e.g. as implicit return status for function. &&=, ^^=, ||=
-eq True if numerical expressions a and b are equal
" , (as in C, evaluate both sides and return right hand
-ne True if numerical expressions a and b are not equal
File tests, e.g. [[ -e file ]]: side).
-lt True if a < b numerically
-a True if file exists
-gt True if a > b numerically
-b True if file is block special
For functions use zmodload -i zsh/mathfunc; functions
-le True if a d" b numerically
-c True if file is character special
available are as described in C math library manual:
-ge True if a e" b numerically
-d True if file is directory
" Single floating point argument, return floating point:
-e True if file exists
acos, acosh, asin, asinh, atan (optional second
Combining expressions: expr is any of the above, or the result of
-f True if file is a regular file (not special or directory
argument like C atan2), atanh, cbrt, ceil, cos,
-g True if file has setgid bit set (mode includes 02000) any combination of the following:
cosh, erf, erfc, exp, expm1, fabs, floor,
-h True if file is symbolic link ( expr ) Group tests
gamma, j0, j1, lgamma, log, log10, log1p,
! expr True if expr is false and vice versa
-k True if file has sticky bit set (mode includes 02000)
logb, sin, sinh, sqrt, tan, tanh, y0, y1
True if both expressions true
exprA && exprB
-p True if file is named pipe (FIFO)
" Single floating point argument, return integer: ilogb
exprA || exprBTrue if either expression true
-r True if file is readable by current process
" No arguments, return integer: signgam (remember
-s True if file has non-zero size
parentheses)
-u True if file has setuid bit set (mode includes 04000) For complicated numeric tests use (( expr )) where expr is
" Two floating point arguments, return floating point:
-w True if file is writeable by current process a numeric expression: status is 1 if expr is non-zero else 0. Same
copysign, fmod, hypot, nextafter
-x True if file executable by current process syntax used in $(( expr )) substitution. Precedences of
" One integer, one floating point argument, return floating
-L True if file is symbolic link
operators from highest to lowest are:
point: jn, yn
-O True if file owned by effective UID of current
" func(arg...), numeric constant (e.g. 3, -4, 3.24,
" One floating point, one integer argument, return floating
process
-14.6e-10), var (does not require $ in front unless
point: ldexp, scalb
-G True if file has effective GID of current process
some substitution e.g. ${#var} is needed, $ is error if
" Either integer or floating point, return same type: abs
-S True if file is a socket (special communication file)
var is to be modified)
" Coerce to floating point: float
-N True if file has access time no newer than mod time
" ( expr )
" Coerce to integer: int
" !, ~, ++ (post- or preincrement), -- (post- or
" Optional string argument (read/write variable name),
Other single argument tests, e.g. [[ -n str ]]:
predecrement), unary +, unary -
return floating point: rand48
-n True if str has non-zero length
" &
Example use:
-o True if option str is set
" ^
zmodload -i zsh/mathfunc
-t True if str (number) is open file descriptor
" |
float x
-z True if str has zero length
" ** (exponentiation)
(( x = 26.4 * sqrt(2) ))
" *, /, %
print $(( log(x)/2 ))
Multiple argument tests e.g. [[ a -eq b ]]: numerical
" binary +, binary -
expressions may be quoted formulae e.g.  1*2 :
" <<, >>
-nt True if file a is newer than file b
" <, <=, >, >=
-ot True if file a is older than file b
" ==, !=
-ef True if a and b refer to same file (i.e. are linked)
" &&
= True if string a matches pattern b
" ||, ^^
== Same but more modern (and still not often used)
" ? (ternary operator)
Page 10 Zsh Reference Card Version 4.2
Completion -brace- Parameter within ${& } files Generic file matching tag
parameter- fonts X font names
Load new completion system with:
-assign- Left hand side of assignment
fstypes Files system types for mount etc.
autoload -Uz compinit
parameter-
functions Shell functions, possibly other types
compinit
-command- Word in command position
globbed-files Names of files matched by pattern
-condition- Word in [[ ... ]] condition
groups UNIX groups
Configuration: uses styles
-default- Word with no specific completion
history-words Words from shell history
zstyle context style value&
-equal- Word beginning with equals sign
hosts Names of network hosts
where context may be a pattern matching the following form:
-first- Tried first, may set _compskip
indexes Indexes of arrays
:completion:func:completer:cmd:arg:tag
-math- Inside arithmetic such as (( ... ))
jobs Shell jobs
in which:
-parameter- Parameter with bare $ in front
interfaces Network interfaces (as from ifconfig)
completion
-redirect- Word after redirection operator
keymaps ZLE keymaps
Literal string always used by completion functions
-subscript- Inside parameter subscript
keysyms Names of X keysyms
func
-tilde- Between ~ and first / of argument Names of system libraries
libraries
Name of directly called widget, blank for contextual completion
-value- Right hand side of assignment System resource limits
limits
completer
local-directoriesSubdirectories of current directories
Method of completion e.g. complete; see below
manuals Names of manual pages
Tags:
cmd
accounts For users-hosts style mailboxes E-mail folders
Name of command being completed, or special command context
all-expansions When expanding, everything at once maps NIS maps etc.
arg
all-files All files rather than a subset messages Used in format style for messages
Only valid with standard parsing: arg-n for nth argument
arguments Command arguments modifiers X modifiers
option-opt-n for nth argument of option opt
arrays Names of array parameters modules Shell modules etc.
tag
association-keys Keys of associative arrays my-accounts Own accounts, with users-hosts style
Indication of type of thing to be completed at this point.
bookmarks Bookmarks for URLs, ZFTP, etc. named-directoriesDirectories named by a parameter
builtins Names of builtin commands names Names of all sorts
Completers (= indicates modifiers existing or later completions):
characters Character classes, stty characters newsgroups USENET newgroups
=_all_matches Later completers add all matches
colormapids X colormap IDs nicknames Nicknames of NIS maps
_approximate Complete with errors in part so far
colors Names of colors, usually X options Options to commands
_complete Basic completion
commands External commands, subcommands original Original when correcting, expanding
_correct Correct word already typed
contexts Contexts in zstyle other-accounts Other accounts with users-hosts style
_expand Perform shell expansions
Tags continued:
corrections Possible approximations, corrections
_expand_alias Expand aliases only
cursors X cursor names packages RPM, Debian etc. packages
_history Complete words from shell history
default Nothing specific in certain contexts parameters Names of shell parameters
=_ignored Reinstate matches omitted
descriptions Used in format style for matches path-directories Directories under $cdpath
=_list List on first completion, insert on second
devices Device special files paths Used with assorted directory paths
_match Complete using patterns from line
directories Directories pods Perl documentation
=_menu Menu completion, no menu selection
directory-stack Entries in pushd directory stack ports TCP, UDP prots
=_oldlist Use existing list before generating new one
displays X displays prefixes URL etc. prefixes
_prefix Complete ignoring what' s after cursor
domains Network domain (DNS) names printers Names of print queues
PIDs
Command contexts: any command name plus the special contexts:expansions Individual expansions instead of all processes
file-descriptors Numbers of open file descriptors processes-names Names of processes in killall
-array-value- Element in array
Page 11 Zsh Reference Card Version 4.2
sequences MH sequences etc. fake-files dir:names add names in dir muttrc Alternative for ~/.muttrc
sessions ZFTP sessions etc. fake-parameters Params to complete even if not yet set numbers Prefer job numbers instead of name
signals System signal names, HUP etc. file-patterns pattern:tag generates files with tagold-list Retain list of matches (_oldlist)
strings Assorted strings, e.g. second arg of cd size, links, time, access, inode, reverse old-matches Use old match list (_all_matches)
file-sort
styles Styles in zstyle In LDAP, attributes for filtering old-menu Keep list for meus (_oldlist)
filter
suffixes Filename extensions
force-list Just list matches: always or number original Add original match for approx/correct
tags Tags used with rpm etc.
format Desc string, %d shows specific desc packageset For arguments of Debian dpkg
targets Targets inside Makefiles
=glob Attempt glob expansion (_expand) path For X colors, path to rgb.txt
time-zones Time zones with TZ parameter etc.
=global Global aliases (_expand_alias) pine-directory Directory for PINE mailboxes
types Assorted types of anything
group-name Name groups shown together by tag ports TCP/IP services (/etc/services)
urls Used with web addresses
group-order Order groups shown together by tag prefix-hidden Hide common prefix e.g. in options
users Names of users
groups Unix groups, as per /etc/group prefix-needed Common prefix must by typed by user
values Values in lists
hidden Complete but don' t list matches preserve-prefix Initial file patterns to leave alone
variant Used when picking variant of command
hosts List of host names, as /etc/hosts range Range of words in history to consider
visuals X visuals
hosts-ports List of hosts:ports for TCP/UDP =regular Complete regular aliases
warnings Used in the format style for warnings
ignore-line Don' t complete words already present Styles continued:
widgets Names of zsh widgets
ignore-parents parent or pwd: ignore parent dirs =remote-access Control remote access for e.g. _cvs
windows IDs of X windows
ignored-patterns If pattern matched, don' t complete remove-all-dups Never complete duplicates in history
zsh-options Shell options
insert All matches at once (_all_matches) select-prompt Prompt shown in menu selection
insert-ids Convert %cmd to unambiguous PID select-scroll Lines to scroll in menu selection
Styles (= indicates on by default):
Manual sections used as part of tag
insert-tab Insert TAB if no non-whitespace yet separate-sections
accept-exact Accept exact match even if ambiguous
insert- Only menu complete when no prefix to show-completer Show progress of completers as msg
=add-space Add a space after expansions
unambiguous insert single-ignored Control _ignore when single match
ambiguous Cursor after ambiguous path componentkeep-prefix Try to keep expandable prefix sort
Override sorting of matches
assign-list PATH-style list on assignment
last-prompt Return to last editing line if possible special-dirs Add . and .. to file list
auto-description String for option descs without specific
list Control listing when history completing squeeze-slashes fo//ba is fo/ba not fo/*/ba
avoid-completer Avoid completer with _all_matcheslist-colors Color specs like LS_COLORS stop
Pause before looping shell history
cache-path Path to top of various caches
=list-grouped Grouped listing shown more compactly strip-comments Remove display name from email addr
cache-policy Function to decide on cache rebuilding
list-packed All matches shown more compactly subst-globs-only Only take expansions from globbing
call-command If true, use external (slow) command
list-prompt Prompt when scrolling completions =substitute When expanding, first try subst
command External command to call (+args)
list-rows-first Increment rows first in lists =suffix Only expand path with no /suffix
command-path Override PATH for commands to match
list-suffixes Show ambiguous bits of multiple paths tag-order Preference order for tags in context
commands Default sys init commands (start etc.)
list-separator Separates description in verbose list urls Determine where URLs are taken from
complete Complete aliases (_expand_alias)
local host:path:dir for URLs as files use-cache Control caching for various commands
completer The list of completers to try (see above)
mail-directory Directory for mailbox files (~/Mail) use-compctl Use comptl-style completions
=condition Delay insertion of matches (_list)
match-original Add * when matching (_match) use-perl Use simpler Perl code for _make
disabled Disabled aliases (_expand_alias)
matcher Apply match control syntax per tag users List of user names
disable-stat If set, _cvs uses ls instead of zsh/stat
matcher-list Apply match control syntax globally users-hosts List of user@host possibilities
domains Net domains (/etc/resolv.conf)
max-errors Max errors allowed in approx/correct users-hosts-portsList of user@host:port
expand For prefix, suffix in multiple partsmax-matches-widthCols to reserve for matches (not desc) =verbose
Verbose output e.g. option descriptions
fake Add value:desc fake completions
menu Use menu completion Line changes based on current word
word
Page 12 Zsh Reference Card Version 4.2
_requested tag
Using _arguments for parsing standard command arguments: Implement loops over different tags
Examples of other utility functions:
Three arguments give argument/option selector, message to
_alternative \
output, action to take. Examples:
_all_labels tag expl descr compcommand
 users:user:_users \
1:msg:_comp First arg; show msg, exec _comp _next_label tag expl descr
 hosts:host:_hosts
1::msg:_comp Same for optional argument Implement loops over different labels for each _requested tag
Either users or hosts (tag, description, action)
:msg:_comp Arg number inferred from position
_describe setdesc arr1 --
*:msg:_comp Any of the remaining args ( rest args)
Associate descriptions with completions; arr1 contains
*::msg:_comp words etc. set to normal args
completion:description entries
*:::msg:_comp & set to args for this chunk
-foo Complete option -foo
_message text-msg
+foo Complete option +foo
Don' t complete, just output text-msg
-+foo Complete -foo or +foo
*-foo Option may occur multiple times
_multi_parts sep array
-foo-:esg:_comp Option has arg in same word
Complete by parts with separator sep, $array contains full
-foo+:msg:_comp Option has arg in same or next word
matches.
-foo=:msg:_comp Option arg -foo=bar or -foo bar
-foo=-:msg:_comp Option arg is -foo=bar only
_path_files
-foo[desc] Option has description desc
Complete files including partial paths; _files is smart front end;
*:*pat:msg:_comp Complete words up to pat
options -f all files (default), -g pat matching pat (with
*:*pat::msg:_compModify words etc. for args
_files maybe directories too), -/ directories only, -W dirs
(-goo -boo)-foo -foo excludes -goo, -boo
paths in which files are found, -F files files to ignore,
(*)-foo -foo excludes rest args as matches
overrides ignored-patterns
(:)-foo -foo excludes normal args
(-)-foo -foo excludes all options
_sep_parts arr1 sep1 arr2 sep2 & &
!-foo -foo should not be completed
Elements from arr1, then separator, then elements from arr2,
*:msg: Show message but don' t complete
etc.
*:msg:(a b) Matches are listed items
*:msg:((a\:dsc)) Matches with descriptions
_values -s sep desc spec1 spec2 &
*:msg:->string Array state has string if matched
Complete multiple values separated by sep; values are given by
*:msg:{code} Shell code generates matches
specs, each of which is similar to _arguments option spec
*:msg:= action Insert dummy argument first
without leading -
*:msg:_comp arg Call _comp with additional args
*:msg: _comp arg Call _comp with only given arg
_wanted thing expl  my things \
-a  set1 -c - & Common and specific completion sets
compadd mything1 mything2 &
- "(set1)" -c - & Mutually exclusive sets
Typical way of adding completions mything1 etc. with tag
-s Allow combined single letters
things and description my things; expl should be local
-sw Same, even if option has args
variable. Use single tag, c.f. _tags and _requested
-- Guess options by using --help
-- -i pat Same, ignoring options matching pat
_tags tag1 tag2
Page 13 Zsh Reference Card Version 4.2
Zsh line editor (zle) execute-last-named-cmd Ź z redisplay ^R ^R
execute-name-cmd Ź x redo
Builtin widgets, emacs binding, vicmd binding, viins binding;
expand-cmd-path reset-prompt
Ź denotes escape key:
expand-history Ź ! reverse-menu-complete
accept-and-hold Ź a
expand-or-complete ^I ^I run-help Ź h
accept-and-infer-next-history
expand-or-complete-prefix self-insert ... ...
accept-and-menu-complete
expand-word ^X* self-insert-unmeta Ź ^M
accept-line ^M ^M ^M
forward-char ^F send-break ^G
accept-line-and-down-history ^O
forward-word Ź f set-mark-command ^@
argument-base
get-line Ź g spell-word Ź s
backward-char ^B
gosmacs-transpose-chars set-local-history
backward-delete-char ^H
history-beginning-search- transpose-chars ^T
backward-delete-word
backward transpose-words Ź t
backward-kill-line
history-beginning-search- undefined-key
backward-kill-word ^W
forward undo ^_
backward-word Ź b
history-incremental-search- ^R universal-argument
beep
backward ^Xr up-case-word Ź u
beginning-of-buffer-or-history Ź <
history-incremental-search- ^S up-history ^p
beginning-of-history
forward ^Xs up-line-or-history ^p k up
beginning-of-line ^A
history-search-backward Ź p up-line-or-search
beginning-of-line-hist
history-search-forward Ź n vi-add-eol A
capitalize-word Ź c
infer-next-history ^x^n vi-add-next a
clear-screen ^L ^L ^L
insert-last-word Ź _ vi-backward-blank-word B
complete-word
kill-buffer ^X^K vi-backward-char h ^Hleft
copy-prev-word Ź ^_
kill-line ^K vi-backward-delete-char X ^H
copy-prev-shell-word
kill-region vi-backward-kill-word ^W
copy-region-as-kill Ź w
kill-whole-line ^U vi-backward-word b
delete-char
kill-word Ź d vi-beginning-of-line
delete-char-or-list ^D
list-choices Ź ^d ^d ^d vi-caps-lock-panic
delete-word
list-expand ^Xg ^G ^G vi-change c
describe-key-briefly
magic-space vi-change-eol C
digit-argument Ź 0..1..9
menu-complete vi-change-whole-line S
down-case-word Ź l
menu-expand-or-complete vi-cmd-mode ^XV Ź
down-history ^n
neg-argument Ź - vi-delete d
down-line-or-history ^n j down
overwrite-mode ^X^O vi-delete-char x
down-line-or-search
pound-insert # vi-digit-or-beginning-of-line 0
emacs-backward-word
push-input vi-down-line-or-history +
emacs-forward-word
push-line Ź q Builtin widgets cont.:
end-of-buffer-or-history Ź >
push-line-or-edit
vi-end-of-line $
end-of-history
quoted-insert ^V
vi-fetch-history G
end-of-line ^E
quote-line Ź '
vi-find-next-char ^X^Ff
end-of-line-hist
quote-region Ź 
vi-find-next-char-skip t
end-of-list
recursive-edit
vi-find-prev-char F
exchange-point-and-mark ^X^X
Page 14 Zsh Reference Card Version 4.2
vi-find-prev-char-skip T what-cursor-position ^X= \Mx, \M-x Set 8th bit in character
vi-first-non-blank ^ where-is
\Cx, \C-x Control character e.g. \C-a
vi-forward-blank-word W which-command Ź ?
^x Control character e.g. ^a (same as ^A)
vi-forward-blank-word-end E yank ^y
^? Delete
vi-forward-char l rght yank-pop Ź y
\\ Single backslash
vi-forward-word w
vi-forward-word-end e
Special parameters inside user-defined widgets; = indicates
Keymaps:
vi-goto-column Ź | |
readonly:
Like Emacs editor
emacs
vi-goto-mark `
Entire editing buffer
BUFFER
viins Like Vi editor in insert mode
vi-goto-mark-line Ł
BUFFERLINES Number of screen lines for full buffer
vicmd Like Vi editor in command mode
vi-history-search-backward /
=CONTEXT start, cont, select, vared
.safe Emergency keymap, not modifiable
vi-history-search-forward ?
CURSOR Index of cursor position into $BUFFER
vi-indent >
CUTBUFFER Last item to be killed
Examples of key binding:
vi-insert i
HISTNO Currently history line being retrieved
bindkey '^xt' gosmacs-transpose-chars
vi-insert-bol I
=KEYMAP Currently selected keymap
bindkey '\e[2~' overwrite-mode
vi-join ^X^JJ
=KEYS Keys typed to invoke current widget
bindkey -M viins '^u' backward-kill-line
vi-kill-eol D
killring Array of previously killed items, can resize
bindkey -s '^x^z' '\eqsuspend\n'
vi-kill-line ^U
=LASTSEARCH Last search string in interactive search
vi-match-bracket ^X^B%
=LASTWIDGET Last widget to be executed autoload -Uz replace-string
vi-open-line-above O
LBUFFER Part of buffer left of cursor zle -N replace-string
vi-open-line-below o
bindkey '\er' replace-string
MARK Index of mark position into $BUFFER
vi-oper-swap-case
zle -N replace-string replace-pattern
NUMERIC Numeric argument passed with widget
vi-pound-insert
bindkey '\e%' replace-pattern
=PENDING Number of bytes still to be read
vi-put-after P
See man zshcontrib for supplied editing functions such as
vi-put-before p =PREBUFFER Input already read (no longer being edited)
replace-string.
vi-quoted-insert ^V PREDISPLAY Text to display before editable buffer
vi-repeat-change . POSTDISPLAY Text to display after editable buffer
vi-repeat-find ;
RBUFFER Part of buffer starting from cursor
vi-repeat-search N
WIDGET Name of widget being executed
vi-replace R
WIDGETFUNC Name of function implementing $WIDGET
vi-replace-chars r
WIDGETSTYLE Implementation style of completion widget
vi-rev-repeat-find ,
Special characters in bindkey strings:
vi-rev-repeat-search
Bell (alarm)
\a
vi-set-buffer 
\b Backspace
vi-set-mark m
\e, \E Escape
vi-substitute s
\f Form feed
vi-swap-case ~
\n Newline
vi-undo-change u
\r Carriage return
vi-unindent <
\t Tab (horizontal)
vi-up-line-or-history -
\v Tab (vertical)
vi-yank y
\nnn Octal character e.g \081
vi-yank-eol Y
\xnn Hexadecimal character eg. \x41
vi-yank-whole-line


Wyszukiwarka

Podobne podstrony:
wildfire refcard

więcej podobnych podstron