2016-03-27 16:59:28 -04:00
|
|
|
# vimtex
|
2015-02-22 12:44:01 -05:00
|
|
|
|
2016-04-14 16:53:35 -04:00
|
|
|
vimtex is a [Vim](http://www.vim.org/) plugin that provides support for writing
|
|
|
|
LaTeX documents. It is based on
|
|
|
|
[LaTeX-Box](https://github.com/LaTeX-Box-Team/LaTeX-Box) and it shares a
|
|
|
|
similar goal: to provide a simple and lightweight LaTeX plugin. It has been
|
|
|
|
rewritten from scratch to provide a more modern and modular code base. See
|
|
|
|
[here](#alternatives) for some more comments on the difference between vimtex
|
|
|
|
and other LaTeX plugins for Vim.
|
2015-03-22 09:44:41 -04:00
|
|
|
|
2016-03-27 16:59:28 -04:00
|
|
|
[![Build Status](https://travis-ci.org/lervag/vimtex.svg?branch=master)](https://travis-ci.org/lervag/vimtex)
|
2016-07-15 18:17:32 -04:00
|
|
|
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5N4MFVXN7U8NW)
|
2016-07-15 18:00:46 -04:00
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
## Features
|
|
|
|
|
|
|
|
Below is a list of features offered by vimtex. The features are accessible as
|
|
|
|
both commands and mappings. The mappings generally start with
|
|
|
|
`<localleader>l`, but if desired one can disable default mappings to define
|
|
|
|
custom mappings. All features are enabled by default, but each feature may be
|
|
|
|
disabled if desired.
|
|
|
|
|
2015-03-23 14:20:09 -04:00
|
|
|
- Document compilation with
|
2015-03-22 09:44:41 -04:00
|
|
|
[latexmk](http://users.phys.psu.edu/~collins/software/latexmk-jcc/)
|
2016-07-23 17:59:57 -04:00
|
|
|
- Compilation of selected part of document
|
2015-03-22 09:44:41 -04:00
|
|
|
- Support for several PDF viewers with forward search
|
|
|
|
- [MuPDF](http://www.mupdf.com/)
|
|
|
|
- [Zathura](https://pwmt.org/projects/zathura/)
|
|
|
|
- [Okular](https://okular.kde.org/)
|
|
|
|
- [qpdfview](https://launchpad.net/qpdfview)
|
|
|
|
- [SumatraPDF](http://www.sumatrapdfreader.org/free-pdf-reader.html)
|
|
|
|
- Other viewers are supported through a general interface
|
2016-01-04 07:05:25 -05:00
|
|
|
- Completion of citations, labels, and file names for figures
|
2015-03-22 09:53:25 -04:00
|
|
|
- Document navigation through
|
|
|
|
- table of content
|
|
|
|
- table of labels
|
2015-05-10 05:00:31 -04:00
|
|
|
- Word count (through `texcount`)
|
2015-03-22 09:44:41 -04:00
|
|
|
- Motions
|
2015-03-22 09:53:25 -04:00
|
|
|
- Move between sections with `[[`, `[]`, `][`, `]]`
|
2015-03-23 14:20:09 -04:00
|
|
|
- Move between matching delimiters with `%`
|
2015-03-22 09:44:41 -04:00
|
|
|
- Text objects
|
2016-02-13 05:39:18 -05:00
|
|
|
- `ic ac` Commands
|
|
|
|
- `id ad` Delimiters
|
2015-03-22 09:53:25 -04:00
|
|
|
- `ie ae` LaTeX environments
|
|
|
|
- `i$ a$` Inline math structures
|
|
|
|
- Other mappings
|
2016-02-13 16:48:32 -05:00
|
|
|
- Delete the surrounding command or environment with `dsc`/`dse`/`ds$`
|
|
|
|
- Change the surrounding command or environment with `csc`/`cse`/`cs$`
|
2015-03-22 09:53:25 -04:00
|
|
|
- Toggle starred environment with `tse`
|
|
|
|
- Toggle between e.g. `()` and `\left(\right)` with `tsd`
|
2016-02-06 14:21:27 -05:00
|
|
|
- Close the current environment/delimiter in insert mode with `]]`
|
2015-03-22 09:53:25 -04:00
|
|
|
- Insert new command with `<F7>`
|
2015-10-19 16:05:30 -04:00
|
|
|
- Convenient insert mode mappings for faster typing of e.g. maths
|
2015-10-19 14:58:14 -04:00
|
|
|
- Improved folding (`:h 'foldexpr'`)
|
|
|
|
- Improved indentation (`:h 'indentexpr'`)
|
2015-03-23 14:20:09 -04:00
|
|
|
- Improved syntax highlighting
|
|
|
|
- Highlight matching delimiters
|
|
|
|
- Support for `biblatex`/`natbib` package
|
|
|
|
- Support for `cleveref` package
|
|
|
|
- Support for `listings` package
|
2015-10-19 14:58:14 -04:00
|
|
|
- Support for `minted` package
|
2015-03-23 14:20:09 -04:00
|
|
|
- Support for `dot2tex` with nested syntax highlighting
|
2016-01-12 17:14:02 -05:00
|
|
|
- Support for multi-file project packages
|
|
|
|
- [import](http://ctan.uib.no/macros/latex/contrib/import/import.pdf)
|
2016-02-20 07:56:38 -05:00
|
|
|
- [subfiles](http://ctan.uib.no/macros/latex/contrib/subfiles/subfiles.pdf)
|
2015-03-22 09:44:41 -04:00
|
|
|
|
2016-02-20 07:56:38 -05:00
|
|
|
See the documentation for a thorough introduction to vimtex (e.g. `:h vimtex`).
|
2013-10-05 07:53:42 -04:00
|
|
|
|
|
|
|
## Installation
|
2015-02-22 12:44:01 -05:00
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
If you use [vim-plug](https://github.com/junegunn/vim-plug), then add the
|
|
|
|
following line to your `vimrc` file:
|
2013-10-05 07:53:42 -04:00
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
```vim
|
|
|
|
Plug 'lervag/vimtex'
|
|
|
|
```
|
2013-10-05 07:53:42 -04:00
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
Or use some other plugin manager:
|
|
|
|
- [vundle](https://github.com/gmarik/vundle)
|
|
|
|
- [neobundle](https://github.com/Shougo/neobundle.vim)
|
|
|
|
- [pathogen](https://github.com/tpope/vim-pathogen)
|
2013-10-05 07:53:42 -04:00
|
|
|
|
2016-09-29 17:19:36 -04:00
|
|
|
## Quick Start
|
|
|
|
|
|
|
|
The following is a simple guide for how to use vimtex. It only displays the
|
|
|
|
most basic features. Users are _strongly_ encouraged to read or at least skim
|
|
|
|
through the documentation to learn about the different features and
|
|
|
|
possibilities provided by vimtex (see
|
|
|
|
[here](https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt) or `:h
|
|
|
|
vimtex`).
|
|
|
|
|
|
|
|
1. Edit a document: `vim document.tex`
|
|
|
|
2. Start compiling the document with `\ll`
|
|
|
|
3. Open pdf viewer and/or do forward searching with `\lv`
|
|
|
|
4. Stop the running compilation with `\ll` (or `\lk`)
|
|
|
|
5. To parse the log file for errors and warnings, press `\le`
|
|
|
|
6. To clean auxiliary files, press `\lc` (or `\lC` to also clean the output
|
|
|
|
file)
|
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
## Alternatives
|
2013-10-05 07:53:42 -04:00
|
|
|
|
2016-04-14 16:53:35 -04:00
|
|
|
The following are some alternative LaTeX plugins for Vim:
|
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
- [LaTeX-Box](https://github.com/LaTeX-Box-Team/LaTeX-Box)
|
2016-04-14 16:53:35 -04:00
|
|
|
|
|
|
|
vimtex currently has most of the features of LaTeX-Box, as well as
|
|
|
|
some additional ones. See [here](#features) for a relatively complete list
|
|
|
|
of features.
|
|
|
|
|
|
|
|
One particular feature that LaTeX-Box has but vimtex misses, is the ability
|
|
|
|
to do single-shot compilation _with callback_. This functionality was
|
|
|
|
removed because it adds a lot of complexity for relatively little gain
|
|
|
|
(IMHO).
|
|
|
|
|
2016-07-11 17:50:48 -04:00
|
|
|
Note: LaTeX-Box is included with
|
|
|
|
[vim-polyglot](https://github.com/sheerun/vim-polyglot). Some users are not
|
|
|
|
quite aware of this and end up trying vimtex with LaTeX-Box enabled. This
|
|
|
|
will not work --- please disable LaTeX-Box first!
|
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
- [LaTeX-Suite](http://vim-latex.sourceforge.net)
|
2016-04-14 16:53:35 -04:00
|
|
|
|
|
|
|
The main difference between vimtex and LaTeX-Suite (aka vim-latex) is
|
|
|
|
probably that vimtex does not try to implement a full fledged IDE for LaTeX
|
|
|
|
inside Vim. E.g.:
|
|
|
|
|
|
|
|
- vimtex does not provide a full snippet feature, because this is better
|
|
|
|
handled by [UltiSnips](https://github.com/SirVer/ultisnips) or
|
|
|
|
[neosnippet](https://github.com/Shougo/neosnippet.vim) or similar snippet
|
|
|
|
engines.
|
|
|
|
- vimtex builds upon Vim principles: It provides text objects for
|
|
|
|
environments, inline math, it provides motions for sections and
|
|
|
|
paragraphs
|
|
|
|
- vimtex uses `latexmk` for compilation with a callback feature to get
|
|
|
|
instant feedback on compilation errors
|
|
|
|
- vimtex is very modular: if you don't like a feature, you can turn it off.
|
|
|
|
|
2015-03-22 09:44:41 -04:00
|
|
|
- [AutomaticTexPlugin](http://atp-vim.sourceforge.net)
|
|
|
|
- [vim-latex-live-preview](https://github.com/xuhdev/vim-latex-live-preview)
|
2013-10-05 07:53:42 -04:00
|
|
|
|
2016-04-14 16:58:31 -04:00
|
|
|
For more alternatives and more information and discussions regarding LaTeX
|
|
|
|
plugins for Vim, see:
|
|
|
|
|
|
|
|
- [What are the differences between LaTeX
|
|
|
|
plugins](http://vi.stackexchange.com/questions/2047/what-are-the-differences-between-latex-plugins)
|
|
|
|
- [List of LaTeX editors (not only
|
|
|
|
Vim)](https://tex.stackexchange.com/questions/339/latex-editors-ides)
|
|
|
|
|