-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreview
executable file
·18 lines (16 loc) · 908 Bytes
/
preview
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env zsh
if [[ $# -ne 0 ]]; then
echo "$0: Preview ascii files in the current directory"
echo "This script expects no positional arguments"
exit 1
fi
find . -type f -exec file --mime-encoding {} + | grep ascii | cut -d ':' -f 1 |
fzf --ansi \
--no-sort \
--reverse \
--preview-window='down:85%' \
--bind='ctrl-u:preview-page-up' \
--bind='ctrl-d:preview-page-down' \
--bind='ctrl-k:preview-up' \
--bind='ctrl-j:preview-down' \
--preview="cat {}"