vifm: Add pdf, docx viewer options

Added opening of docx files from vifm through either pandoc
interpretation as markdown if installed, or docx2txt invocation as a
fallback. (pandoc generally interprets the layout better than docx2txt,
especially contained tables).

Similarly, added option to open pdfs with pdftotext program in neovim,
to edit/grep/view only the text without pdf markup in neovim.

Changed key binding to open selected file in neovim from `o` to `e`,
mimicking the edit command found in some other file viewers.
This commit is contained in:
Marty Oehme 2021-02-19 12:49:14 +01:00
parent da52dad3d7
commit 3d742a0503
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -111,8 +111,10 @@ set timeoutlen=5000
mark h ~/
mark d ~/downloads/
mark p ~/projects/
mark s ~/projects/studentassistant/
mark i ~/pictures/
mark n ~/documents/notes/
mark N ~/Nextcloud/
mark l ~/documents/library/academia/pdf/
mark t ~/.local/share/vifm/Trash/
@ -172,7 +174,11 @@ command! reload :write | restart
" program.
" Pdf
filextype *.pdf zathura %c %i &, apvlv %c, xpdf %c
filextype *.pdf
\ { view as rich file }
\ zathura %c %i &, apvlv %c, xpdf %c,
\ { edit text content }
\ pdftotext -nopgbrk %c - | nvim
fileviewer *.pdf pdftotext -nopgbrk %c -
" PostScript
@ -334,10 +340,14 @@ fileviewer *.7z 7z l %c
" Office files
filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f &
fileviewer *.doc catdoc %c | nvim
filetype *.doc catdoc %c | nvim
fileviewer *.doc catdoc %c
filextype *.docx docx2txt %f - | nvim
fileviewer *.docx docx2txt %f -
filetype *.docx
\ pandoc -s -t markdown %f | nvim,
\ docx2txt %f - | nvim
fileviewer *.docx
\ pandoc -s -t markdown %f,
\ docx2txt %f -
" TuDu files
filetype *.tudu tudu -f %c
@ -431,7 +441,7 @@ nnoremap w :view<cr>
vnoremap w :view<cr>gv
" Open file in existing instance of nvim
nnoremap o :!nvim <cr>
nnoremap e :!nvim %f<cr>
" Open file in the background using its default program
nnoremap gb :file &<cr>l