aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bash/util.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/bash/util.sh b/bash/util.sh
index 3658c8eb..f184723b 100644
--- a/bash/util.sh
+++ b/bash/util.sh
@@ -45,7 +45,11 @@ gen-password() {
mkdir -p ~/.local/share/fzf/
touch ~/.local/share/fzf/fvi
fvi() {
- f="$(fzf --preview 'cat {}' --history=$HOME/.local/share/fzf/fvi)"
+ if [ -n "$(__git_ps1 '')" ]; then
+ f="$(git ls-files | fzf --query "$1" --preview 'cat {}' --history=$HOME/.local/share/fzf/fvi)"
+ else
+ f="$(fzf --query "$1" --preview 'cat {}' --history=$HOME/.local/share/fzf/fvi)"
+ fi
if [ -n "$f" ]; then
history -s vi "$f"
vi "$f"