README
¶
fast-p
Quickly find and open a pdf among a collection of thousands of unsorted pdfs through fzf (fuzzy finder)
Installation on Unix or Linux based systems
-
Requirements. Make sure the following requirements are satisfied:
- install
pdftotext. This comes with the texlive distribution on linux, On ubuntu,sudo apt-get install poppler-utils. - install
fzf: https://github.com/junegunn/fzf - install
GNU grep,ag(silver searcher).
- install
-
Install binary. Do either one of the two steps below:
- Compile from source with
goandgo get. With a workinggolanginstallation, dogo get github.com/bellecp/fast-pIt will fetch the code and its dependencies, compile and create an executablefast-pin the/binfolder of your go installation, typically~/go/bin. Make sure the commandfast-pcan be found (for instance, add~/go/binto your$PATH.) - Or: Use the precompiled binary for your architecture. Download the binary that corresponds to your
architecture at https://github.com/bellecp/fast-p/releases and make sure that
the command
fast-pcan be found. For instance, put the binary filefast-pin~/custom/binand addexport PATH=~/custom/bin:$PATHto your.bashrc.
- Compile from source with
-
Tweak your .bashrc. Add the following code to your
.bashrc
p () {
open=xdg-open # this will open pdf file withthe default PDF viewer on KDE, xfce, LXDE and perhaps on other desktops.
ag -U -g ".pdf$" \
| fast-p \
| fzf --read0 --reverse -e -d $'\t' \
--preview-window down:80% --preview '
v=$(echo {q} | tr " " "|");
echo -e {1}"\n"{2} | grep -E "^|$v" -i --color=always;
' \
| cut -z -f 1 -d $'\t' | tr -d '\n' | xargs -r --null $open > /dev/null 2> /dev/null
}
- You may replace
ag -U -g ".pdf$"with another command that returns a list of pdf files. - You may replace
open=...by your favorite PDF viewer, for instanceopen=evinceoropen=okular.
Installation on OSX with homebrew
-
Requirements. You need the Homebrew https://brew.sh/. Next, you need the commandline tools
fzf,pdftotext,ag(silver searcher) as well asggrep,gcut,gxargs; these can be installed all at once withbrew install fzf coreutils findutils poppler-utils the_silver_searcher -
Install binary. Do either one of the two steps below:
- Compile from source with
goandgo get. With a workinggolanginstallation, dogo get github.com/bellecp/fast-pIt will fetch the code and its dependencies, compile and create an executablefast-pin thebin/folder of your go installation, typically~/go/bin. Make sure the commandfast-pcan be found (for instance, add~/go/binto your$PATH.) - Or: Use the precompiled binary for your architecture. Download the binary that corresponds to your
architecture at https://github.com/bellecp/fast-p/releases and make sure that
the command
fast-pcan be found. Darwin is meant for OSX. For instance, put the binary filefast-pin~/custom/binand addexport PATH=~/custom/bin:$PATHto your.bashrc.
- Compile from source with
-
Tweak your .bashrc. Add the following code to your
.bashrc
p () {
local open
open=open # on OSX, "open" opens a pdf in preview
ag -U -g ".pdf$" \
| fast-p \
| fzf --read0 --reverse -e -d $'\t' \
--preview-window down:80% --preview '
v=$(echo {q} | gtr " " "|");
echo -e {1}"\n"{2} | ggrep -E "^|$v" -i --color=always;
' \
| gcut -z -f 1 -d $'\t' | gtr -d '\n' | gxargs -r --null $open > /dev/null 2> /dev/null
}
- You may replace
ag -U -g ".pdf$"with another command that returns a list of pdf files. - You may replace
open=...by your favorite PDF viewer, for instanceopen=evinceoropen=okular.
Usage
Use the command p to browse among the PDF files in the current directory and its subdirectories.
The first run of the command will take some time to cache the text extracted from each pdf. Further runs of the command will be much faster since the text extraction will only apply to new pdfs.
See it in action

Is the historical bash code still available?
Yes, see https://github.com/bellecp/fast-p/blob/master/p but using the go binary as explained above is recommended for speed and interoperability.
Documentation
¶
There is no documentation for this package.