summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/edit_document5
1 files changed, 5 insertions, 0 deletions
diff --git a/.local/bin/edit_document b/.local/bin/edit_document
index 3afa96e..7609770 100755
--- a/.local/bin/edit_document
+++ b/.local/bin/edit_document
@@ -3,9 +3,14 @@
DIR=${1:-~/documents}
EXTENSION=${2:-tex}
+PREVIEWPOS=right
+
+[ $(( $(tput cols) )) -lt 120 ] && PREVIEWPOS=up
+
DOCUMENT=$(find -L $DIR -name "*.${EXTENSION}" \
| fzf -m --header 'Open file(s) in $EDITOR' \
--history=${XDG_CACHE_HOME:-$HOME/.cache}/edit_document.hist \
+ --preview-window=$PREVIEWPOS \
--border=rounded --preview='bat {}')
[ -n "${DOCUMENT}" ] || exit 1