File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 108
108
fzf-history-widget () {
109
109
local selected
110
110
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases noglob nobash_rematch 2> /dev/null
111
- # Ensure the associative history array, which maps event numbers to the full
112
- # history lines, is loaded, and that Perl is installed for multi-line output.
113
- if zmodload -F zsh/parameter p:history 2> /dev/null && (( ${# commands[perl]} )) ; then
111
+ # Ensure the module is loaded if not already, and the required features, such
112
+ # as the associative 'history' array, which maps event numbers to full history
113
+ # lines, are set. Also, make sure Perl is installed for multi-line output.
114
+ if zmodload -F zsh/parameter p:{commands,history,options} 2> /dev/null && (( ${# commands[perl]} )) ; then
115
+ # Import commands from other shells if SHARE_HISTORY is enabled, as the
116
+ # 'history' array only updates after executing a non-empty command.
117
+ [[ " ${options[sharehistory]} " == " on" ]] && fc -RI
114
118
selected=" $( printf ' %s\t%s\000' " ${(kv)history[@]} " |
115
119
perl -0 -ne ' if (!$seen{(/^\s*[0-9]+\**\t(.*)/s, $1)}++) { s/\n/\n\t/g; print; }' |
116
120
FZF_DEFAULT_OPTS=$( __fzf_defaults " " " -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0" ) \
You can’t perform that action at this time.
0 commit comments