sponsor Vim development Vim logo Vim Book Ad

vim-office : read common binary files, such as PDFs or those for Libre or Microsoft Office

 script karma  Rating 8/2, Downloaded by 714  Comments, bugs, improvements  Vim wiki

created by
Enno Nagel
 
script type
utility
 
description
This plug-in enables Vim to read text documents of type PDF, Microsoft Office
such as Word (doc(x)), Excel (xls(x)) or Powerpoint (ppt(x)), LibreOffice
(odt), EPUB .... To go even further, for example, among many others file
formats, to read media files in Vim, add the Vimscript snippet from the Wiki
https://github.com/wofr06/lesspipe/wiki/vim of lesspipe.sh to your vimrc!

For the text extraction, it depends on external tools, but most use cases are
covered by an installation of

- LibreOffice and a common text browser (such as `lynx`), and
- pdftotext.

It prefers, whenever available, appropriate external converters such as
pandoc, odt2txt, docx2txt.pl, pptx2md, ... to do so, but will fall back to:

- Either LibreOffice which is an office suite that can handle all those formats
  listed above, except PDFs. (To use it on Microsoft Windows, ensure after its
  installation that its path is added to the %PATH% environment variable,
  say by Rapidee.)

- Or Tika which is a content extractor that can handle all those formats listed
  above and many more. To use it:

  1. Download the latest runnable tika-app-...jar from
     https://tika.apache.org/download.html to ~/bin/tika.jar (on Linux)
     respectively %USERPROFILE%\bin (on Microsoft Windows).

  2. Create

      - on Linux, a shell script ~/bin/tika that reads

          #!/bin/sh
          exec java -jar "$HOME/bin/tika.jar" "$@" 2>/dev/null

      and mark it executable (by chmod a+x ~/bin/tika).

      - on Microsoft Windows, a batch script %USERPROFILE%\bin\tika.bat that
        reads

          @echo off
          java -jar "%USERPROFILE%\bin\tika.jar" %*


  3. Add the folder of the newly created tika executable to your environment
     variable $PATH (on Linux) respectively %PATH% (on Microsoft Windows):

      - on Linux, if you use bash or zsh by adding to ~/.profile or ~/.zshenv
        the line

          PATH=$PATH:~/bin


      - on Microsoft Windows, a convenient program to update %PATH% is
        Rapidee.

# Issues

vim-office is developed at https://github.com/Konfekt/vim-office where issues can be filed.
 
install details
Unzip vim-office.zip into  ~/.vim on Linux respectively MacOS or %USERPROFILE%\vimfiles on Windows.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-office.zip 1.5 2024-03-15 7.0 Enno Nagel improve excel and powerpoint handling
vim-office.zip 1.4 2023-02-17 7.0 Enno Nagel possible recognize text in images with tesseract
vim-office.zip 1.3 2021-12-19 7.0 Enno Nagel improve Powerpoint, spreadsheet and Microsoft Windows support
vim-office.zip 1.2 2021-05-03 7.0 Enno Nagel add open document and other file formats; fix bugs
vim-office.zip 1.1 2020-04-27 7.4 Enno Nagel make MS Windows compatible and add additional converters
vim-office.zip 1.0 2019-07-10 7.0 Enno Nagel Initial upload
ip used for rating: 207.241.235.164

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github