vimtex
AGENTS.md6.4k starsChanged 5 years agoMITView on GitHub
VimTeX is a filetype plugin for Vim/Neovim providing LaTeX (and BibTeX) support: compilation, PDF viewing, completion, syntax, folding, motions, text objects, TOC, quickfix parsing. Bulk of the code is Vimscript under autoload/; a small and growing part is Lua under lua/vimtex/. Requires recent Vim / Neovim (see README "Requirements" for specific version requirements); CI tests both. - Never commit unless asked. Leave changes in the working tree; the maintainer writes the commits. The same goes for pushing, tagging, and opening…
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Never commit unless asked: Leave changes in the working tree.
- Very specific: line 54
Test scripts start with set nocompatible / let &rtp = '../..,' .
- Very specific: line 107
When adding a backend, copy the _template.vim where one exists and keep the interface identical — the dispatcher calls it by constructed …
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to AI code agents when working with code in this repository.
What this is
VimTeX is a filetype plugin for Vim/Neovim providing LaTeX (and BibTeX) support:
compilation, PDF viewing, completion, syntax, folding, motions, text objects,
TOC, quickfix parsing. Bulk of the code is Vimscript under autoload/; a small
and growing part is Lua under lua/vimtex/.
Requires recent Vim / Neovim (see README "Requirements" for specific version requirements); CI tests both.
Working agreements
- Never commit unless asked. Leave changes in the working tree; the maintainer writes the commits. The same goes for pushing, tagging, and opening pull requests.
- Never reply to GitHub issues, discussions, or pull request threads unless asked. Reading them for context is fine; posting is not.
- Write tests early, but run them late. Writing the test first is usually the right first step: for a bug, a failing test that reproduces it; for a feature, a test that exercises the intended API, since that is the best way to see how the code will feel to use in practice. What should not happen is running the suite after every individual change — that interrupts the flow of thought. Work through the design and implementation, then run the tests as a final stage.
Tests
Tests are Makefile-driven Vim scripts. They live in test/test-*/ and are plain
.vim files run with a clean editor via -u.
make # run everything (as CI does, with -j1)
make test-toc # run one test directory
make test/test-toc/test-general # run one test file (test-general.vim)
MYVIM="vim -T dumb --not-a-term -n" make # run with vanilla vim instead of nvim- The root
Makefileis a thin wrapper that forwards totest/Makefile; the same targets work from withintest/(cd test && make test-toc) and viamake -C test .... MYVIMdefaults tonvim --clean --headless.- The subdirectory Makefiles export
INMAKE=1. Most test scripts containif empty($INMAKE) | finish | endifso that runningnvim -u test-foo.vimby hand drops you into an interactive session with the fixture loaded, whilemakeruns the assertions. - Assertions use Vim's
assert_*functions plus helpers inautoload/vimtex/test.vim(vimtex#test#finished()— must be the last call, it printsv:errorsandcquits on failure; also#completion(),#keys(),#main()). - Test scripts start with
set nocompatible/let &rtp = '../..,' . &rtp/filetype plugin onto load the working tree copy of VimTeX. - Some tests need
latexmk/TeX Live,wget, andchronic(moreutils).docker/Dockerfilereproduces the CI environment. test/example-*are manual playground setups,test/issues/NNNNare issue-specific reproductions,test/perf-*and*-speed/*-timingare benchmarks (the timing ones are ordered last bytest/Makefile).
Docs site
mise run web-build / mise run web-host build and serve the site (Hugo
landing page from README.md + doc/vimtex.txt rendered by Neovim's
gen_help_html.lua); see web/scripts/build.sh.
Architecture
Entry points. ftplugin/tex.vim and ftplugin/bib.vim call
vimtex#init(). syntax/tex.vim and indent/tex.vim are separate entry points
(they are not loaded via vimtex#init()). after/ftplugin/tex.vim checks for
conflicts with other plugins. plugin/vimtex.vim defines only what must be
global (notably :VimtexInverseSearch) — this is why VimTeX must not be lazy
loaded by a plugin manager.
Module auto-discovery. autoload/vimtex.vim globs autoload/vimtex/*.vim
into s:modules and calls vimtex#<mod>#init_buffer() for each, ignoring
E117 when the function doesn't exist. So a new submodule is wired up simply by
creating the file and optionally defining:
vimtex#<mod>#init_buffer()— buffer-local mappings, commands, autocommandsvimtex#<mod>#init_state(state)— add data to the project state
State. autoload/vimtex/state.vim maps a buffer to a project state object
(b:vimtex, id in b:vimtex_id), created by
vimtex#state#class#new() in state/class.vim. One state per LaTeX project
(main file), shared across all buffers of a multi-file project; sub-files may
additionally get a "local" state (vimtex#state#init_local()). Cleanup happens
on BufWipeout and VimLeave.
Backend dispatch. Several subsystems pick an implementation by option and call into a per-backend file with a uniform interface:
| Subsystem | Dispatcher | Backends |
| compile | compiler.vim | compiler/{latexmk,tectonic,arara,latexrun,texpresso,generic}.vim (#init() returns a state object; _template.vim is the base) |
| view | view.vim | view/{zathura,mupdf,sioyek,skim,general,...}.vim (#new() returns an object with .view()) |
| quickfix | qf.vim | qf/{latexlog,pulp,bibtex,biblatex,pplatex}.vim |
| fold | fold.vim | fold/*.vim, one file per fold type |
| completion | complete.vim | context-dependent completers; complete/<pkg> are keyword lists, complete/tools maps commands to unicode |
| context menu | context.vim | context/*.vim |
| text objects | text_obj.vim | text_obj/{targets,cmdtargets,envtargets}.vim |
| jobs / ui | jobs.vim, ui.vim | jobs/{vim,neovim}.vim, ui/{vim,nvim,legacy}.vim (editor abstraction) |
| parsing | parser.vim | parser/{tex,bib,toc,fls,auxiliary,fixme}.vim |
When adding a backend, copy the _template.vim where one exists and keep the
interface identical — the dispatcher calls it by constructed function name
(e.g. vimtex#view#{g:vimtex_view_method}#new()).
Options. All g:vimtex_* defaults are declared in one place,
autoload/vimtex/options.vim, via s:init_option(); that file also holds
deprecation checks and default highlight groups. A new option must be added
there and documented in doc/vimtex.txt.
Syntax. syntax/tex.vim is thin; rules live in
autoload/vimtex/syntax/core.vim with package-specific rules in
autoload/vimtex/syntax/p/<package>.vim (loaded on demand via
syntax/packages.vim) and syntax/nested.vim for embedded languages.
autoload/vimtex/syntax.vim is the query API used by the rest of the code
(e.g. vimtex#syntax#in_mathzone()) — not the rules themselves.
Other cross-cutting APIs used widely: delim.vim
(vimtex#delim#get_surrounding()), cmd.vim (vimtex#cmd#get_current()),
cache.vim (vimtex#cache#open/close, persistent under $XDG_CACHE_HOME/vimtex),
log.vim, pos.vim, util.vim, debug.vim.
DOCUMENTATION.md is the maintained high-level tour of this structure — update
it when the structure changes.
Conventions
Vimscript style (see CONTRIBUTING.md): shiftwidth=2, no tabs, max 80
columns, single-quoted strings, abort on functions, l: prefix on locals,
s: for script-local. Functions are folded with markers: each function ends
with a trailing " }}}1 line and the header ends with " {{{1. Keep related
functions grouped so the folded file reads as an outline.
Lua style: .stylua.toml — 80 columns, 2 spaces, double quotes preferred,
no parentheses on single-argument calls.
Vimscript linting: .vintrc.yaml configures vint.
Documentation: doc/vimtex.txt follows Vim help syntax — max 80 columns,
section separators of =, subsection separators of -, tags right-aligned at
column 79, and every section listed in the table of contents. Cross-reference
with help tags (|vimtex-foo|) rather than backticks; a |Foo| link resolves
even when the tag is defined as *:Foo*. Regenerate doc/tags with
:helptags doc when tags change.
Commits: conventional commits, parsed by cliff.toml for the changelog —
feat, fix, doc, perf, merge appear in the changelog; test and
chore are skipped. Scopes are used freely (e.g. feat(view): ...).
Development happens on master.
Trending
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about lervag/vimtex
- neovim/neovim“feat(lsp): add vim.lsp.server to create in-process server”GitHub · Jul 13, 2023 · 200 reactions
- hrsh7th/nvim-cmp“omni completion as a source”GitHub · Aug 30, 2021 · 7 reactions
- wbthomason/packer.nvim“Update fails with strange error”GitHub · Jan 11, 2022 · 6 reactions
- ahrm/sioyek“VimTeX "integration"”GitHub · Jul 24, 2021 · 4 reactions
- A Hacker News story“Vimtex v2.0 released (Vim filetype **and syntax** plugin for LaTeX)”Hacker News · Nov 24, 2020 · 4 points
The biggest 5 of 55 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 55
Talked about on GitHub, Bluesky, Stack Overflow and Hacker News (55 times).
On GitHub · 50
- Jul 13, 2023feat(lsp): add vim.lsp.server to create in-process server — neovim/neovim200 reactions · 16 comments
- Aug 30, 2021omni completion as a source — hrsh7th/nvim-cmp7 reactions · 4 comments
- Jan 11, 2022Update fails with strange error — wbthomason/packer.nvim6 reactions · 8 comments
- Jul 24, 2021VimTeX "integration" — ahrm/sioyek4 reactions · 14 comments
- Oct 20, 2026VimTeX: forward sync (`\lv`) is consistently **5** lines off — munepi/Galley2 reactions · 6 comments
45 more on GitHub
- Dec 7, 2020simplify check for math zone to make compatible with new vimtex syntax — gillescastel/latex-snippets2 reactions · 9 comments
- Aug 30, 2020[doc] How to understand <nowait> — vim/vim2 reactions · 4 comments
- Oct 8, 2025`--inverse-search` breaks `--nofocus` — ahrm/sioyek1 reaction · 5 comments
- Jun 15, 2025Colorscheme not applied when expected if a popup with blocking input is opened during init.vim — neovim/neovim1 reaction · 2 comments
- Apr 2, 2025feat: add GIFs for v2.16 tse and tss commands — lervag/vimtex-media1 reaction · 1 comment
- May 14, 2023Doesn't parse file name when parsing a (certain) log file generated by Tectonic — stefanhepp/pplatex1 reaction
- Apr 5, 2023Compile and watch (typst 0.1 new feature) — kaarmu/typst.vim1 reaction · 2 comments
- Mar 16, 2022Added LaTeX gitignore file — github/gitignore1 reaction · 6 comments
- Jan 25, 2022Error before Packcompile but work fine after Packcompile — wbthomason/packer.nvim1 reaction · 1 comment
- Feb 12, 2021Relax LaTeX environment matching — andymass/vim-matchup1 reaction · 5 comments
- Feb 9, 2021Sentence reformatter — scientific-python/specs1 reaction · 3 comments
- Oct 28, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `bd0788f` to `02eee26` — perrin4869/dotfiles0 reactions
- Oct 26, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `bd0788f` to `02eee26` — derekerdmann/dotfiles0 reactions
- Oct 21, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `98615ce` to `bd0788f` — perrin4869/dotfiles0 reactions
- Oct 19, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `77df167` to `bd0788f` — derekerdmann/dotfiles0 reactions
- Oct 14, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `16a5609` to `98615ce` — perrin4869/dotfiles0 reactions · 1 comment
- Oct 13, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `bbfa150` to `77df167` — derekerdmann/dotfiles0 reactions
- Oct 11, 2026chore(deps): bump the vim-plugins group with 8 updates — mb6ockatf/dotfiles0 reactions · 1 comment
- Oct 7, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `16a5609` to `bbfa150` — perrin4869/dotfiles0 reactions · 1 comment
- Oct 5, 2026build(deps): bump vimtex from `16a5609` to `bbfa150` in /plugins — josh/lazy-nvim-nix0 reactions
- Oct 5, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `d46ae11` to `bbfa150` — derekerdmann/dotfiles0 reactions
- Sep 30, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `42dcf16` to `16a5609` — perrin4869/dotfiles0 reactions
- Sep 29, 2026build(deps): bump vimtex from `42dcf16` to `16a5609` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 28, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `819b98b` to `d46ae11` — derekerdmann/dotfiles0 reactions
- Sep 23, 2026build(deps): bump vimtex from `819b98b` to `42dcf16` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 23, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `45a5a56` to `42dcf16` — perrin4869/dotfiles0 reactions
- Sep 21, 2026build(deps): bump vimtex from `06d31c8` to `819b98b` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 21, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `45a5a56` to `819b98b` — derekerdmann/dotfiles0 reactions
- Sep 18, 2026build(deps): bump vimtex from `45a5a56` to `06d31c8` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 16, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `e355987` to `45a5a56` — perrin4869/dotfiles0 reactions
- Sep 14, 2026build(deps): bump vimtex from `e355987` to `45a5a56` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 14, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `77bba91` to `45a5a56` — derekerdmann/dotfiles0 reactions
- Sep 9, 2026build(deps): bump vimtex from `b5ea577` to `e355987` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 9, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `cb81778` to `e355987` — perrin4869/dotfiles0 reactions
- Sep 8, 2026build(deps): bump vimtex from `cb81778` to `b5ea577` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 7, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `c1b9660` to `77bba91` — derekerdmann/dotfiles0 reactions
- Sep 2, 2026build(deps): bump vimtex from `c1b9660` to `cb81778` in /plugins — josh/lazy-nvim-nix0 reactions
- Sep 2, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `c1b9660` to `cb81778` — perrin4869/dotfiles0 reactions
- Aug 31, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `2f27977` to `c1b9660` — derekerdmann/dotfiles0 reactions
- Aug 26, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `b652447` to `c1b9660` — perrin4869/dotfiles0 reactions
- Aug 24, 2026build(deps): bump vimtex from `b652447` to `2f27977` in /plugins — josh/lazy-nvim-nix0 reactions
- Aug 24, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `65e9e9a` to `2f27977` — derekerdmann/dotfiles0 reactions
- Aug 19, 2026chore(deps): bump home/.vim/pack/default/start/vimtex from `a5568d9` to `b652447` — perrin4869/dotfiles0 reactions
- Aug 17, 2026build(deps): bump vimtex from `a5568d9` to `65e9e9a` in /plugins — josh/lazy-nvim-nix0 reactions
- Aug 17, 2026plugins: bump vimfiles/pack/plugins/start/vimtex from `853eb58` to `65e9e9a` — derekerdmann/dotfiles0 reactions
On Bluesky · 2
- Apr 9, 2025vim + vimtex (github.com/lervag/vimtex) + sioyek (sioyek.info) Not sure how good sioyek is on mac. — @francois.dupressoir.eu3 likes and reposts
- Oct 10, 2025Have you tried using vimtex? It’s been a game changer for me. I can use nvim and have it recompile every time I save. — @openwheel.racing1 likes and repost · 1 reply
On Stack Overflow · 2
- Jul 24, 2021Mapping <C-j> in Vim for non-tex files, with Latex-Suite installed1 vote
- Jul 8, 2020Vim - LaTeX. How to conditionally open the PDF viewer?0 votes
On Hacker News · 1
- Nov 24, 2020Vimtex v2.0 released (Vim filetype **and syntax** plugin for LaTeX)4 points
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

