Editing LaTex in OSX Like a Boss

12 Nov 2014  Posted under: osx , vim , programming

Wish that your latex editor had version control built into it, or that it had vim commands?

Using a program called rubber you can easily build latex documents from the command line, which means we can integrate it into vim!

Install rubber using macports

sudo port install rubber

and add the following to your .vimrc file

au FileType tex command Make :!rubber --pdf --warn all %
au FileType tex command Clean :!rubber --clean %
au FileType tex inoremap " ``''<ESC>hi
au FileType tex set spell spelllang=en_us

This adds the commands :Make and :Clean for tex files, as well as adds smart quotes (when you type " it automatically inserts ``’’) and spell checking!

But what about the automatic document previews that come in TexShop and TexMaker? Good news everyone, we can do that too! Grab a copy of the document viewer Skim. Go to Skim > Preferences > Sync and enable Check for file changes. Now, when you update the PDF file, the document will automatically be reloaded.

And finally, to add icing to the cake grab Tim Pope’s Git Fugitive and Andy Stewarts vim-gitgutter.