1fc [ -e ename ] [ -m match ] [ old=new ... ] [ first [ last ] ] 2fc -l [ -nrdfEiD ] [ -t timefmt ] [ -m match ] 3 [ old=new ... ] [ first [ last ] ] 4fc -p [ -a ] [ filename [ histsize [ savehistsize ] ] ] 5fc -P 6fc -ARWI [ filename ] 7 Select a range of commands from first to last from the history 8 list. The arguments first and last may be specified as a number 9 or as a string. A negative number is used as an offset to the 10 current history event number. A string specifies the most 11 recent event beginning with the given string. All substitutions 12 old=new, if any, are then performed on the commands. 13 14 If the -l flag is given, the resulting commands are listed on 15 standard output. If the -m flag is also given the first argu- 16 ment is taken as a pattern (should be quoted) and only the his- 17 tory events matching this pattern will be shown. Otherwise the 18 editor program ename is invoked on a file containing these his- 19 tory events. If ename is not given, the value of the parameter 20 FCEDIT is used; if that is not set the value of the parameter 21 EDITOR is used; if that is not set a builtin default, usually 22 `vi' is used. If ename is `-', no editor is invoked. When 23 editing is complete, the edited command is executed. 24 25 If first is not specified, it will be set to -1 (the most recent 26 event), or to -16 if the -l flag is given. If last is not spec- 27 ified, it will be set to first, or to -1 if the -l flag is 28 given. 29 30 The flag -r reverses the order of the commands and the flag -n 31 suppresses command numbers when listing. 32 33 Also when listing, 34 -d prints timestamps for each command 35 -f prints full time-date stamps in the US `MM/DD/YY hh:mm' 36 format 37 -E prints full time-date stamps in the European `dd.mm.yyyy 38 hh:mm' format 39 -i prints full time-date stamps in ISO8601 `yyyy-mm-dd 40 hh:mm' format 41 -t fmt prints time and date stamps in the given format; fmt is 42 formatted with the strftime function with the zsh exten- 43 sions described for the %D{string} prompt format in the 44 section EXPANSION OF PROMPT SEQUENCES in zshmisc(1). The 45 resulting formatted string must be no more than 256 char- 46 acters or will not be printed. 47 -D prints elapsed times; may be combined with one of the 48 options above. 49 50 `fc -p' pushes the current history list onto a stack and 51 switches to a new history list. If the -a option is also speci- 52 fied, this history list will be automatically popped when the 53 current function scope is exited, which is a much better solu- 54 tion than creating a trap function to call `fc -P' manually. If 55 no arguments are specified, the history list is left empty, 56 $HISTFILE is unset, and $HISTSIZE & $SAVEHIST are set to their 57 default values. If one argument is given, $HISTFILE is set to 58 that filename, $HISTSIZE & $SAVEHIST are left unchanged, and the 59 history file is read in (if it exists) to initialize the new 60 list. If a second argument is specified, $HISTSIZE & $SAVEHIST 61 are instead set to the single specified numeric value. Finally, 62 if a third argument is specified, $SAVEHIST is set to a separate 63 value from $HISTSIZE. You are free to change these environment 64 values for the new history list however you desire in order to 65 manipulate the new history list. 66 67 `fc -P' pops the history list back to an older list saved by `fc 68 -p'. The current list is saved to its $HISTFILE before it is 69 destroyed (assuming that $HISTFILE and $SAVEHIST are set appro- 70 priately, of course). The values of $HISTFILE, $HISTSIZE, and 71 $SAVEHIST are restored to the values they had when `fc -p' was 72 called. Note that this restoration can conflict with making 73 these variables "local", so your best bet is to avoid local dec- 74 larations for these variables in functions that use `fc -p'. 75 The one other guaranteed-safe combination is declaring these 76 variables to be local at the top of your function and using the 77 automatic option (-a) with `fc -p'. Finally, note that it is 78 legal to manually pop a push marked for automatic popping if you 79 need to do so before the function exits. 80 81 `fc -R' reads the history from the given file, `fc -W' writes 82 the history out to the given file, and `fc -A' appends the his- 83 tory out to the given file. If no filename is specified, the 84 $HISTFILE is assumed. If the -I option is added to -R, only 85 those events that are not already contained within the internal 86 history list are added. If the -I option is added to -A or -W, 87 only those events that are new since last incremental 88 append/write to the history file are appended/written. In any 89 case, the created file will have no more than $SAVEHIST entries. 90 91history 92 Same as fc -l. 93 94r Same as fc -e -. 95