new things

This commit is contained in:
ackman678
2021-03-30 00:37:43 -07:00
parent 14f1c48838
commit 6e92164bc3
8 changed files with 235 additions and 16 deletions

43
f Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
if [ "$1" == "-h" ] ; then
echo "
f - fuzzy preview and open text files or pdfs
usage:
f
f p
depends:
fzf
grep, git-grep, or ripgrep
zathura (or other fast pdf viewer)
pdf2bib.sh - handles saving to your bib db
"
exit 0
fi
#Setup defaults
# cslFile=${2:-$HOME/projects/bibd/bibd-md.csl}
# bibdFile=${3:-$HOME/projects/bibd/OMEGA.bib}
# cd $(dirname $bibdFile)
set -e #exit if an error
inFlag=${1:-"-i --files"}
if [ "$1" == "p" ]; then
ls *.pdf | fzf --preview 'pdftotext -l 2 -nopgbrk -q {1} -' \
--preview-window=up:70% --bind "enter:execute-silent(zathura {} &)" \
--bind "ctrl-s:execute(pdf2bib.sh {})+reload(ls *.pdf)"
exit 1
fi
if [ -z "$1" ]; then
#FZF_DEFAULT_COMMAND=rg -i --files --glob "!.git/*"
fzf --delimiter : --preview 'less {1}' \
--preview-window=up:70% --bind "enter:execute-silent(gvim {1} &)"
else
rg $1 | fzf --delimiter : --preview 'less {1}' \
--preview-window=up:70% --bind "enter:execute-silent(gvim {1} &)"
fi