Opening EPUB files with Vim
RSS • Permalink • Created 03 Jun 2014 • Written by Alberto Pettarin
My favourite editor is Vim. It is powerful, extensible, keyboard-oriented, so it is perfect for my work habits. (I am actually looking forward to testing Sublime Text 3 since I discovered it has a Vim emulation mode, but I never have had time yet.)
Working with EPUB files, one wants to be able to inspect/edit them on the fly, without having to decompress them first.
In Vim, all you need to do is adding this line at the very bottom of your ~/.vimrc:
au BufReadCmd *.epub call zip#Browse(expand("<amatch>"))Now you can open an EPUB file without unzipping it first:
$ vim /tmp/shs/jerome01.epubVim will show the list of ZIP entries in the EPUB container:
Of course you can use commands or macros, for example the find shortcut /.
To open a file, just select it and hit ENTER,
Vim will open it for you:
If you make modifications, just save them as you do with any "regular" file (:w).
The corresponding entry inside the EPUB container will be updated accordingly.

