Hot answers tagged

29

I suppose you already have Vim installed in your operating system. Usually, the installation is very straightforward for every operating system. For Macs, we have MacVim, and AFAIK two options are available: Getting the correct MacVim version for your operating system in the project website, unzip the archive file and drag MacVim.app to your Applications ...


23

I would highly recommend the vim latex-suite, which you can get either from http://vim-latex.sourceforge.net/index.php?subject=manual&title=Manu or (on an Ubuntu machine) using sudo apt-get install vim-latexsuite sudo vim-addons -w install latex-suite It provides many shortcuts. If I were going to type your first summation \sum_{n=2}^{\infty}\left(...


23

Disclaimer: I usually edit .tex files in Vim, but I don't use the Vim-LaTeX suite. I wouldn't say the following suggestions are tricks per se - they are provided by third-party plugins - but they actually help me with my usual TeX workflow: snipMate Created by Michael Sanders From the manual: snipMate.vim aims to be an unobtrusive, concise vim script ...


21

The following hopefully answers your "abbreviated questions": vim suggests inserting \@ before . in ...GRIP/ABP. So, do it! The reason here is that GRIP/ABP or any capitalized word before a period is usually an abbreviation. And, in some instances, abbreviations have periods, while some don't. To treat the end-of-abbreviation period as an end-of-sentence ...


16

Sometime around 2017 (I think), Dr. Chip decided that base-vim should only support syntax highlighting for base-latex. It is necessary to add in support for syntax highlighting for things available in latex packages (such as amsmath, which is what provides the align environment). But this is very easy, and Dr. Chip includes syntax files for amsmath (and a ...


15

When using VimTeX, you can type ]] in insert mode to close the current environment.


14

Quick and dirty solution :syn match texStatement "\\[a-zA-Z_:]\+" or add @ :syn match texStatement "\\[a-zA-Z_:@]\+" It isn't enough, but looks much better. But better Modify $VIM/syntax/tex.vim, search b:tex_stylish, and modify all expressions about it.


12

Something that is pretty much as useful is to type nameofenvironment then F5 which gives \begin{nameofenvironment} \end{nameofenvironment}<++> and puts the cursor in the body of the environment. You can leave the environment easily by pressing CTRL J


11

there is an option for that, you just have to add let g:tex_comment_nospell=1 in your .vimrc. About the internals, this variable is used in the file /usr/share/vim/vim73/syntax/tex.vim in my installation. [Edit for older versions] Checking vim source tree in older versions, this variable appears from revision 1073, which is after vim 7.0 and 7.1. As ...


11

Recent versions of Vim have a new 'conceal text' function. The syntax highlighting file contains code to work with this feature. The conceal text function collapses a string of text into a single Unicode character. For example, it might visually substitute \beta with β. Vim provides substitutions for the following subscripts by default, replacing the ...


11

You could just write ó and tell latex which encoding you are using, such as \usepackage[utf8]{inputenc} you do not have to use the ascii markup for accents unless you want to.


11

Since you are using vim you can use :setlocal nobomb :wq see https://stackoverflow.com/questions/295472/how-do-i-remove-the-bom-character-from-my-xml-file


10

I have encountered the same problem as the OP, and I found that it is caused by the neosnippet configuration, which contains the folloing lines: " For snippet_complete marker. if has('conceal') set conceallevel=2 concealcursor=i endif The neosnippet plugin probably uses the 'conceal' feature of vim for some of its autocompletion functions. The solution ...


9

As morbusg mentioned, the surround plugin is the way to go. You select the text eg. using visual mode, then you press S and the closing brace }. You can use any character with a matching partner: ], >, ), etc. If you use the left part of the pair, it additionally surrounds the selected text with a space. Example: Computational Skills Learned: Assuming ...


9

There are no real standards, but here are some tips I’ve found handy: Don’t indent parts of a paragraph, but do break lines between sentences and after significant phrases within a sentence. As I posted at https://tex.stackexchange.com/a/64538/2966, this makes it easier for small edits to have small diffs. (You are using a VCS, aren’t you?) To exaggerate my ...


