Professional LaTeX environment in Neovim - Complete LaTeX editing with live preview, smart compilation, and powerful shortcuts.
VimTeX transforms Neovim into a powerful LaTeX editor with features that rival dedicated LaTeX IDEs. This configuration provides:
ic/ac for commands, ie/ae for environments| Key | Action | Description |
|---|---|---|
<leader>ll |
Toggle continuous compilation | Start/stop auto-compile on save |
<leader>lL |
Compile once | Single compilation run |
<leader>lc |
Compile selection | Compile selected text only |
<leader>ls |
Stop compilation | Stop current compilation |
<leader>lS |
Stop all | Stop all VimTeX processes |
<leader>le |
Show errors | Open quickfix with errors |
<leader>lo |
View compiler output | Full compilation log |
| Key | Action | Description |
|---|---|---|
<leader>lv |
View PDF | Open PDF in configured viewer |
<leader>lr |
Reverse search | Jump to current location in PDF |
<leader>lt |
Table of contents | Show document structure |
<leader>lT |
Toggle TOC | Open/close TOC window |
| Key | Action | Description |
|---|---|---|
<leader>lk |
Clean auxiliary files | Remove .aux, .log, .out, etc. |
<leader>lK |
Clean all outputs | Remove all generated files including PDF |
<leader>lR |
Reload VimTeX | Reload plugin configuration |
<leader>la |
Context menu | Show available VimTeX actions |
| Key | Action | Description |
|---|---|---|
]] |
Next section | Jump to next \section |
[[ |
Previous section | Jump to previous \section |
][ |
Next section end | Jump to end of current section |
[] |
Previous section end | Jump to beginning of section |
]m |
Next environment | Jump to next \begin |
[m |
Previous environment | Jump to previous \begin |
]M |
Next environment end | Jump to next \end |
[M |
Previous environment end | Jump to previous \end |
% |
Matching delimiter | Jump between \begin/\end or brackets |
Select text first, then apply formatting:
| Key | Command | Result |
|---|---|---|
<leader>lb |
\textbf{} |
Bold text |
<leader>li |
\textit{} |
Italic text |
<leader>lu |
\underline{} |
Underlined text |
<leader>lf |
\texttt{} |
Monospace text |
<leader>le |
\emph{} |
Emphasized text |
<leader>lsc |
\textsc{} |
Small caps |
<leader>lM |
\[ ... \] |
Display math mode |
<leader>l$ |
$ ... $ |
Inline math mode |
Tip: These commands wrap selected text. In normal mode, they create empty commands with cursor inside.
| Key | Inserts | LaTeX Command |
|---|---|---|
<leader>lsc |
Chapter | \chapter{} |
<leader>lss |
Section | \section{} |
<leader>lsS |
Subsection | \subsection{} |
<leader>lsp |
Paragraph | \paragraph{} |
| Key | Inserts | Description |
|---|---|---|
<leader>lrl |
\label{} |
Create label at cursor |
<leader>lrr |
\ref{} |
Reference to label |
<leader>lrp |
\pageref{} |
Page reference |
<leader>lrc |
\cite{} |
Bibliography citation |
<leader>lrC |
\citep{} |
Parenthetical citation |
<leader>lrt |
\citet{} |
Textual citation |
Smart completion: After typing \ref{ or \cite{, press <C-x><C-o> for suggestions.
| Key | Environment | Structure |
|---|---|---|
<leader>lff |
Figure | \begin{figure} with caption and label |
<leader>lft |
Table | \begin{table} with tabular |
<leader>lei |
Itemize | Bullet list environment |
<leader>len |
Enumerate | Numbered list environment |
<leader>led |
Description | Description list |
<leader>leq |
Equation | Numbered equation |
<leader>lea |
Align | Multi-line aligned equations |
<leader>lem |
Matrix | Matrix environment |
<leader>lep |
Proof | Proof environment |
Quick surround: Use yse to surround selection with environment.
| Object | Description | Example |
|---|---|---|
ic/ac |
Inside/around command | ci$ changes math content |
id/ad |
Inside/around delimiter | di) deletes inside parens |
ie/ae |
Inside/around environment | vie selects environment content |
i$/a$ |
Inside/around math | da$ deletes inline math |
iP/aP |
Inside/around section | vaP selects entire section |
| Motion | Description |
|---|---|
% |
Jump between matching delimiters |
]/[ + m |
Next/previous environment |
]/[ + / |
Next/previous comment |
]/[ + * |
Next/previous section |
Main file detection: VimTeX automatically detects the main .tex file:
.latexmain file\documentclass in current/parent directories% !TEX root = main.tex directiveProject structure:
project/
βββ main.tex % Main document
βββ chapters/
β βββ intro.tex
β βββ methods.tex
βββ figures/
βββ references.bib
Quick compile current paragraph:
vip<leader>lc " Select paragraph and compile
Change compiler on the fly:
:VimtexCompilerSelected latexmk
:VimtexCompilerSelected tectonic
:VimtexCompilerSelected arara
Navigate errors:
]e - Next error[e - Previous error<leader>le - Open error windowCommon fixes:
\usepackage{} statements.bib file existsWhen you open a .tex file, VimTeX automatically configures:
| Setting | Value | Purpose |
|---|---|---|
textwidth |
80 | Automatic line breaking |
wrap |
On | Visual line wrapping |
spell |
On | Spell checking (en_us) |
conceallevel |
2 | Math symbols as Unicode |
indentexpr |
VimTeX | Smart LaTeX indentation |
foldmethod |
expr | Section-based folding |
.tex filesAdd to your config to customize:
-- Change compiler
vim.g.vimtex_compiler_method = 'tectonic' -- Faster alternative
-- Disable concealment
vim.g.vimtex_syntax_conceal_disable = 1
-- Custom PDF viewer
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_view_general_viewer = 'okular'
# 1. Create new document
nvim report.tex
# 2. Use snippet for boilerplate
doc<Tab> # Expands full document template
# 3. Start live compilation
<leader>ll
# 4. Open PDF viewer
<leader>lv
# 5. Write with live preview
# PDF updates automatically on save
# Structure
paper/
βββ main.tex
βββ abstract.tex
βββ introduction.tex
βββ methodology.tex
βββ results.tex
βββ references.bib
βββ figures/
# In main.tex
\input{abstract}
\input{introduction}
# etc.
# Compile from any file
<leader>ll # VimTeX finds main.tex automatically
% Use beamer snippets
frame<Tab> % New slide
block<Tab> % Content block
columns<Tab> % Two-column layout
% Preview slides
<leader>lv % Opens PDF
<leader>lr % Jump to current slide
" Quick math entry
eq<Tab> " Equation environment
align<Tab> " Aligned equations
" In insert mode
^^ " Superscript
__ " Subscript
// " Fraction
" Unicode preview
:VimtexToggleConceal " Toggle math symbols
cie to change environment content saves time<leader>ll once per session<leader>lr to check formatting without scrolling PDF]e/[e to jump between errors quicklyfigures/references.bib file% !TEX rootsrc/editorconfig| Problem | Solution |
|---|---|
| PDF not updating | Check <leader>le for errors |
| Slow compilation | Disable continuous mode, compile manually |
| Missing references | Compile twice or use latexmk |
| Font issues | Install texlive-fonts-extra |
| Unicode errors | Ensure \usepackage[utf8]{inputenc} |
VimTeX works seamlessly with our LaTeX snippets:
fig<Tab> for figure environmenteq<Tab> for equationsec<Tab> for sectionSkim not syncing (macOS):
# Enable Skim sync
defaults write -app Skim SKTeXEditorCommand "nvim"
defaults write -app Skim SKTeXEditorArguments "--headless -c 'VimtexInverseSearch %line %file'"
Zathura not found (Linux):
sudo apt install zathura zathura-pdf-poppler
latexmk not found:
# macOS
brew install texlive
# Linux
sudo apt install texlive-full
# Minimal installation
sudo apt install texlive-base texlive-latex-extra latexmk
Shell escape not working:
" Add to your LaTeX file
% !TEX options = --shell-escape
Slow on large documents:
" Disable syntax concealment
:VimtexToggleConceal
" Disable continuous compilation
<leader>ls
" Compile specific sections only
vip<leader>lc
Remember: VimTeX makes LaTeX editing efficient and enjoyable. Take time to learn the keybindings and text objects - theyβll become second nature and dramatically speed up your LaTeX workflow!