mirror of
https://github.com/jarun/nnn.git
synced 2024-09-11 13:06:14 +03:00
* fzhist plugin: add support for zsh history * fzhist plugin: check $HISTFILE for history file location * fzhist plugin: remove extra trailing spaces
This commit is contained in:
parent
d72ab3497a
commit
547508aa78
@ -3,7 +3,9 @@
|
|||||||
# Description: Fuzzy find a command from history,
|
# Description: Fuzzy find a command from history,
|
||||||
# edit in $EDITOR and run as a command
|
# edit in $EDITOR and run as a command
|
||||||
#
|
#
|
||||||
# Note: Supports only bash and fish history
|
# Note: Supports only bash, zsh and fish history
|
||||||
|
#
|
||||||
|
# TODO: For zsh there's also $ZDOTDIR which might need to be checked as well for the -z $HISTFILE && -n $ZDOTDIR case.
|
||||||
#
|
#
|
||||||
# Shell: POSIX compliant
|
# Shell: POSIX compliant
|
||||||
# Author: Arun Prakash Jana
|
# Author: Arun Prakash Jana
|
||||||
@ -17,7 +19,18 @@ fi
|
|||||||
shellname="$(basename "$SHELL")"
|
shellname="$(basename "$SHELL")"
|
||||||
|
|
||||||
if [ "$shellname" = "bash" ]; then
|
if [ "$shellname" = "bash" ]; then
|
||||||
hist_file="$HOME/.bash_history"
|
if [ -f "$HISTFILE" ]; then
|
||||||
|
hist_file="$HISTFILE"
|
||||||
|
else
|
||||||
|
hist_file="$HOME/.bash_history"
|
||||||
|
fi
|
||||||
|
entry="$("$fuzzy" < "$hist_file")"
|
||||||
|
elif [ "$shellname" = "zsh" ]; then
|
||||||
|
if [ -f "$HISTFILE" ]; then
|
||||||
|
hist_file="$HISTFILE"
|
||||||
|
else
|
||||||
|
hist_file="$HOME/.zsh_history"
|
||||||
|
fi
|
||||||
entry="$("$fuzzy" < "$hist_file")"
|
entry="$("$fuzzy" < "$hist_file")"
|
||||||
elif [ "$shellname" = "fish" ]; then
|
elif [ "$shellname" = "fish" ]; then
|
||||||
hist_file="$HOME/.local/share/fish/fish_history"
|
hist_file="$HOME/.local/share/fish/fish_history"
|
||||||
|
Loading…
Reference in New Issue
Block a user