9

It has been saved as utf-16 and so every other byte is 0 (often displayed as ^@ as @ has code 64 so zero is control-@) The only thing I know about vim is that it isn't emacs but in chat my backup vim expert suggests :set fileencoding=utf-8 :set encoding=utf-8


9

If you run gnuplot <basename>-gnuplottex-fig1.gnuplot, you'll see gnuplot's error message plot for [i=1:14] 'benchmarks/test.csv' u (\$0+1):i title ''.i.'00 kb' with linespoints ^ "texse-gnuplottex-fig1.gnuplot", line 16: invalid character \ gnuplot is stumbling over the \$. You don't need to escape the ...


8

I usually type \", since in that context the " is not replaced by "smart quotes," and then delete the \. This is convenient enough for me, since I rarely need the " character, and I don't want to change Vim-LaTeX's default behavior.


8

SumatraPDF can be called with commandline options, see help manual. The option -reuse-instance will do the trick The final modification that made it works is this: let g:Tex_ViewRule_pdf = 'SumatraPDF -reuse-instance'


8

Side note for anyone who ends up here looking for the same thing I am: To disable specific IMAPs, add trivial IMAP commands to the file ~/.vim/after/ftplugin/tex.vim (you may have to create it if it does not exist). For instance, " Undo some latex-suite macros call IMAP('()', '()', 'tex') call IMAP('{}', '{}', 'tex') call IMAP('[]', '[]', 'tex') call IMAP(...


8

let g:Tex_GotoError=0 in your ~/.vimrc should do pretty much what you want.


8

\Copy probably isn't used as a document level command but then that is because it's not a good name for a document level command (according to the somewhat under-enforced LaTeX command naming guidelines). See Macro naming best practice? Other possibilities would be: emacs naming (clearly good:-) \kill and \yank (but some people may find that a bit ...


8

You can use this in your vimrc to quickly switch the compiler to xelatex with \lx. Then use \ll to compile. function SetXeTex() let g:Tex_CompileRule_pdf = 'xelatex -aux-directory=F:/Vim/my_latex_doc/temp --synctex=-1 -src-specials -interaction=nonstopmode $*' endfunction map <Leader>lx :<C-U>call SetXeTex()<CR> If you want to set ...


8

When TeX, in interactive mode, shows the ? prompt after an error, you have a few choices, but you should keep in mind that the first character you type determines the subsequent behavior: return means “ignore the error and proceed” s means “run showing future error messages without stopping except for requesting user input” r means “run showing future error ...


7

A quite long comment... I don't think your question is specific to Vim or any other editor. Whether you are given a code completion, auto-environment closing tool or not it is quite important to reduce the mental load while writing your code. A short-term loss can be a long-term benefit if you can spend extra seconds to write-up with a better indentation. I ...


7

I know it's against policy to answer commenting on other answers, but in this case -- given I lack the 50 reputation needed to comment directly on the relevant answer -- I think it's worth it. The function provided by Aditya functions perfectly for LaTeX, mutatis mutandis, except for one detail: often after beginning an environment, or a section, the very ...


7

The following solution only applies to paragraph formatting, it will properly work depending on the LaTeX styling settings. Another possible solution would be to set a hard wrap of 80 characters. http://vimcasts.org/episodes/hard-wrapping-text/ formatoptions: t - Auto-wrap text using textwidth c - Auto-wrap comments using textwidth, ...


7

I use the vim-latex suite, and absolutely love it. However, I've found the following tweaks quite useful to help me compile my documents. (These commands will be most useful to Linux users) I like to 'toggle' between seeing the compiler output and not. With the setup below, I simply press t which toggles between 'silent' and 'verbose' mode I like to be ...


7

If I understand your question correctly, you're having problems to get Alt-i working in the console version of vim, right? At least, with gvim it works as expected on my system. Some terminals send different character codes when using Alt key combinations so that vim is unable to recognize them properly. To fix this, it might help to enable the meta key ...


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