1. Suggested Prerequisites for Writing LaTeX in Vim

(This is part one in a seven-part series on efficiently writing LaTeX documents.)

This article covers prerequisite knowledge for following along with the series, and was last modified on 20 July 2023.

Unfortunately, some prerequisite knowledge is unavoidable here, and I cover suggested prerequisites below (but always with a suggestion or mini-tutorial for getting up to speed). I believe you should be comfortable with the material in this article to get the most out of this series.

Contents of this article

LaTeX knowledge

Prerequisite: you know what LaTeX is, have a working LaTeX distribution installed locally on your computer, and know how to use it, at least for creating basic documents. Among other things, this means you should have the pdflatex and latexmk programs installed on your system and available from a command line.

Suggestion (click arrow to expand)

Vim knowledge

Prerequisite: you know what Vim is, have a working local installation of Vim/Neovim (or gVim/MacVim) on your computer, and know how to use it, at least for basic text editing (for example at the level of vimtutor). At the risk of belaboring the obvious, this means you must have either the vim or nvim programs (or their GUI variants) installed and available on a command line.

Suggestion (click arrow to expand)
  • Installation: Vim should come installed on most of the Unix-based systems this series is written for. Unfortunately the official instructions for installing Vim aren’t particularly inviting to beginners; for installation I suggest using Homebrew on macOS or consulting your distribution’s package manager on Linux.

  • And here are the official instructions for installing Neovim (which are much friendlier to beginners than Vim’s instructions). If you are choosing between Vim and Neovim specifically for the purpose of this series, I encourage you to choose Neovim: connecting Neovim to your PDF reader will be easier because of Neovim’s implementation of the remote procedure call protocol.

  • To get started with Vim/Neovim, try the interactive Vim tutorial (usually called the “Vim tutor”) that ships with Vim. You access the Vim tutor differently depending on your choice of Vim and Neovim.

    • If you have Vim (or gVim or MacVim) installed: open a terminal emulator and enter vimtutor.
    • If you have Neovim installed: open Neovim by typing nvim in a terminal. Then, from inside Neovim, type :Tutor and press the Enter key to open the Vim tutor.

    After (or in place of) the Vim tutor, consider reading through Learn Vim the Smart Way.

Literacy in basic Vim/Neovim differences

Prerequisite: if you use Neovim, you should know how to navigate the small differences between Neovim and Vim, for example Neovim’s init.vim file replacing Vim’s vimrc or the user’s Neovim configuration files living at ~/.config/nvim as opposed Vim’s ~/.vim.

(Nontrivial differences, such as the server configuration required to set up inverse search with a PDF reader, are explained separately for both editors.)

Suggestion (click arrow to expand)
Read through Neovim’s :help vim-differences or read the equivalent online version.

Vim plugins

Prerequisite: you have installed Vim plugins before, have a preferred plugin installation method (e.g. Vim 8+/Neovim’s built-in plugin system, vim-plug, packer, etc…), and will know what to do when told to install a Vim plugin.

Suggestion (click arrow to expand)
  • For most users, I suggest using the well-regarded Vim-Plug plugin to manage your plugins (yes, this is a plugin that manages other plugins). The Vim-Plug GitHub page contains everything you need to get started.

  • If you prefer to manage your plugins manually, without third-party tools, use Vim/Neovim’s built-in plugin management system. The relevant documentation lives at :help packages but is unnecessarily complicated for a beginner’s purposes. When getting started with the built-in plugin system, it is enough to perform the following:

    1. Create the folder pack inside your root Vim configuration folder (i.e. create ~/.vim/pack/ if using Vim and ~/.config/nvim/pack/ if using Neovim).
    2. Inside pack/, create an arbitrary number of directories used to organize your plugins by category (e.g. create pack/global/, pack/file-specific/, etc.). These names can be anything you like and give you the freedom to organize your plugins as you see fit. You probably just want to start with one plugin directory, e.g. pack/plugins/, and create more if needed as you plugin collection grows.
    3. Inside each of the just-created organizational directories, create a directory named start/ (you will end up with e.g. pack/plugins/start/).
    4. Clone a plugin repository from GitHub into a start/ directory.

    Since that might sound abstract, an example shell session used to install the VimTeX, UltiSnips, and Vim-Dispatch plugins (all used later in this series) using Vim/Neovim’s built-in plugin system would look like this:

    # Change directories to the root Vim config directory
    cd ~/.vim         # for Vim
    cd ~/.config/nvim  # for Neovim
    # Create the required package directory structure
    mkdir -p pack/plugins/start
    cd pack/plugins/start
    # Clone the plugins' GitHub repos from inside `start/`
    git clone https://github.com/lervag/vimtex
    git clone https://github.com/SirVer/ultisnips
    git clone https://github.com/tpope/vim-dispatch

    For orientation, the resulting file structure would be:

    └── pack/
        └── plugins/
            └── start/
                ├── vimtex/
                ├── ultisnips/
                └── vim-dispatch/

    The VimTeX, UltiSnips, and Vim-Dispatch plugins would then automatically load whenever Vim starts up.

    If you install a plugin manually, its documentation will not be automatically available with Vim’s :help command. To generate the plugin documentation, first ensure the plugin has a doc directory, which is where documentation should be stored. If a plugin doc directory exists, you can generate its documentation with the Vim command:

    :helptags /path/to/plugin/doc

    You can also just use :helptags ALL to generate documentation for all plugins with a doc directory; see :help helptags for background.

