Skip to content

Commit

Permalink
fzhist plugin: add support for zsh history
Browse files Browse the repository at this point in the history
  • Loading branch information
umaranis committed Sep 4, 2023
1 parent d72ab34 commit fa40e2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/fzhist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Description: Fuzzy find a command from history,
# edit in $EDITOR and run as a command
#
# Note: Supports only bash and fish history
# Note: Supports only bash, zsh and fish history
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
Expand All @@ -19,6 +19,9 @@ shellname="$(basename "$SHELL")"
if [ "$shellname" = "bash" ]; then
hist_file="$HOME/.bash_history"
entry="$("$fuzzy" < "$hist_file")"
elif [ "$shellname" = "zsh" ]; then
hist_file="$HOME/.zsh_history"
entry="$("$fuzzy" < "$hist_file")"
elif [ "$shellname" = "fish" ]; then
hist_file="$HOME/.local/share/fish/fish_history"
entry="$(grep "\- cmd: " "$hist_file" | cut -c 8- | "$fuzzy")"
Expand Down

0 comments on commit fa40e2a

Please sign in to comment.