m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-20 17:43:42 -05:00

Improve repeat history for zsh

brettanomyces
2014-06-29 21:21:21 -07:00
parent cf3145a7d9
commit e0d19586c4

@@ -59,6 +59,15 @@ fh() {
} }
``` ```
```sh
# fh - repeat history
fh() {
print -z $(([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s | sed 's/ *[0-9]* *//')
}
```
Replacing `eval` with `print -z` will push the arguments onto the editing buffer stack, allowing you to edit the command before running it. It also means the command you run will appear in your history rather than just `fh`. Unfortunately this only works for zsh.
Processes Processes
--------- ---------