I enjoy using Vim when I am writing LaTeX documents for my teaching and research. Since Neovim became available I have been using it as a — capable and compelling — alternative to Vim. I find that Neovim works really well and that its plugin ecosystem is great! But, if you want the vimtex plugin to work with Neovim, then you need to take two extra steps, as explained in this post.
What do you need to do to write LaTeX in Neovim? Well, when I was writing (Walsh, Kapfhammer, and McMinn 2017)
.vimrc file and install a plugin. After following the instructions to install the neovim-remote plugin, I added this code segment to ensure that
vimtex can communicate with the
latexmk process that is compiling my paper.
if has("nvim") let g:vimtex_latexmk_progname = 'nvr' endif
Wait! There is one more thing. If you, like me, have been using Vim for many years and only recently started to use Neovim, then you will also need to run commands like the following so that you can “retrofit” your Vim configuration to work correctly with Neovim. Or, you can re-write your Vim configuration in Lua!
ln -s ~/.vim ~/.nvim ln -s ~/.vimrc ~/.nvim/init.vim
Are you interested in learning more about how I configure Vim and Neovim? Please study the source code of my
.vimrc that is available in the GitHub repository gkapfham/dotfiles. With that said, since this post was written I’ve converted my Neovim configuration to use Lua and the lazy.nvim plugin manager. This means that you should study my
init.lua file instead!