lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.51k stars 389 forks source link

Vimtex Quickstart on Win7 #1055

Closed rjiang9 closed 6 years ago

rjiang9 commented 6 years ago

This is not a post about any issue but notes on steps to get started for beginners like me.

Vimtex + Vim8 + vbundle + Mitex2.9 + Win7 + Git for windows

1) Install Vim8 and Miktex on Win7

2) Install vimtex through vbundle in VIM

- In `_vimrc`

    ```vim
    Plugin 'lervag/vimtex'
    ```

- In Vim, do `:PluginInstall`

Note: Do *NOT* use cygwin Git, use Git For Windows. Otherwise, installation may fail because cygwin GIT always use cygwin path which vbundle can't handle correctly. 

3) Set mapleader and maplocalleader in _vimrc:

```vim
let mapleader = ","
let maplocalleader = ","
```

4) Setup PDF viewer, either mupdf or sumatraPDF:

Download portable version and put it in a folder (folder name no space), e.g.

```
mupdf:       c:\Users\littledaniel\pdfviewer\MuPDF\
sumatrapdf:  c:\Users\littledaniel\pdfviewer\SumatraPDF\
```

5) Setup _vimrc settings for vimtex:

```vim
let g:tex_flavor='xelatex'

" either
let g:vimtex_view_general_viewer = $HOME .'\pdfviewer\muPDF\mupdf.exe'
" or
let g:vimtex_view_general_viewer = $HOME . '\pdfviewer\SumatraPDF\SumatraPDF.exe'

let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
let g:vimtex_view_general_options_latexmk = '--unique'
```

6) What if you use 'xelatex'?

In your HOME, create a hidden `.latexmkrc` and add one line:

```perl
$pdflatex = 'xelatex --shell-escape %O %S';
```

7) Good to go: In Vim, write your tex file, then start compilation with <localleader>ll (in this case ,ll).

lervag commented 6 years ago

Thanks. I took the liberty of updating it with better formatting and some minor updates. Note I removed the g:vimtex_latexmk_options setting, because that does not exist anymore. If you want the same functionality, please look into :h g:vimtex_compiler_latexmk and modify it accordingly.

rjiang9 commented 6 years ago

Thanks a lot Karl for this great plugin and spending time for reformatting my post. I appreciate it!

lervag commented 6 years ago

No problem, I'm happy you like it!