Prerequisite: You should be comfortable using Vim/Neovim’s excellent built-in documentation, which you access with the :help command.

Quick crash course (click arrow to expand)

The Vim documentation is hyperlinked, and if you have syntax highlighting enabled, clickable hyperlinks to help chapters and sections should be clearly highlighted. The following two key combinations will help you navigate the Vim help files:

  • Press <Ctrl>] (i.e. the control key and the right square bracket) with your cursor over a highlighted documentation section to jump to that section.
  • Press <Ctrl>o (the control key and the lowercase o) to jump backward through your navigation history (e.g. to return to your original position before pressing <Ctrl>]).

For more information, read :help 01.1, which explains the basics of the Vim documentation, and :help notation, which explains the notation used in the Vim documentation.

Operating system

If you’re only interested in the snippet and VimTeX articles you can ignore this prerequisite; it applies mainly to PDF reader integration.

Prerequisite: To follow this series’s guides on PDF reader integration, you should be using Linux, macOS, or some other Unix variant.

Suggestion (click arrow to expand)

If you use Windows, I suggest you follow along with the series as is—aside from the PDF reader article, most of the series will be directly applicable and you should still find plenty of helpful techniques and ideas. But you will need to find another resource for PDF reader integration on Windows—I suggest the VimTeX documentation.

If you use some exotic flavor of Unix, I assume you know enough of what you are doing to adapt this series’s Linux-based suggestions to your platform.

Python 3 installation

This is relevant only if you plan on using UltiSnips for snippets. You can ignore this Python dependency if you plan on using Luasnip as a snippet plugin (described later in the series).

Prerequisite: If you’ll use UltiSnips for snippets, you need a working Python 3+ installation and access to pip/pip3 to install Python packages.

Suggestion (click arrow to expand)

I suggest installing Python using your distribution’s package manager on Linux and using Homebrew on macOS. Both of these options should give you a reliable, up-to-date version of Python that includes pip. If you discover that you have multiple, conflicting installations of Python on your system (this is risk on macOS in particular, which ships an outdated version by default), refer to one of the many guides on the Internet for cleaning up a Python 3 installation on your operating system.

In any case, you should end up with the python/python3 and pip/pip3 commands available from a command line.

Command line usage

Prerequisite: You are comfortable with the concept of calling simple command line programs from a terminal emulator, for example using pdflatex myfile.tex to compile the LaTeX file myfile.tex, using python3 myscript.py to run a Python script, or even something as simple as echo "Hello world!" to write text to standard output.

Suggestion (click arrow to expand)
I tentatively assume that someone interested in using a command line editor like Vim is already familiar with the command line. But in case you need practice, search YouTube or the wider Internet for one of the many guides on getting started with the command line.

Installing system packages

Prerequisite: you have a preferred method for installing new software onto your computer and know yow to use it.

Suggestion (click arrow to expand)
Use your distribution’s package manager on Linux and the Homebrew package manager on macOS.

Shell scripting abbreviations

Prerequisite: You are familiar with the more common abbreviations and macros used in shell scripting.

Quick crash course (click arrow to expand)

The abbreviations you should know for this series are:

  • ~ (the tilde) is shorthand for the home directory
  • . is shorthand for the current working directory
  • .. is shorthand for one directory above the current working directory
  • * is the match-all wildcard character used in glob patterns.

The abbreviations e.g. and i.e.

Prerequisite: You know what “e.g.” and “i.e.” mean—I will use both throughout this series. (While these abbreviations might be obvious to some people, they could very well be exotic to others, for example non-native English speakers or anyone previously unfamiliar with technical or academic writing.)

Quick crash course (click arrow to expand)
  • “e.g.” means “for example”; it is an abbreviation of the Latin phrase exemplī grātiā, which means “for the sake of an example”. For more information consult Wiktionary or the Internet.


    The VimTeX function vimtex#syntax#in_mathzone() returns 1 if the cursor is inside a LaTeX math zone (e.g. inside an equation environment or between inline math $ $ symbols) and 0 otherwise.

    Equivalent meaning, using “for example”:

    The VimTeX function vimtex#syntax#in_mathzone() returns 1 if the cursor is inside a LaTeX math zone (for example inside an equation environment or between inline math $ $ symbols) and 0 otherwise.

  • “i.e.” means “that is” and is usually used as a clarification of a previous statement; it is an abbreviation of the Latin phrase id est, which, surprise surprise, means “that is”. For more information consult Wiktionary or search the Internet.


    The VimTeX shortcuts [* and ]* let you move between the boundaries of LaTeX comments (i.e. any text beginning with %)

    Equivalent meaning, using “that is”:

    The VimTeX shortcuts [* and ]* let you move between the boundaries of LaTeX comments (that is any text beginning with %)

The original writing, images, and animations in this series are licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.