[Tex/LaTex] How to install vim-latex on a Mac

installingmacvim

Can someone please help with installing vim with the latex plugin? I've tried searching online for easier instructions, but I can't find anything. I have very little experience with terminal and I have no idea how to do this.

What I've done is just download the file. I created a ~/.vim directory, but beyond that, I'm completely lost.

Update: I'm running Mac OSX 10.7.5.

Best Answer

I suppose you already have Vim installed in your operating system.

Usually, the installation is very straightforward for every operating system. For Macs, we have MacVim, and AFAIK two options are available:

  • Getting the correct MacVim version for your operating system in the project website, unzip the archive file and drag MacVim.app to your Applications folder.

  • If you use Homebrew, there's already a formula for MacVim available, so you can run

    brew install macvim
    

    and MacVim will be deployed.

Now, back to vim-latex.

I don't use it, but I can provide a very clean way of deploying plugins for Vim. The solution relies on Tim Pope's awesome Pathogenpathogen plugin, which manage our runtimepath very easily.

First of all, open your terminal and type the following:

mkdir -p ~/.vim/autoload ~/.vim/bundle

This will create two directories (and even the parent .vim directory, if it doesn't exist), autoload and bundle inside .vim. Now we are half-way done.

Now, let's type this command:

curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

This command will download pathogen.vim from Tim's repository and deploy it inside the autoload directory.

Now let's edit .vimrc to call pathogen for us. Type this command:

open -e ~/.vimrc

and add the following lines, preferably in the beginning:

execute pathogen#infect()
syntax on
filetype plugin indent on

...
<the rest of the file>
...

Note: The only required line for pathogen to work is the first one, the other two are just some goodies I recommend. :)

Now, if you want to deploy any Vim plugin, just extract it and put the extracted directory under ~/.vim/bundle. That's it.

For example, I got this file, vim-latex-1.8.23-20130116.788-git2ef9956.tar.gz. I'll extract it, and the result is as follows:

vim-latex-1.8.23-20130116.788-git2ef9956
├── compiler
│   └── tex.vim
├── doc
│   ├── catalog.xml
│   ├── db2vim
│   │   ├── db2vim
│   │   ├── domutils.py
│   │   └── textutils.py
│   ├── imaps.txt
│   ├── latexhelp.txt
│   ├── latex-suite-chunk.xsl
│   ├── latex-suite-common.xsl
│   ├── latex-suite.css
│   ├── latex-suite-quickstart.css
│   ├── latex-suite-quickstart.txt
│   ├── latex-suite-quickstart.xml
│   ├── latex-suite.txt
│   ├── latex-suite.xml
│   ├── latex-suite.xsl
│   ├── Makefile
│   ├── Makefile.in
│   ├── README
│   └── README.new
├── ftplugin
│   ├── bib_latexSuite.vim
│   ├── latex-suite
│   │   ├── bibtex.vim
│   │   ├── bibtools.py
│   │   ├── brackets.vim
│   │   ├── compiler.vim
│   │   ├── custommacros.vim
│   │   ├── diacritics.vim
│   │   ├── dictionaries
│   │   │   ├── dictionary
│   │   │   └── SIunits
│   │   ├── elementmacros.vim
│   │   ├── envmacros.vim
│   │   ├── folding.vim
│   │   ├── macros
│   │   │   └── example
│   │   ├── main.vim
│   │   ├── mathmacros-utf.vim
│   │   ├── mathmacros.vim
│   │   ├── multicompile.vim
│   │   ├── outline.py
│   │   ├── packages
│   │   │   ├── accents
│   │   │   ├── acromake
│   │   │   ├── afterpage
│   │   │   ├── alltt
│   │   │   ├── amsmath
│   │   │   ├── amsthm
│   │   │   ├── amsxtra
│   │   │   ├── arabic
│   │   │   ├── array
│   │   │   ├── babel
│   │   │   ├── bar
│   │   │   ├── biblatex
│   │   │   ├── bm
│   │   │   ├── bophook
│   │   │   ├── boxedminipage
│   │   │   ├── caption2
│   │   │   ├── cases
│   │   │   ├── ccaption
│   │   │   ├── changebar
│   │   │   ├── chapterbib
│   │   │   ├── cite
│   │   │   ├── color
│   │   │   ├── comma
│   │   │   ├── csquotes
│   │   │   ├── deleq
│   │   │   ├── drftcite
│   │   │   ├── dropping
│   │   │   ├── enumerate
│   │   │   ├── eqlist
│   │   │   ├── eqparbox
│   │   │   ├── everyshi
│   │   │   ├── exmpl
│   │   │   ├── fixme
│   │   │   ├── flafter
│   │   │   ├── float
│   │   │   ├── floatflt
│   │   │   ├── fn2end
│   │   │   ├── footmisc
│   │   │   ├── geometry
│   │   │   ├── german
│   │   │   ├── graphicx
│   │   │   ├── graphpap
│   │   │   ├── harpoon
│   │   │   ├── hhline
│   │   │   ├── histogram
│   │   │   ├── hyperref
│   │   │   ├── ifthen
│   │   │   ├── inputenc
│   │   │   ├── letterspace
│   │   │   ├── lineno
│   │   │   ├── longtable
│   │   │   ├── lscape
│   │   │   ├── manyfoot
│   │   │   ├── moreverb
│   │   │   ├── multibox
│   │   │   ├── multicol
│   │   │   ├── newalg
│   │   │   ├── ngerman
│   │   │   ├── numprint
│   │   │   ├── oldstyle
│   │   │   ├── outliner
│   │   │   ├── overcite
│   │   │   ├── pagenote
│   │   │   ├── parallel
│   │   │   ├── plain
│   │   │   ├── plates
│   │   │   ├── polski
│   │   │   ├── psgo
│   │   │   ├── schedule
│   │   │   ├── SIunits
│   │   │   ├── textfit
│   │   │   ├── times
│   │   │   ├── tipa
│   │   │   ├── ulem
│   │   │   ├── url
│   │   │   ├── verbatim
│   │   │   └── version
│   │   ├── packages.vim
│   │   ├── projecttemplate.vim
│   │   ├── pytools.py
│   │   ├── smartspace.vim
│   │   ├── templates
│   │   │   ├── article.tex
│   │   │   ├── IEEEtran.tex
│   │   │   ├── report.tex
│   │   │   └── report_two_column.tex
│   │   ├── templates.vim
│   │   ├── texmenuconf.vim
│   │   ├── texproject.vim
│   │   ├── texrc
│   │   ├── texviewer.vim
│   │   ├── version.vim
│   │   └── wizardfuncs.vim
│   └── tex_latexSuite.vim
├── indent
│   └── tex.vim
├── latextags
├── ltags
├── Makefile
├── Makefile.in
└── plugin
    ├── filebrowser.vim
    ├── imaps.vim
    ├── libList.vim
    ├── remoteOpen.vim
    └── SyntaxFolds.vim

Now, I'll simply get the whole vim-latex-1.8.23-20130116.788-git2ef9956 directory and move/copy it inside ~/.vim/bundle.

If you want to open ~/.vim/bundle in Finder, just type

open ~/.vim/bundle

and you will get a nice file manager to help you.

That's how pathogen works for virtually all plugins. Note that vim-latex requires you to set some settings in your .vimrc. Just repeat

open -e ~/.vimrc

and add stuff after the pathogen line.

I really hope my answer helps. :)