100% found this document useful (5 votes)
4K views

ZSH Reference Card

This document provides a brief reference for the zsh shell. It consists of 3 parts that cover general shell information, grammar and syntax, and extending shell functionality. The first part introduces shells and basic features. The second part focuses on using bash and zsh, covering topics like command line editing, history, and job control. The third part describes how to write variables, scripts, functions, and shell customizations. Each section page is aligned to print sections independently.

Uploaded by

api-3744861
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
4K views

ZSH Reference Card

This document provides a brief reference for the zsh shell. It consists of 3 parts that cover general shell information, grammar and syntax, and extending shell functionality. The first part introduces shells and basic features. The second part focuses on using bash and zsh, covering topics like command line editing, history, and job control. The third part describes how to write variables, scripts, functions, and shell customizations. Each section page is aligned to print sections independently.

Uploaded by

api-3744861
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

 Page 1 Zsh Reference Card Version 4.

Contents general in part 1, concentrating on bash and ash in parts 2 and 3. 
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.
3 Patterns: globbing and qualifiers
4 Options Part 1 (Introducing the Shell) contains the following chapters:
5 Options cont.; option aliases, single letter options 1 Introduction to Shells
6 Expansion: basic forms, history, prompts 2 Using Shell Features Together
7 Expansion: variables: forms and flags 3 More Shell Features
8 Shell variables: set by shell, used by shell (c.f. page 2)
9 Test operators; numeric expressions
10 Completion: contexts, completers, tags Part 2 (Using bash and zsh) contains the following chapters:
11 Completion cont.: tags cont, styles 4 Entering and Editing the Command Line
12 Completion cont.: styles cont, utility functions (c.f. pages 6 and 13)
13 Zsh line editor (zle) 5 Starting the Shell
(c.f. pages 4 and 5)
Notes 6 More About Shell History
The descriptions here are very brief.  You will not be able to learn  (c.f. pages 6 and 8)
shell syntax from them; see the various references below.  In  7 Prompts
particular the completion system is extremely rich and the  (c.f. page 6)
descriptions of its utility functions are the barest memory joggers. 8 Files and Directories
(c.f. page 9)
The start and end of each section is aligned with page boundaries,  9 Pattern Matching
so you can print out only the parts you want to refer to. (c.f. page 3)
10 Completion
References (c.f pages 10 through 12)
Zsh manual:  Supplied with the shell: should be installed in Unix  11 Jobs and Processes
manual page and info formats.  Texinfo generates PS or PDF;  (c.f. page 6)
available as separate doc bundle from same place as the shell.
Part3 (Extending the Shell) contains the following chapters:
http://zsh.sunsite.dk/:  Site with much information  12 Variables
about zsh, including HTML manual and a more user­friendly  (c.f. pages 7 and 8)
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 
 Page 2 Zsh Reference Card Version 4.2 

Grammar command2, and so on (a pipeline). case word {


List is any sequence of sublists (including just one)  [(] pattern1[|pattern2...]) [;] list ;;
separated by ; or newline. ; and newline are always  if listi1; then[;] listt1; …
interchangeable except in ;;. [ elif listi2; then listt2; ] }
… Non­portable alternative.
Sublist is any sequence of pipelines (including just one)  [ else listt3; ]
connected by && or ||.  fi select name [ in word …];
If listi1 is true, execute listt1; else if listi2 is true  do list;
Pipeline is any sequence of simple commands connected by |. execute listt2; else execute listt3. done
Print menu of words, read a number, set name to selected word, 
Command is either a simple command (a command word) for name [ in word … ] execute list until end of input. Portable but rare.
followed optionally by word … or one of the special commands  do list;
below. done (list[;])
Execute list with variable name set to each of word … in turn Execute list in a subshell (a new process where nothing that 
Word is any text that produces a single word when expanded;  If in … is omitted the positional parameters are used. happens affects the current shell).
word … is any number of these separated by whitespace.
for name in word …; { list } {list[;]}
Name is a shell identifier: an alphabetic character or _ followed  foreach name ( word … ) [;] Execute list (no new process: simply separates list from what’s 
by any sequence of alphanumeric characters or _.  list; around and can take redirections).
end
[ … ] indicates optional; dots on their own line mean any  Non­portable alternative forms. function nameword {[;] list[;] }
number of repetitions of the line just above. nameword () {[;] list[;] }
while listw; do listd; done Define function named nameword; executes list when run; 
 Bold text is to be typed literally. While listw is true execute listd. running nameword word1 … makes word1 … available as $1
etc. in function body.  list must end with [;] or newline for 
Status  “true” or “false” is determined by: for commands, the  until listu; do listd; done portability. nameword can be repeated to define multiple 
return status; for pipelines the last command; for sublists the last  Non­portable: while listu is not true execute listd. functions (rare, non­portable).
pipeline; for lists the last sublist that was executed.
repeat numexp; do list; done time [ pipeline ]
sublist1 && sublist2 [ && sublist3 … ] repeat numexp sublist Report time for pipeline if given else totals for current shell.
Non­portable:  repeat  list or sublist numexp times.
Execute sublists until one is false.
[[ condition ]]
case word in Evaluate condition (see below), gives status true or false.
sublist1 || sublist2 [ || sublist2 … ]
[(] pattern1[|pattern2...]) [;] list ;;
Execute sublists until one is true.  Note strings of 

&& sublists can contain || sublists and vice versa; they are parsed  esac
left to right. Try matching word against every pattern in turn until success. 
Execute the corresponding list.  ;& instead of &&  means fall 
command1 | command2 [ | command3 … ] through to next list.
Execute command1, sending its output to the input of 
 Page 3 Zsh Reference Card Version 4.2 

Pattern matching (globbing) KSH_GLOB operators (patterns may contain | for alternatives): E Executable by members of file’s group


