You can spend lots of time getting vim setup to your liking, and probably never finish customizing. My suggestion is to start small and stick to the basics before going crazy with plugins. While I've included some plugins, the hope is that you can easily get started with LaTeX with a minimal of effort and/or Googling.
Here is a small section of some of the things I've figured out to have vim working for editing LaTeX files easily.
-
Copy the file below to a file
vimrc
and start vimvim -u vimrc
to use the file. After all your customization if you are happy then save your configuration to~/.vimrc
. -
You can then start vim and install the plugins using the command
:PlugInstall
-
Choose a colorscheme you like with
:colorscheme <tab>
to see all the options. Once you find one you like just put that command into thevimrc
-
Setting up vimtex to work with a PDF viewer is a little complicated but I have some of the details already included. You don't actually need anything extra to handle editing LaTeX documents.
In another terminal window just run latexmk -pdf -pvc article.tex
to have it continuosly compile your document. Then whenever you save your tex file, it'll compile. In fact, vimtex
is basically doing this from within vim.
On a Mac, the vimtex plugin seems to work best with Skim in my view. Note, there is some setup required to enable forward/backward search using synctex
.
- You use the escape key all the time in vim. So it's best to stick it someplace easily to access. I remap the
CapsLock
key toEscape
, since no one ever usesCapsLock
Add the following to your .bashrc or .zshrc file on Ubuntu
setxkbmap -option "caps:escape"
On Mac OSX you can look in the System Preferences > Keyboard > Modifier Keys (bottom of screen)
It trows an error each time a tex file is opened:
VimTex: Deprecated options(s) detected! - g:vintex_quickfix_latexlog
How could I get rid off it?