brew install macvim- The
vimthat came with MacOS (located at/usr/bin/vim) did not havepython3orclientserverinstalled.macvimis more batteries-included. Runvim --versionto check what features yourvimincludes
- The
brew tap zegervdv/zathuraandbrew install zathura --with-synctexandbrew install zathura-pdf-poppler- This is the PDF viewer I use
- To get these to install, I also had to
brew install gccand upgrade my Xcode Command Line Tools via MacOS’s software update - To enable the
zathura-pdf-popplerplugin, run
mkdir -p $(brew --prefix zathura)/lib/zathura
ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib
-
brew install mactex-no-gui- You need some sort of TeX compiler for VimTeX to work. This is the one I installed
-
Install vim-plug. Add the
call plug#begin(~/.vim/plugged')andcall plug#end()lines to your.vimrcas recommended in the README -
Install VimTeX using
vim-plugas your plugin manager. Here’s my.vimrccode:
Plug 'lervag/vimtex'
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
set conceallevel=1
let g:tex_conceal='abdmg'
- Reload
.vimrcand run:PlugInstallinvimto perform installation
At this point, you should be able to edit a .tex file with vim and see zathura display the compiled PDF every time you save the file. You may have to type \ll to get the continuous TeX compiler to start up the first time you open the file.
Bonus: Snippets and TeX conceal
- Install UltiSnips by adding this to your
.vimrc
Plug 'sirver/ultisnips'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
- Install tex-conceal by adding this to your
.vimrc
Plug 'KeitaNakamura/tex-conceal.vim'
set conceallevel=1
let g:tex_conceal='abdmg'
hi Conceal ctermbg=none
- Add
UltiSnipssnippets to your heart’s content in your~/.vim/UltiSnips/tex.snippetsfile. I used this guide to learn about and develop snippets that I use.