Basic patterns: @(pat) Group patterns R World readable
* Any string *(pat) Zero or more occurrences of pat W World writeable
? Any character +(pat) One or more occurrences of pat X World executable
[class] Any single character from class ?(pat) Zero or one occurrences of pat s Setuid
[^class] Any single character not from class !(pat) Anything but the pattern pat S Setgid
<num1-num2> Any number between num1 and num2 t Sticky bit
<-num2> from 0; <num1-> to infinity. Globbing flags with EXTENDED_GLOB: fspec Has chmod­style permissions spec
**/ Directories to any level (#i) Match case insensitively estring Evaluation string returns true status
(pat1) Group patterns (#l) Lower case matches upper case +cmd Same but cmd must be alphanumeric or _
(pat1|pat2) pat1 or pat2 (any number of |’s) (#I) Match case sensitively ddev Device number dev (major*256 + minor)
(#b) Parentheses set match, mbegin, mend l[-+]num Link count is (less than, greater than) num
Character classes may contain any character or the following  (#B) Parentheses no longer set arrays U Owned by current effective UID
special patterns in any mix; literal – must be first; literal ^ must  (#m) G
Match in MATCH,  MBEGIN, MEND Owned by current effective GID
not be first:
(#M) Don’t use MATCH etc. uuid Owned by given uid (may be <name>)
a-b A character in the range a to b
(#anum) Match with num approximations ggid Owned by given gid (may be <name>)
[:alnum:] An alphanumeric character
(#s) Match only at start of test string a[Mwhms][-+]n Access time in given units
[:alpha:] An alphabetic character
(#e) Match only at end of test string m[Mwhms][-+]n Modification time in given units
[:ascii:] A character in the ASCII character set
(#qexpr) expr is a a set of glob qualifiers (below) c[Mwhms][-+]n Inode change time in given units
[:blank:] A space or tab
^ Negate following qualifiers
[:cntrl:] A control character
Glob qualifiers (in parentheses after file name pattern): - Toggle following links (first one turns on)
[:digit:] A decimal digit
/ Directory M Mark directories
[:graph:] A printable character other than whitespace
F Non­empty directory; for empty use (/^F) T Mark directories, links, special files
[:lower:] A lower case letter
. Plain file N Whole pattern expands to empty if no match
[:print:] A printable character
@ Symbolic link D Leading dots may be matched
[:punct:] A punctuation character
= Socket n Sort numbers numerically
[:space:] Any whitespace character
p Name pipe (FIFO) o[nLlamcd] Order by given code (may repeat)
[:upper:] An upper case letter
* Executable plain file O[nLlamcd] Order by reverse of given code
[:xdigit:] A hexadecimal digit
% Special file [num] Select numth file in current order
%b Block special file [num1,num2] Select num1th to num2th file (as arrays)
Extended patterns (option EXTENDED_GLOB must be set):
%c Character special file :X History modifier X; may have more
^pat Anything that doesn’t match pat
r Readable by owner (N.B. not current user) Time units are Month, week, hour, minute, second.
pat1^pat2 Match pat1 then anything other than pat2 Order codes are name (default), size, link count, access time, 
w Writeable by owner
pat1~pat2 Anything matching pat1 but not pat2 modification time, inode change time, directory depth.
x Executable by owner
X# Zero or more occurrences of element X
A Readable by members of file’s group
X## One or more occurrences of element X
I Writeable by members of file’s group
 Page 4 Zsh Reference Card Version 4.2 

Options CORRECT_ALL Correct spelling of all arguments HIST_NO_STORE Don’t store history and fc


Set options with setopt, unset with  unsetopt.  Asterisk  CSH_JUNKIE_HISTORY Single ! for previous command HIST_REDUCE_BLANKS Trim multiple insgnificant blanks
indicates on by default for native zsh. CSH_JUNKIE_LOOPS list; end for do...done HIST_SAVE_NO_DUPS Remove duplicates when saving
*ALIASES Expand aliases CSH_JUNKIE_QUOTES No newlines in quotes HIST_VERIFY Show ! history line for editing
ALL_EXPORT Export all variables to environment CSH_NULLCMD Redirections with no commands fail *HUP Send SIGHUP to proceses on exit
*ALWAYS_LAST_PROMPT Completion lists after prompt CSH_NULL_GLOB One glob must succeed, failures go IGNORE_BRACES Don’t use {a,b} expansions
ALWAYS_TO_END On completion go to end of word DVORAK Dvorak keyboard for correction IGNORE_EOF Ignore ^D (stty eof char)
*APPEND_HISTORY History appends to existing file EMACS Same as bindkey -e INC_APPEND_HISTORY Save history line by line
AUTO_CD Directory as command does cd *EQUALS Expand =cmd to /path/to/cmd INTERACTIVE Shell is interactive
AUTO_CONTINUE Jobs are continued when disowned ERR_EXIT Exit shell on non­zero status INTERACTIVE_ # on interactive line for comment
*AUTO_LIST List ambiguous completions ERR_RETURN Return from function instead COMMENTS
*AUTO_MENU Menu complete after two tabs *EVAL_LINE_NO $LINENO counts inside eval code KSH_ARRAYS Indexing etc. for arrays like ksh
AUTO_NAME_DIRS Variables always can be %~ abbrevs *EXEC Execute commands KSH_AUTOLOAD Function file includes function name
*AUTO_PARAM_KEYS Magic completion for parameters EXTENDED_GLOB See globbing section above KSH_GLOB See globbing above
*AUTO_PARAM_SLASH $dirname completes with / EXTENDED_HISTORY Timestamps saved to history file KSH_OPTION_PRINT Show all options plus on or off
AUTO_PUSHD cd uses directory stack too *FLOW_CONTROL Use ^S/^Q style flow control KSH_TYPESET No word splitting in typeset etc.
*AUTO_REMOVE_SLASH Trailing / in completion removed *FUNCTION_ARGZER0 $0 in function is its name *LIST_AMBIGUOUS List completions when ambiguous
AUTO_RESUME cmd can resume job %cmd *GLOB Use globbing as described above *LIST_BEEP Beep on ambiguous completion
*BAD_PATTERN Errors on pattern syntax; else literal *GLOBAL_EXPORT Exported variables not made local LIST_PACKED More compact completion lists
*BANG_HIST ! style history allowed *GLOBAL_RCS Execute /etc/z* files LIST_ROWS_FIRST List completions across
*BARE_GLOB_QUAL Glob qualifiers with bare parens GLOB_ASSIGN var=* expands, assigns array *LIST_TYPES File types listed in completion
BASH_AUTO_LIST List completions on second tab GLOB_COMPLETE Patterns are active in completion LOCAL_OPTIONS Options reset on function return
*BEEP Beep on all errors GLOB_DOTS Patterns may match leading dots LOCAL_TRAPS Traps reset on function return
*BG_NICE Background jobs at lower priority GLOB_SUBST Substituted characters may glob LOGIN Shell is login shell
BRACE_CCL X{ab} expands to Xa Xb *HASH_CMDS Store command location for speed LONG_LIST_JOBS More verbose listing of jobs
BSD_ECHO No echo escapes unles -e given *HASH_DIRS Store for all commands in dir MAGIC_EQUAL_SUBST Special expansion after all =
*CASE_GLOB Glob case sensitively *HASH_LIST_ALL Store all on first completion MAIL_WARNING Warn if mail file timestamp changed
C_BASES Output hexadecimal with 0x HIST_ALLOW_CLOBBER On clobber error, up arrow to retry MARK_DIRS Append / to globbed directories
CDABLE_VARS cd var  works if $var is directory *HIST_BEEP Beep when going beyond history MENU_COMPLETE Cycle through ambiguous matches
CHASE_DOTS Resolve .. in cd HIST_EXPIRE_DUPS_ Duplicate history entries lost first MONITOR Shell has job control enabled
CHASE_LINKS Resolve symbolic links in cd FIRST *MULTIOS Multiple redirections are special
*CHECK_JOBS Check jobs before exiting shell HIST_FIND_NO_DUPS History search finds once only *NOMATCH Error if glob fails to match
*CLOBBER Allow redirections to overwrite HIST_IGNORE_ALL_ Remove all earlier duplicate lines *NOTIFY Asynchronous job control messages
COMPLETE_ALIASES Completion uses unexpanded aliases DUPS NULL_GLOB Failed globs are removed from line
COMPLETE_IN_WORD Completion works inside words HIST_IGNORE_DUPS Remove duplicate of previous line NUMERIC_GLOB_SORT Numbers in globs sorted numerically
CORRECT Correct spelling of commands HIST_IGNORE_SPACE Don’t store lines starting with space OCTAL_ZEROES Leading zeros in integers force octal
HIST_NO_FUNCTIONS Don’t store shell functions
 Page 5 Zsh Reference Card Version 4.2 

OVERSTRIKE Start line editor in overstrike mode VERBOSE Output commands to be executed -L SUN_KEYBOARD_HACK


PATH_DIRS dir/cmd can be found in $PATH VI Same as bindkey -v -M SINGLE_LINE_ZLE
POSIX_BUILTINS Illogical command behaviour XTRACE Show trace of execution with $PS4 -N AUTO_PUSHD
PRINT_EIGHT_BIT ZLE -O CORRECT_ALL
Print all 8­bit characters directly Line editor used to input lines
-P RC_EXPAND_PARAM
PRINT_EXIT_VALUE Return status printed unless zero
-Q PATH_DIRS
PRIVILEGED Special behaviour on setuid/setgid Option aliases (native zsh on right):
-R LONG_LIST_JOBS
PROMPT_BANG Special treatment of ! in prompt BRACE_EXPAND NO_IGNORE_BRACES
-S REC_EXACT
*PROMPT_CR Prompt always at start of line DOT_GLOB GLOB_DOTS
-T CDABLE_VARS
HASH_ALL HASH_CMDS
*PROMPT_PERCENT % escapes expanded in prompts -U MAIL_WARNING
HIST_APPEND APPEND_HISTORY
PROMPT_SUBST $ expansion etc. in prompts -V NO_PROMPT_CR
HIST_EXPAND BANG_HIST
PUSHD_IGNORE_DUPS Don’t push dir multiply on stack -W AUTO_RESUME
LOG NO_HIST_NO_FUNCTIONS
PUSHD_MINUS -X LIST_TYPES
Reverse sense of –  and + in pushd MAIL_WARN MAIL_WARNING
-Y MENU_COMPLETE
PUSHD_SILENT No non­err messages from pushd ONE_CMD SINGLE_COMMAND
-Z ZLE
PUSHD_TO_HOME pushd with no argument goes to ~ PHYSICAL CHASE_LINKS
-a ALL_EXPORT
RC_EXPAND_PARAM X$array gives Xelt1 Xelt2 etc. PROMPT_VARS PROMPT_SUBST
-e ERR_EXIT
STDIN SHIN_STDIN
RC_QUOTES '' inside single quotes gives ' -f NO_RCS
TRACK_ALL HASH_CMDS
*RCS Run startup files -g HIST_IGNORE_SPACE
REC_EXACT Exact completion matches are good -h HIST_IGNORE_DUPS
Single letter options (used with set as well as setopt): -i INTERACTIVE
RESTRICTED Shell has restricted capabilities -0 CORRECT -k INTERACTIVE_COMMENTS
RM_STAR_SILENT Don’t warn on rm * -1 PRINT_EXIT_VALUE -l LOGIN
RM_STAR_WAIT Wait before asking if rm * is OK -2 NO_BAD_PATTERN -m MONITOR
SHARE_HISTORY Save and restore history per line -3 NO_NO_MATCH -n NO_EXEC
SH_FILE_EXPANSION ~ etc. expansion done early -4 GLOB_DOTS -p PRIVILEGED
SH_GLOB Disables non­extended zsh globs -5 NOTIFY -r RESTRICTED
SHIN_STDIN Shell input comes from stdin -6 BG_NICE -s SHIN_STDIN
-7 IGNORE_EOF -t SINGLE_COMMAND
SH_NULL_CMD Commandless redirections like sh
-8 MARK_DIRS -u NO_UNSET
SH_OPTION_LETTERS Single letter options are like sh -9 AUTO_LIST -v VERBOSE
*SHORT_LOOPS for words; list works -B NO_BEEP -w CHASE_LINKS
SH_WORD_SPLIT Split non­array variables yuckily -C NO_CLOBBER -x XTRACE
SINGLE_COMMAND Execute one command then exit -D PUSHD_TO_HOME -y SH_WORD_SPLIT
SINGLE_LINE_ZLE Line editing on single line (bad tty) -E PUSHD_SILENT Note also -A to set arrays, -b to end option processing, -c to 
SUN_KEYBOARD_HACK Unmatched ` at end of line ignored -F NO_GLOB pass a single command,  -m to set pattern argument, -o to specify 
TRANSIENT_RPROMPT -G NULL_GLOB
Right prompt goes away after edit long name (may repeat), ­s to sort positional parameters.
-H RM_STAR_SILENT
TRAPS_ASYNC Traps may run when waiting
-I IGNORE_BRACES
TYPESET_SILENT Silent on typeset foo -J AUTO_CD
*UNSET Unset variables OK, treat as empty -K NO_BANG_HIST
 Page 6 Zsh Reference Card Version 4.2 

Expansion !!:* Words 1 to $ inclusive %@ %t Time of day in am/pm format


Basic forms of expansion in the order they order: !!:2* Words 2 to $ inclusive %B (%b) Start (stop) bold face mode
!expr History expansion !!:2- Words 2 to $­1 inclusive %D %D{str} Date as YY-MM-DD, optional strftime spec
alias Alias expansion %E Clear to end of line
<(cmds) Replaced by file with output from cmds Modifiers on arguments (can omit word selector): %i Script/function line number ($LINENO)
=(cmds) Same but can be reread (use for diff) !!:1:h Trailing path component removed %j Number of jobs as listed by jobs
>(cmds) Replaced by file with input to cmds !!:1:t Only trailing path component left %L Shell depth ($SHLVL)
$var Variable substitution !!:1:r File extension .ext removed %l Login terminal without /dev or 
${var} Same but protected, allows more options !!:1:e Only extension ext left /dev/tty
$(cmds) Replaced by output of cmds !!:1:p Print result but don’t execute %M Full host name
`cmds` Older form of same, harder to nest !!:1:q Quote from further substitution %m Host name to first dot or n dots
$((expr)) Arithmetic result of evaluating expr !!:1:Q Strip one level of quotes %N Name of script, function, sourced file
X{a,b}Y XaY Xby (N.B. does no pattern matching) !!:1:x Quote and also break at whitespace %n Name of user (same as $USERNAME)
X{1..3}Y X1Y X2y X3y !!:1:l Convert to all lower case %S %s Start (stop) standout mode
X{08..10}Y X08Y X09y X10y !!:1:u Convert to all upper case %T Time of day, 24­hour format
~user, ~dir User home, named dir (dir is var name) !!:1:s/s1/s2/ Replace string s1 by s2 %U %u Start (stop) underline mode (patchy support)
=cmd /full/path/to/cmd !!:1:gs/s2/s2/ Same but global %v nth component of $psvar array
pattern Glob file names, as above !!:1:& Use same s1 and s2 on new target %W Date as middle­endian MM/DD/YY
%w Date as DAY DD
History expansion:
Most modifiers work on variables (e.g ${var:h}) or in glob  %y Login terminal without /dev
!! Immediately preceding line (all of it)
qualifiers (e.g. *(:h)), the following only work there: %_ Parser state (continuation lines, debug)
!{!} Same but protected, may have args in {}
${var:fm} Repeat modifier m till stops changing %~ Like %/, %d but with tilde substitution
! Line just referred to, default !!
${var:F:N:m} Same but no more than N times %{esc%} Escape sequence esc doesn’t move cursor
!13 Line numbered 13 (history shows nos.)
${var:wm} Apply modifer m to words of string %X(.tstr.fstr) tstr if test X gives n, else fstr
!-2 Command two before current
${var:W:sep:m} Same but words are separated by sep %<str< Truncate to n on left, str on left if so
!cmd Last command beginning cmd
%>str> Truncate to n on right, str on right if so
!?str Last command containing str
Prompt expansion (with PROMPT_PERCENT, on by default); may 
!# Current command line so far
take a decimal number n (default 0) immediately after the %:
Test characters in %X(.tstr.fstr): ! Privileged; # uid n; ?
%! %h Current history event number
Word selectors: last status n; _ at least n nested constructs; / at least n $PWD
%# # if superuser, else %
!!:0 Extract argument 0 (command word) elements; ~ same with ~ subst; D month is n; d day of month is n; 
%% A single %
!!:1 Argument numbered 1 (first cmd arg) g effective gid is n; j at least n jobs; L $SHLVL at least n; l at 
%) A ) (use with %X(.tstr.fstr))
!!:^ Also argument 1 least n chars on line so far; S $SECONDS at least n; T hours is n; 
!!:$ Last command argument %* Time in 24­hour format with seconds
t minutes is n; v at least n components in $psvar; w day of 
!:% Word found by !?str (needs correct line) %/ %d $PWD; n gives trailing parts, -n leading
week is n (Sunday = 0).
!!:2-4 Word 2 to 4 inclusive %c %. %C Deprecated alternatives, differ by default n
!!:-4 Words 0 to 4 inclusive %? Return status of last command
 Page 7 Zsh Reference Card Version 4.2 

Parameter (Variable) Expansion L Lower case result Order of rules:


Basic forms: str will also be expanded; most forms work on  n on or On sort numerically 1. Nested substitution: from inside out
words of array separately: o Sort into ascending order 2. Subscripts: ${arr[3]} extract word; ${str[2]}
${var} Substitute contents of var, no splitting O Sort into descending order extract character; ${arr[2,4]}, ${str[4,8]}
${+var} 1 if var is set, else 0 P Interpret result as parameter name, get value extract range; -1 is last word/char, -2 previous etc.
${var:-str} $var if non­null, else str q Quote result with backslashes 3. ${(P)var} replaces name with value
${var-str} $var if set (even if null) else str qq Quote result with single quotes 4. ¨$array¨ joins array, may use (j:str:)
${var:=str} $var if non­null, else str and set var to itqqq Quote result with double quotes 5. Nested subscript e.g. ${${var[2,4]}[1]}
${var::=str} Same but always use str qqqq Quote result with $'...' 6. #, %, / etc. modifications
${var:?str} $var if non­null else error, abort Q Strip quotes from result 7. Join if not joined and (j:str:), (F)
${var:+str} str if $var is non­null t Output type of variable (see below) 8. Split if (s), (z), (z), =
${var#pat} min match of pat removed from head u Unique: remove duplicates after first 9. Split if SH_WORD_SPLIT
${var##pat} max match of pat removed from head U Upper case result 10. Apply (u)
${var%pat} min match of pat removed from tail v Include value in result; may have (kv) 11. Apply (o), (O)
${var%%pat} max match of pat removed from tail V Visible representation of special chars 12. Apply (e)
${var:#pat} $var unless pat matches, then empty w Count words with ${#var} 13. Apply (l.str.), (r.str.)
${var/p/r} One occurrence of p replaced by r W Same but empty words count 14. If single word needed for context, join with $IFS[1].
${var//p/r} All occurrences of p replaced by r X Report parsing errors (normally ignored)
${#var} Length of var in words (array) or bytes z Split to words using shell grammar Types shown with (t) have basic type scalar, array, 
${^var} Expand elements like brace expansion p Following forms recognize print \­escapes integer, float, assocation, then hyphen­separated words 
${=var} Split words of result like lesser shells j:str: Join words with str between from following list:
${~var} Allow globbing, file expansion on result l:x: Pad with spaces on left to width x local Parameter is local to function
${${var%p}#q} Apply %p then #q to $var l:x::s1: Same but pad with repeated s1 left Left justified with typeset -L
l:x::s1::s2: Same but s2 used once before any s1s right_blanks Right justified with typeset -R
Parameter flags in parentheses, immediately after left brace: r:x::s1::s2: Pad on right, otherwise same as l forms right_zeros Right justified with typeset -Z
% Expand %s in result as in prompts s:str: Split to array on occurrences of str lower Lower case forced with typeset -l
@ Array expand even in double quotes S With patterns, search substrings upper Upper case forced with typeset -u
A Create array parameter with ${...=...} I:exp: With patterns, match expth occurrence readonly Read­only, typeset -r or readonly
a Array index order, so Oa is reversed B With patterns, include match beginning tag Tagged as typeset -t (no special effect)
c Count characters for ${#var} E With patterns, include match end export Exported with export, typeset -x
C Capitalize result M With patterns, include matched portion unique Elements unique with typeset -U
e Do parameter, comand, arith expansion N With patterns, include length of match hide Variable not special in func (typeset -h)
f Split result to array on newlines R With patterns, include unmatched part (rest) hideval typeset hides value (typeset -H)
F Join arrays with newlines between elements Delimeters  shown as :str: may be any pair of chars or matched  special Variable special to shell
i oi or Oi sort case independently parenthses (str), {str}, [str], <str>.
k For associative array, result is keys
 Page 8 Zsh Reference Card Version 4.2 

Parameters (Variables) TRY_BLOCK_ In always block, 1 if error in try block LOGCHECK Interval for checking $watch


Parameters set by shell, denotes special to shell (may not be  ERROR MAIL Mail file to check ($mailpath overrides)
reused except by hiding with typeset ­h in functions) TTY Terminal associated with shell if any MAILCHECK Mail check interval, secs (before prompt)
! Process ID of last background process TTYIDLE Time for which terminal has been idle mailpath : List of files to check for new mail
# Number of arguments to script or function UID Real user ID (via system call), set if root
manpath : Directories to find manual, used by man
ARGC Same USERNAME Name for $UID, set if root module_path : Directories for zmodload to find modules
$ Process ID of main shell process VENDOR Operating system vendor (compile time) NULLCMD Command used if only redirection given
- String of single letter options set ZSH_NAME Base name of command used to start shell path : Command search path
* Positional parameters ZSH_VERSION Version number of shell POSTEDIT Termcap strings sent to terminal after edit
argv Same PS1, PROMPT, Printed at start of first line of output; see 
@ Same, but does splitting in double quotes Parameters used by the shell if set: : indicates arrays with  prompt above for escape sequences for all PSs
? Status of last command corresponding colon­separated paths e.g. cdpath and CDPATH:
PS2, PROMPT2 Printed for continuation lines
0 Name of shell, usually reflects functions ARGV0 Export to set name of external command
PS3, PROMPT3 Print within select loop
_ Last argument of previous command BAUD Baud rate: compensation for slow terminals
PS4, PROMPT4 For tracing execution (xtrace option)
CPUTYPE Machine type (run time) cdpath : Directories searched for cd target
psvar : Used with %nv in prompts
EGID Effective GID (via system call), set if root COLUMNS Width of screen
READNULLCMD Command used when only input redir given
EUID Effective UID (via system call), set if root DIRSTACKSIZE Maximum size of stack for pushd
REPORTTIME Show report if command takes this long (s)
ERRNO Last system error number ENV File to source when started as sh or ksh
REPLY Used to return a value e.g. by read
GID Real group ID (via system call), set if root FCEDIT Default editor used by fc
reply Used to return array value
HISTCMD The current history line number fignore : List of suffixes ignored in file completion
RPS1, RPROMPT Printed on right of screen for first line
HOST The host name fpath : Directories to search for autoloading
RPS2, Printed on right of screeen for continuation 
LINENO Line number in shell, function histchars History, quick replace, comment chars RPROMPT2 line 
LOGNAME Login name (exported by default) HISTCHARS Same, deprecated
SAVEHIST Max number of history lines saved
MACHTYPE Machine type (compile time) HISTFILE File for reading and writing shell history
SPROMPT Prompt when correcting spelling
OLDPWD Previous directory HISTSIZE Number of history lines kept internally
STTY Export with stty arguments to command
OPTARG Argument for option handled by getopts HOME Home directory for ~ and default cd target
TERM Type of terminal in use (xterm etc.)
OPTIND Index of positional parameter in getopts IFS Characters that separate fields in words
TIMEFMT Format for reporting usage with time
OSTYPE Operating system type (compile time) KEYTIMEOUT Time to wait for  rest of key seq (1/100 s)
TMOUT Send SIGALRM after seconds of inactivity
pipestatus Array giving statuses of last pipeline LANG Locale (usual variable, LC_* override)
TMPPREFIX Path prefix for shell’s temporary files
PPID Process ID of parent of main shell LC_ALL Locale (overrides LANG, LC_*)
watch : List of users or all, notme to watch for
PWD Current directory LC_COLLATE Locale for sorting etc.
WATCHFMT Format of reports for $watch
RANDOM A pseudo­random number, repeating LC_CTYPE Locale for character handling
WORDCHARS Chars considered parts of word by zle
SECONDS Seconds since shell started LC_MESSAGES Locale for messages
ZBEEP String to replace beeps in line editor
SHLVL Depth of current shell LC_NUMERIC Locale for decimal point, thousands
ZDOTDIR Used for startup files instead of ~ if set
signals Array giving names of signals LC_TIME Locale for date and time
status Status of last command LINES Height of screen
LISTMAX Number of completions shown w/o asking
 Page 9 Zsh Reference Card Version 4.2 

Tests and numeric expressions -ef True if a and b refer to same file (i.e. are linked) • <, <=, >, >=


Usually used after if, while, until or with && or ||, but the status  = True if string a matches pattern b • ==, !=
may be useful anywhere e.g. as implicit return status for function. == Same but more modern (and still not often used) • &&
!= True if string a does not match pattern b • ||, ^^
File tests, e.g. [[ -e file ]]: < • ? (ternary operator)
True if string a sorts before string b
-a True if file exists • : (true/false separator for ternary operator)
> True if string a sorts after string b
-b True if file is block special • =, +=, -=, *=, /=, %=, **=, &=, ^=, |=, <<=, >>=, 
-eq True if numerical expressions a and b are equal
-c True if file is character special &&=, ^^=, ||=
-ne True if numerical expressions a and b are not equal • , (as in C, evaluate both sides and return right hand 
-d True if file is directory -lt True if a < b numerically side).
-e True if file exists -gt True if a > b numerically
-f True if file is a regular file (not special or directory -le
True if a ≤ b numerically For functions use zmodload -i zsh/mathfunc; functions 
-g True if file has setgid bit set (mode includes 02000) -ge
True if a ≥ b numerically available are as described in C math library manual:
-h True if file is symbolic link • Single floating point argument, return floating point: 
-k True if file has sticky bit set (mode includes 02000) Combining expressions: expr is any of the above, or the result of  acos, acosh, asin, asinh, atan (optional second 
-p True if file is named pipe (FIFO) any combination of the following: argument like C atan2), atanh, cbrt, ceil, cos, 
-r True if file is readable by current process ( expr ) Group tests cosh, erf, erfc, exp, expm1, fabs, floor, 
-s True if file has non­zero size ! expr True if expr is false and vice versa gamma, j0, j1, lgamma, log, log10, log1p, 
-u True if file has setuid bit set (mode includes 04000) exprA && exprB True if both expressions true logb, sin, sinh, sqrt, tan, tanh, y0, y1
-w True if file is writeable by current process • Single floating point argument, return integer: ilogb
exprA || exprB True if either expression true
-x True if file executable by current process • No arguments, return integer: signgam (remember 
parentheses)
-L True if file is symbolic link For complicated numeric tests use (( expr )) where expr is 
• Two floating point arguments, return floating point: 
-O True if file owned by effective UID of current  a numeric expression: status is 1 if expr is non­zero else 0.  Same 
copysign, fmod, hypot, nextafter
process syntax used in $(( expr )) substitution. Precedences of 
• One integer, one floating point argument, return floating 
-G True if file has effective GID of current process operators from highest to lowest are:
point: jn, yn
-S True if file is a socket (special communication file) • func(arg...), numeric constant (e.g. 3, -4, 3.24, 
• One floating point, one integer argument, return floating 
-N -14.6e-10), var (does not require $ in front unless 
True if file has access time no newer than mod time point: ldexp, scalb
some substitution e.g. ${#var} is needed, $ is error if 
• Either integer or floating point, return same type: abs
var is to be modified)
Other single argument tests, e.g. [[ -n str ]]: • Coerce to floating point: float
• ( expr )
-n True if str has non­zero length • Coerce to integer: int
• !, ~, ++ (post­ or preincrement), -- (post­ or 
-o True if option str is set • Optional string argument (read/write variable name), 
predecrement), unary +, unary -
-t True if str (number) is open file descriptor return floating point: rand48
• &
-z True if str has zero length Example use:
• ^
• |
Multiple argument tests e.g. [[ a -eq b ]]:  numerical  zmodload -i zsh/mathfunc
• ** (exponentiation)
expressions may be quoted formulae e.g. ‘1*2’ : float x
• *, /, %
-nt (( x = 26.4 * sqrt(2) ))
True if file a is newer than file b • binary +, binary -
print $(( log(x)/2 ))
-ot True if file a is older than file b • <<, >>
 Page 10 Zsh Reference Card Version 4.2 

Completion Command contexts: any command name plus the special contexts: directories Directories


Load new completion system with: -array-value- Element in array directory-stack Entries in pushd directory stack
autoload -Uz compinit -brace- Parameter within ${… } displays X displays
compinit parameter- domains Network domain (DNS) names
-assign- Left hand side of assignment expansions Individual expansions instead of all
Configuration: uses styles parameter-
file-descriptors Numbers of open file descriptors
zstyle context style value… -command- Word in command position
where context  may be a pattern matching the following form: files Generic file matching tag
-condition- Word in [[ ... ]] condition
:completion:func:completer:cmd:arg:tag fonts X font names
-default- Word with no specific completion
in which: fstypes Files system types for mount etc.
-equal- Word beginning with equals sign
completion functions Shell functions, possibly other types
-first- Tried first, may set _compskip
Literal string always used by completion functions globbed-files Names of files matched by pattern
-math- Inside arithmetic such as (( ... ))
func groups UNIX groups
Name of directly called widget, blank for contextual completion -parameter- Parameter with bare $ in front
history-words Words from shell history
completer -redirect- Word after redirection operator
hosts Names of network hosts
Method of completion e.g. complete; see below -subscript- Inside parameter subscript
indexes Indexes of arrays
cmd -tilde- Between ~ and first / of argument
Name of command being completed, or special command context -value- jobs Shell jobs
Right hand side of assignment
arg interfaces Network interfaces (as from ifconfig)
Only valid with standard parsing: arg-n for nth argument keymaps ZLE keymaps
Tags:
option-opt-n for nth argument of option opt accounts keysyms Names of X keysyms
For users­hosts style
tag libraries Names of system libraries
all-expansions When expanding, everything at once
Indication of type of thing to be completed at this point. limits System resource limits
all-files All files rather than a subset
arguments local-directories Subdirectories of current directories
Completers (indicates modifiers existing or later completions): Command arguments
arrays manuals Names of manual pages
_all_matches Later completers add all matches Names of array parameters
association-keys mailboxes E­mail folders
_approximate Complete with errors in part so far Keys of associative arrays
bookmarks maps NIS maps etc.
_complete Basic completion Bookmarks for URLs, ZFTP, etc.
builtins messages Used in format style for messages
_correct Correct word already typed Names of builtin commands
characters modifiers X modifiers
_expand Perform shell expansions Character classes, stty characters
colormapids modules Shell modules etc.
_expand_alias Expand aliases only X colormap IDs
colors my-accounts Own accounts, with users­hosts style
_history Complete words from shell history Names of colors, usually X
commands named-directories Directories named by a parameter
_ignored Reinstate matches omitted External commands, subcommands
contexts names Names of all sorts
_list List on first completion, insert on second Contexts in zstyle
corrections newsgroups USENET newgroups
_match Complete using patterns from line Possible approximations, corrections
cursors nicknames Nicknames of NIS maps
_menu Menu completion, no menu selection X cursor names
default options Options to commands
_oldlist Use existing list before generating new one Nothing specific in certain contexts
descriptions original Original when correcting, expanding
_prefix Complete ignoring what’s after cursor Used in format style for matches
devices other-accounts Other accounts with users­hosts style
Device special files
 Page 11 Zsh Reference Card Version 4.2 

Tags continued: auto-description String for option descs without specific insert-tab Insert TAB if no non­whitespace yet


packages RPM, Debian etc. packages avoid-completer Avoid completer with _all_matches insert- Only menu complete when no prefix to 
parameters Names of shell parameters cache-path Path to top of various caches unambiguous insert
path-directories Directories under $cdpath cache-policy Function to decide on cache rebuilding keep-prefix Try to keep expandable prefix
paths Used with assorted directory paths call-command If true, use external (slow) command last-prompt Return to last editing line if possible
pods Perl documentation command External command to call (+args) list Control listing when history completing
ports TCP, UDP prots command-path Override PATH for commands to match list-colors Color specs like LS_COLORS
prefixes URL etc. prefixes commands Default sys init commands (start etc.) list-grouped Grouped listing shown more compactly
printers Names of print queues complete Complete aliases (_expand_alias) list-packed All matches shown more compactly
processes PIDs completer The list of completers to try (see above) list-prompt Prompt when scrolling completions
processes-names Names of processes in killall condition Delay insertion of matches (_list) list-rows-first Increment rows first in lists
sequences MH sequences etc. disabled Disabled aliases (_expand_alias) list-suffixes Show ambiguous bits of multiple paths
sessions ZFTP sessions etc. disable-stat If set, _cvs uses ls instead of zsh/stat list-separator Separates description in verbose list
signals System signal names, HUP etc. domains Net domains (/etc/resolv.conf) local host:path:dir for URLs as files
strings Assorted strings, e.g. second arg of cd expand For prefix, suffix in multiple parts mail-directory Directory for mailbox files (~/Mail)
styles Styles in zstyle fake Add value:desc fake completions match-original Add * when matching (_match)
suffixes Filename extensions fake-files dir:names add names in dir matcher Apply match control syntax per tag
tags Tags used with rpm etc. fake-parameters Params to complete even if not yet set matcher-list Apply match control syntax globally
targets Targets inside Makefiles file-patterns pattern:tag generates files with tag max-errors Max errors allowed in approx/correct
time-zones Time zones with TZ parameter etc. file-sort size, links, time, access, inode, reverse max-matches-width Cols to reserve for matches (not desc)
types Assorted types of anything filter In LDAP, attributes for filtering menu Use menu completion
urls Used with web addresses force-list Just list matches: always or number muttrc Alternative for ~/.muttrc
users Names of users format Desc string, %d shows specific desc numbers Prefer job numbers instead of name
values Values in lists glob Attempt glob expansion (_expand) old-list Retain list of matches (_oldlist)
variant Used when picking variant of command global Global aliases (_expand_alias) old-matches Use old match list (_all_matches)
visuals X visuals group-name Name groups shown together by tag old-menu Keep list for meus (_oldlist)
warnings Used in the format style for warnings group-order Order groups shown together by tag original Add original match for approx/correct
widgets Names of zsh widgets groups Unix groups, as per /etc/group packageset For arguments of Debian dpkg
windows IDs of X windows hidden Complete but don’t list matches path For X colors, path to rgb.txt
zsh-options Shell options hosts List of host names, as /etc/hosts pine-directory Directory for PINE mailboxes
hosts-ports List of hosts:ports for TCP/UDP ports TCP/IP services (/etc/services)
Styles (indicates on by default): ignore-line Don’t complete words already present prefix-hidden Hide common prefix e.g. in options
accept-exact Accept exact match even if ambiguous ignore-parents parent or pwd: ignore parent dirs prefix-needed Common prefix must by typed by user
add-space Add a space after expansions ignored-patterns If pattern matched, don’t complete preserve-prefix Initial file patterns to leave alone
ambiguous Cursor after ambiguous path component insert All matches at once (_all_matches) range Range of words in history to consider
assign-list PATH­style list on assignment insert-ids Convert %cmd to unambiguous PID regular Complete regular aliases
 Page 12 Zsh Reference Card Version 4.2 

Styles continued: -foo Complete option -foo _describe setdesc arr1 --


remote-access Control remote access for e.g. _cvs +foo Complete option +foo Associate descriptions with completions; arr1 contains 
remove-all-dups Never complete duplicates in history -+foo Complete -foo or +foo completion:description entries
select-prompt Prompt shown in menu selection *-foo Option may occur multiple times
select-scroll Lines to scroll in menu selection _message text-msg
-foo-:esg:_comp Option has arg in same word
Don’t complete, just output text-msg
separate-sections Manual sections used as part of tag -foo+:msg:_comp Option has arg in same or next word
show-completer Show progress of completers as msg -foo=:msg:_comp Option arg -foo=bar or -foo bar _multi_parts sep array
single-ignored Control _ignore when single match -foo=-:msg:_comp Option arg is -foo=bar only Complete by parts with separator sep, $array contains full 
sort Override sorting of matches -foo[desc] Option has description desc matches.
special-dirs Add . and .. to file list *:*pat:msg:_comp Complete words up to pat
squeeze-slashes fo//ba is fo/ba not fo/*/ba *:*pat::msg:_comp Modify words etc. for args _path_files
stop Pause before looping shell history (-goo -boo)-foo -foo excludes -goo,  -boo Complete files including partial paths; _files is smart front end; 
strip-comments Remove display name from email addr (*)-foo -foo excludes rest args as matches options -f all files (default), -g pat matching pat (with 
subst-globs-only Only take expansions from globbing (:)-foo _files maybe directories too), -/ directories only, -W dirs
-foo excludes normal args
paths in which files are found, -F files files to ignore, 
substitute When expanding, first try subst (-)-foo -foo excludes all options
overrides ignored-patterns
suffix Only expand path with no /suffix !-foo -foo should not be completed
tag-order Preference order for tags in context *:msg:<space> Show message but don’t complete _sep_parts arr1 sep1 arr2 sep2 …
urls Determine where URLs are taken from *:msg:(a b) Matches are listed items Elements from arr1, then separator, then elements from arr2, 
use-cache Control caching for various commands *:msg:((a\:dsc)) Matches with descriptions etc.
use-compctl Use comptl­style completions *:msg:->string Array state has string if matched
use-perl Use simpler Perl code for _make *:msg:{code} Shell code generates matches _values -s sep desc spec1 spec2 …
users List of user names *:msg:= action Insert dummy argument first Complete multiple values separated by sep; values are given by 
users-hosts List of user@host possibilities *:msg:_comp arg Call _comp with additional args specs, each of which is similar to _arguments option spec
users-hosts-ports List of user@host:port *:msg: _comp arg Call _comp with only given arg without leading -
verbose Verbose output e.g. option descriptions -a – set1 -c - … Common and specific completion sets
_wanted thing expl ‘my things’ \
word Line changes based on current word - "(set1)" -c - … Mutually exclusive sets
compadd mything1 mything2 …
-s Allow combined single letters Typical way of adding completions mything1 etc. with tag 
Using _arguments for parsing standard command arguments: -sw Same, even if option has args things and description my things; expl should be local 
Three arguments give argument/option selector, message to  -- Guess options by using --help variable.  Use single tag, c.f. _tags and _requested
output, action to take.  Examples: -- -i pat Same, ignoring options matching pat
1:msg:_comp First arg; show msg, exec _comp _tags tag1 tag2
1::msg:_comp Same for optional argument _requested tag
Examples of other utility functions:
:msg:_comp Arg number inferred from position Implement loops over different tags
_alternative \
*:msg:_comp Any of the remaining args (“rest args”) ‘users:user:_users’ \
*::msg:_comp _all_labels tag expl descr compcommand
words etc. set to normal args ‘hosts:host:_hosts
_next_label tag expl descr
*:::msg:_comp …  set to args for this chunk Either users or hosts (tag, description, action)
Implement loops over different labels for each _requested tag
 Page 13 Zsh Reference Card Version 4.2 

Zsh line editor (zle) end-of-list quoted-insert ^V


Builtin widgets, emacs binding, vicmd binding, viins binding; exchange-point-and-mark ^X^X quote-line € '
€  denotes escape key: execute-last-named-cmd € z quote-region € ”
accept-and-hold €a execute-name-cmd € x recursive-edit
accept-and-infer-next-history expand-cmd-path redisplay ^R ^R
accept-and-menu-complete expand-history €! redo
accept-line ^M ^M ^M expand-or-complete ^I ^I reset-prompt
accept-line-and-down-history ^O expand-or-complete-prefix reverse-menu-complete
argument-base expand-word ^X* run-help €h
backward-char ^B forward-char ^F self-insert ... ...
backward-delete-char ^H forward-word € f self-insert-unmeta € ^M
backward-delete-word get-line € g send-break ^G
backward-kill-line gosmacs-transpose-chars set-mark-command ^@
backward-kill-word ^W history-beginning-search- spell-word € s
backward-word €b backward set-local-history
beep history-beginning-search- transpose-chars ^T
beginning-of-buffer-or-history € < forward transpose-words € t
beginning-of-history history-incremental-search- ^R undefined-key
beginning-of-line ^A backward ^Xr undo ^_
beginning-of-line-hist history-incremental-search- ^S universal-argument
capitalize-word € c forward ^Xs up-case-word €u
clear-screen ^L ^L ^L history-search-backward € p up-history ^p
complete-word history-search-forward € n up-line-or-history ^p k up
copy-prev-word € ^_ infer-next-history ^x^n up-line-or-search
copy-prev-shell-word insert-last-word € _ vi-add-eol A
copy-region-as-kill € w kill-buffer ^X^K vi-add-next a
delete-char kill-line ^K vi-backward-blank-word B
delete-char-or-list ^D kill-region vi-backward-char h ^H left
delete-word kill-whole-line ^U vi-backward-delete-char X ^H
describe-key-briefly kill-word € d vi-backward-kill-word ^W
digit-argument €0 .. 1..9 list-choices €^d ^d ^d vi-backward-word b
down-case-word € l list-expand ^Xg ^G ^G vi-beginning-of-line
down-history ^n magic-space vi-caps-lock-panic
down-line-or-history ^n j down menu-complete vi-change c
down-line-or-search menu-expand-or-complete vi-change-eol C
emacs-backward-word neg-argument €- vi-change-whole-line S
emacs-forward-word overwrite-mode ^X^O vi-cmd-mode ^XV €
end-of-buffer-or-history € > pound-insert # vi-delete d
end-of-history push-input vi-delete-char x
end-of-line ^E push-line €q vi-digit-or-beginning-of-line 0
end-of-line-hist push-line-or-edit vi-down-line-or-history +
 Page 14 Zsh Reference Card Version 4.2 

Builtin widgets cont.: vi-substitute s Special characters in bindkey strings:


vi-end-of-line $ vi-swap-case ~ \a Bell (alarm)
vi-fetch-history G vi-undo-change u \b Backspace
vi-find-next-char ^X^F f vi-unindent < \e, \E Escape
vi-find-next-char-skip t vi-up-line-or-history -
\f Form feed
vi-find-prev-char F vi-yank y
\n Newline
vi-find-prev-char-skip T vi-yank-eol Y
vi-first-non-blank ^ vi-yank-whole-line \r Carriage return
vi-forward-blank-word W what-cursor-position ^X= \t Tab (horizontal)
vi-forward-blank-word-end E where-is \v Tab (vertical)
vi-forward-char l rght which-command €? \nnn Octal character e.g \081
vi-forward-word w yank ^y \xnn Hexadecimal character eg. \x41
vi-forward-word-end e yank-pop € y \Mx, \M-x Set 8th bit in character
vi-goto-column € | |
\Cx, \C-x Control character e.g. \C-a
vi-goto-mark ` Special parameters inside user­defined widgets; indicates 
^x Control character e.g. ^a (same as ^A)
vi-goto-mark-line ˙ readonly:
vi-history-search-backward / BUFFER ^? Delete
Entire editing buffer
vi-history-search-forward ? \\ Single backslash
BUFFERLINES Number of screen lines for full buffer
vi-indent > CONTEXT start, cont, select, vared
vi-insert i Keymaps:
CURSOR Index of cursor position into $BUFFER
vi-insert-bol I emacs Like Emacs editor
CUTBUFFER Last item to be killed
vi-join ^X^J J viins Like Vi editor in insert mode
vi-kill-eol D HISTNO Currently history line being retrieved
vicmd Like Vi editor in command mode
vi-kill-line ^U KEYMAP Currently selected keymap
.safe Emergency keymap, not modifiable
vi-match-bracket ^X^B % KEYS Keys typed to invoke current widget
vi-open-line-above O killring Array of previously killed items, can resize
vi-open-line-below o LASTSEARCH Last search string in interactive search
vi-oper-swap-case LASTWIDGET Last widget to be executed
vi-pound-insert
LBUFFER Part of buffer left of cursor
vi-put-after P
MARK Index of mark position into $BUFFER
vi-put-before p
vi-quoted-insert ^V NUMERIC Numeric argument passed with widget
vi-repeat-change . PENDING Number of bytes still to be read
vi-repeat-find ; PREBUFFER Input already read (no longer being edited)
vi-repeat-search N PREDISPLAY Text to display before editable buffer
vi-replace R POSTDISPLAY Text to display after editable buffer
vi-replace-chars r RBUFFER Part of buffer starting from cursor
vi-rev-repeat-find ,
WIDGET Name of widget being executed
vi-rev-repeat-search
vi-set-buffer “ WIDGETFUNC Name of function implementing $WIDGET
vi-set-mark m WIDGETSTYLE Implementation style of completion widget

You might also like