MacVim,vim-latex,Skim,synctex

本来在Linux里面Emacs+AucTex是我不二的选择, 但是在Mac平台上,当我试用了一大堆的TeX编辑器,包括TeXShop,Aquamacs,BBEdit,TextMate,… … 以后, 我最终还是回到了Vim的怀抱.

安装就不多说了,MacTeX,MacVim,Skim先安装好,需要注意的是要把mvim这个脚本放到某一个$PATH里可以搜索的目录,比如我是~/bin. 然后下载vim-latex,解压到~/.vim目录里面.下面详细说说配置的步骤.

1.现要配置好MacVim. 编辑自己的~/.vimrc文件,下面是我针对vim-latex的设置,每一行都有详细的说明.

" vim-latex setting goes here
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
" filetype plugin on

" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
" end of vim-latex setting
let g:tex_flavor='latex'

" Use Skim to view pdf files; also can do backward search
let g:Tex_CompileRule_pdf='pdflatex --interaction=nonstopmode --synctex=1 $*'
let g:Tex_ViewRule_pdf='Skim'
let g:tex_fold_enable=1

" Multiple runs on files with '\cite,\ref,\bibitem,etc'
let g:Tex_MultipleCompileFormats='pdf,dvi,ps'

2.设置缺省编译为pdf文件: 在Vim的”Tex-Suites”菜单里点击”Target-Format”,然后输入pdf.

3.然后要在Skim里面设置与Vim同步, 在Skim->Preference->Sync里面, Preset选择Custom,Command选mvim, Arguments选
--remote-silent +":%line;foldo!" "%file".

就这么简单!