summaryrefslogtreecommitdiff
path: root/bash-scripts/fuz
diff options
context:
space:
mode:
Diffstat (limited to 'bash-scripts/fuz')
-rwxr-xr-xbash-scripts/fuz19
1 files changed, 19 insertions, 0 deletions
diff --git a/bash-scripts/fuz b/bash-scripts/fuz
new file mode 100755
index 0000000..429bf7c
--- /dev/null
+++ b/bash-scripts/fuz
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -e
+
+main() {
+ previous_file="$1"
+ file_to_edit=`select_file $previous_file`
+
+ if [ -n "$file_to_edit" ] ; then
+ "$EDITOR" "$file_to_edit"
+ main "$file_to_edit"
+ fi
+}
+
+select_file() {
+ given_file="$1"
+ fzf --preview="cat {}" --preview-window=right:70%:wrap --query="$given_file"
+}
+
+main ""