Tag Info

37

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, since I am developing it myself: vimtex. Thus, I will mostly write about vimtex. However, I will first point out some references that might be of interest to ...

15

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-plug is getting pretty popular). Why waste your time installing vimtex? Great question! Features Continuous compilation using latexmk (please and thank you!) ...

13

I can't do comparison, as Vim-LaTeX is the only LaTeX plugin I've used. I have been using Vim-LaTeX for almost a year. So I will talk about Vim-LaTeX alone. There are many features present in Vim-LaTeX. I don't remember all of them. I'll just talk about features that I know and use constantly. Note: These are my limited user experience, which may be very ...

11

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 actually LaTeX, so 'filetype' was set to tex. The required command to prefer LaTex when there isn't enough information is let g:tex_flavor = "latex" Note, that'...

10

I don't know LaTeX but this seems to work: vnoremap iq :<C-U>silent! normal! t'vT<CR> omap iq :normal viq<CR> I based this off the information over here: http://vim.wikia.com/wiki/Creating_new_text_objects You can add support for aq as well: vnoremap aq :<C-U>silent! normal! f'vF<CR> omap aq :normal vaq<CR>

10

To expand commands in LaTeX, I use a dictionary copied from latex-suite (in details, this one) and put it in ~/.vim/dictionaries and then using autocmd FileType * exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>')) set completeopt=menuone,longest,preview set complete+=k Idea from here. I use it with supertab; the dictionary ... 9 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:vimtex_fold_manual which if enabled (set to nonzero value) will set foldmethod=manual, and instead will remap zx and zX to recalculate the folds when necessary (... 7 Edit: I just discovered the vim-textobject-latex plugin, which adds the exact functionality you're looking for (in addition to a few other things). From the plugin's README: Currently supported text objects are: a i Description a\\ i\\ Inline math surrounded by \$$ and \$$. a$ i$Inline math surrounded by dollar signs. aq iq Single-quoted ... 7 % 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 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. See :h vimtex-faq-surround: *vimtex-faq-surround* Q: |vimtex| provides dse, dsc, cse, and csc. ... 7 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 standard input instead of using the terminal device. The password must be followed by a newline character. Then your function could look like: function! ... 7 You are looking for set iskeyword-=: That is, making : explicitly not a keyword character. If : is in iskeyword it will be included in ciw. 7 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:tex_conceal. For direct control of the conceal feature itself, see :help conceallevel, :help concealcursor and :help syn-conceal. Short answer, you can put the ... 7 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 to by submatch(1) and submatch(2) respectively. We use the replace expression \= and execute('let') idiom. Finally, use /n to prevent substitution from ... 6 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) vimtex/autoload/vimtex/motion.vim:303 (s:highlight_matching_pair) These functions are run by autocommands whenever the cursor is moved, see here (LaTeX-Box) and ... 5 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 precise, you can use either of the following lines in your vimrc file: let g:tex_conceal = '' set conceallevel = 0 I propose that you read :h conceallevel before ... 5 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+=: This enables (no more than) the following: if you write c:blah somewhere, c: followed by Ctrl-p (or Ctrl-n) is able to later offer it for autocompletion. 5 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 functionality, then the rewrap command becomes: gqie or gwie (to maintain cursor position). If you only want to reformat text from current text position (I see ... 5 Perhaps like this: let s:TeXmaps = { \ 'a': '\alpha', \ 'b': '\beta', \ '->': '\to', \ '=>': '\Rightarrow' } function! <SID>IsTeXMath() return &ft ==# 'tex' && match(map( synstack(line('.'), col('.')), 'synIDattr(v:val, "name")' ), '\m^texMathZone[EX]$') >= 0 endfunction for s:k in keys(s:TeXmaps) ...

5

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 available for customization: g:tex_indent_brace: Toggle smartindent-like style for {} and []. g:tex_indent_items: Indent continuation lines after \items. g:... 5 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 rule for tex command arguments allows spell checking. Some commands, e.g. \include{...}, are not spell checked. This is controlled by the @Spell and @NoSpell ... 5 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 compiling. Instead, you should use latexmk. This is a very good automatic compilation tool for LaTeX, which will compile as many times as necessary, including ... 5 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} \begin{itemize} \item Here is an equation: \begin{align*} x = y \end{align*} \item Here is another item \end{itemize} \end{... 5 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> function! s:compile_latex() abort write if expand("%") == "body.tex" !arara -v "main.tex" else !arara '-v %' endif endfunction N.B. The :execute ... 5 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 fix_indent(snip): vim.eval('feedkeys("\<c-f>")') endglobal post_expand "fix_indent(snip)" snippet it "Individual item" b \item0 endsnippet

5

'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 value is indentexpr=GetTeXIndent(). Customize GetTeXIndent() The behavior of GetTeXIndent() can be customized by a few variables (e.g. g:tex_indent_brace or ...

5

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 problem is to execute the test inside a VimEnter autocommand, something like this: function s:init() " do your test here! endfun augroup custom_vimrc autocmd!...

5

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 system() to avoid prompting anything and then showing the result of the command by yourself. I did a test with the following mapping: nnoremap <silent> ...

4

While infuriating, a number of vim-latex's features can be customised without editing the source code. Disable the EEA mapping In .vim/after/ftplugin/tex.vim, add call IMAP('EEA', 'EEA', 'tex') Typing EEA in insert mode will no longer insert the eqnarray environment. F5 prompted environments In .vim/ftplugin/tex/texrc, add: let g:...

Only top voted, non community-wiki answers of a minimum length are eligible