41
votes
What are the differences between LaTeX plugins?
I will not provide an in-depth comparison, as I only have limited experience with the different plugins. I know a couple of plugins well (LaTeX-Box and LaTeX-Suite), and I know one plugin very well, ...
16
votes
Accepted
How do I get Vim to compile my .tex file when executing :w?
Don't be so inefficient! Your time is valuable. Use the vimtex plugin offered by @lervag: see here. You can control all of the plugins you install by using Vundle or any similar plugin manager (vim-...
13
votes
Accepted
Filetype that LaTeX should be
When there's not enough information to decide otherwise, 'filetype' is set to the most basic -- plaintex. Your existing file must have had enough content for the detection to determine that it was ...
11
votes
Accepted
Why does vim still auto-indent LaTeX after I set noai noci nosi?
'indentexpr' has the highest priority of how vim can automatically indent lines.
:h 'indentexpr':
When this option is not empty, it overrules the 'cindent' and
'smartindent' indenting.
Your ...
10
votes
Accepted
Why does Vim highlight "in" in tex files and how can I stop it?
You can find out what syntax item applies by positioning the cursor and using something like:
:echo synIDattr(synID(line("."), col("."), 1), "name")
Because that's quite ...
9
votes
Accepted
Folding slow with vimtex
First: Did you bother to read the vimtex documentation, i.e. :h vimtex-folding? The docs clearly point out that the fold-expr method of folding is slow, and so therefore provides an option g:...
8
votes
Accepted
Unable to set iskeyword for colon ( : ) character
You are looking for
set iskeyword-=:
That is, making : explicitly not a keyword character. If : is in iskeyword it will be included in ciw.
8
votes
Accepted
How to force vimtex to display \textbf and \textit in insert/normal mode?
This is not due to vimtex directly, but due to the conceal feature in Vim. vimtex only adds to the syntax plugin that ships with Vim/neovim, and it adhers to the relevant option, see :help g:...
7
votes
Accepted
How can I make quick environment or command changes in LaTeX
If you use the vimtex plugin, you can:
Change an enclosing command using csc:
According to the help, a ysc corresponding to the commands offered by surround.vim isn't available, but can be added. ...
7
votes
Accepted
Call PDF viewer on the compiled tex file
% indeed stands for the current file. %:r (see :help filename-modifiers) strips off the file extension. You can then use :! to launch an external command, e.g. the PDF viewer:
:! zathura %:r.pdf
7
votes
Accepted
Use search matches as parameters in external command
To avoid leaving the buffer for entering the password, you can use sudo's -S flag:
-S, --stdin
Write the prompt to the standard error and read the password
from the ...
7
votes
Yank both sides of equation
This can be done with either regex+substitute or macros
Substitute. This is the same as your regex except the important parts are surrounded by \( . \) to create capture groups. These are referred ...
6
votes
Accepted
Make % jump between identical delimiters
What you ask is possible, but the solution is nontrivial. Both LaTeX-Box and vimtex has implemented solutions for this, see here:
LaTeX-Box/ftplugin/latex-box/motion.vim:57 (s:FindMatchingPair)
...
6
votes
Accepted
Why is my # mapping behaving oddly in TeX files?
This is probably because there's another multi-key mapping that starts with a #; this is added by the TeX-specific plugin you have and loaded only for those files. You can reproduce it with:
inoremap #...
5
votes
Accepted
change meaning of "paragraph" for TeX input?
One way to do it employs the ie (inside-environment) custom text object, available in a number of places: e.g. in the plugin vimtex, or with vim-textobj-latex (and there are others). With this ...
5
votes
Accepted
Context sensitive insert mode mapping or abbreviation
Perhaps like this:
let s:TeXmaps = {
\ '`a': '\alpha',
\ '`b': '\beta',
\ '->': '\to',
\ '=>': '\Rightarrow' }
function! <SID>IsTeXMath()
return &ft ==# 'tex' &...
5
votes
How can I fix the auto indentation in LaTeX?
The documentation for the indentation plugin for LaTeX is unfortunately not available in the help files, but it is written in the source code in $VIMRUNTIME/indent/tex.vim. The following variables are ...
5
votes
Accepted
How do I spellcheck TeX files using vim-lexical, skipping some command arguments but not others?
First: This is not related to vim-lexical. Syntax rules define where spell checking should be done, and so the current behaviour is defined by the internal syntax plugin for LaTeX.
The default syntax ...
5
votes
Accepted
Mathematical expressions in TeX files are displayed in a human-readable way
This functionality comes from the internal LaTeX plugin. See :h tex-conceal and :h g:tex_conceal. You can turn it off either by setting conceallevel=0 or by letting g:tex_conceal=''. To be more ...
5
votes
Accepted
Completion past special characters
If the chapter, section etc. labels are in the same file, or in any other open buffers, you can still use Ctrl-n/Ctrl-p. You just have to add : to the keyword characters, with:
:set iskeyword+=:
...
5
votes
Accepted
Compiling whole LaTeX projects
I would say that you are approaching this the wrong way. If you want to use a very minimalistic solution without any plugins, I would claim that you should not have anything in your vimrc file for ...
5
votes
Accepted
Indentation in Latex within a list after an equation
The reason this is happening is because the indentexpr [1] prefers text to be indented inside \items. You can see this by pressing gg=G. This is what it considers correct indenting:
\begin{document}...
5
votes
Accepted
Syntax highlighting of underscores in LaTeX, even though they only appear in filenames
This is happening because the syntax file for LaTeX does not recognize \subfile{ as a command which takes a file name. You can customize this as follows.
In your config directory (.vim, .config/...
5
votes
Syntax of :endif in if-statements
Rather than figuring out what's going on with your existing mappings, it's easier and more readable just to use a function, instead:
nnoremap <F5> :call <SID>compile_latex()<CR>
...
5
votes
Accepted
Trigger reindentation after snippet has expanded to word in 'indentkeys'
You can manually fix the indent by typing CTRL-F (this is documented at :help indentkeys-format). Thus, an autonomous solution would be to issue this key-press after snippet expansion.
global !p
def ...
5
votes
Accepted
Unable to conditionally test for presence of a plugin command & invoke it
The problem is, your vimrc file is executed before any plugins are loaded. You can check the order of what source files are loaded by issueing the :scriptnames command.
The usual way to fix this ...
5
votes
Accepted
Silence command but not its output
As Ben said in the comments prompting the command used before its result is a built-in behavior that you can not change without modifying Vim's source code.
However a possible workaround is to use :h ...
4
votes
Accepted
Fix syntax highlighting after unmatched parentheses
This is a very difficult problem. It is such a corner case of what people need, that I would not personally want to support it directly. Thus I also won't try to come with a direct answer to your ...
4
votes
How do I get Vim to compile my .tex file when executing :w?
If you use tpope's Dispatch plugin:
https://github.com/tpope/vim-dispatch you can run commands in the background.
I use this snippet to run xelatex on every save:
augroup latex
autocmd!
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
filetype-tex × 198plugin-vimtex × 32
plugin-vim-latex × 30
syntax-highlighting × 22
key-bindings × 20
plugin-ultisnips × 15
conceal × 14
vimrc × 12
autocmd × 11
vimscript × 10
neovim × 10
indentation × 9
filetype × 8
spell-checking × 8
wrapping × 8
autocompletion × 7
filetype-markdown × 7
snippets × 7
external-command × 6
formatting × 6
insert-mode × 5
abbreviations × 5
regular-expression × 4
cursor-motions × 4
folding × 4