From 1eb912521a495462b02a3474902e068caae4d696 Mon Sep 17 00:00:00 2001 From: Josh Skidmore Date: Wed, 19 Aug 2020 06:39:46 -0400 Subject: [PATCH] exit if there is no history --- zsh-fzf-history-search.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zsh-fzf-history-search.zsh b/zsh-fzf-history-search.zsh index 90bdaad..fcdb8cd 100644 --- a/zsh-fzf-history-search.zsh +++ b/zsh-fzf-history-search.zsh @@ -1,5 +1,9 @@ fzf_history_seach() { - history -i 0 | fzf +s +m -x --tac -e | awk '{print substr($0, index($0, $4))}' | tr -d "\n" + local _history=$(history -i 0) + + [[ -z "$_history" ]] && exit + + echo -e "$_history"| fzf +s +m -x --tac -e | awk '{print substr($0, index($0, $4))}' | tr -d "\n" } autoload fzf_history_seach