diff options
| author | 2019-12-09 18:36:48 +0530 | |
|---|---|---|
| committer | 2019-12-09 18:36:48 +0530 | |
| commit | 885cfd47345017ca8524c259e53949312360fc8f (patch) | |
| tree | 367464beb26ff93da9e5c48c231159122ba88dbb /plugins/fzhist | |
| parent | 9614fec13ba9b1363d5845f862384ed4018f2d4b (diff) | |
| download | nnn-885cfd47345017ca8524c259e53949312360fc8f.tar.gz | |
Support both fzf and fzy
Diffstat (limited to 'plugins/fzhist')
| -rwxr-xr-x | plugins/fzhist | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/fzhist b/plugins/fzhist index c47efa2..e5618ae 100755 --- a/plugins/fzhist +++ b/plugins/fzhist @@ -6,14 +6,22 @@ # Shell: POSIX compliant # Author: Arun Prakash Jana +if which fzf >/dev/null 2>&1; then + fuzzy=fzf +elif which fzy >/dev/null 2>&1; then + fuzzy=fzy +else + exit 1 +fi + shellname="$(basename "$SHELL")" if [ "$shellname" = "bash" ]; then hist_file="$HOME/.bash_history" - entry="$(fzy < "$hist_file")" + entry="$("$fuzzy" < "$hist_file")" elif [ "$shellname" = "fish" ]; then hist_file="$HOME/.config/fish/fish_history" - entry="$(grep "\- cmd: " "$hist_file" | cut -c 8- | fzy)" + entry="$(grep "\- cmd: " "$hist_file" | cut -c 8- | "$fuzzy")" fi if ! [ -z "$entry" ]; then |