红联Linux门户
Linux帮助

Ubuntu16.04如何把vim打造成为latex编辑器

发布时间:2017-04-13 14:59:33来源:linux网站作者:Nicholas_Wong
其实我也是第一次做这方面的尝试,以下是尝试的内容。
 
从网站下载(https://sourceforge.net/projects/vim-latex/files/)一个叫做“vim-latex”的插件。然后解压到“~/.vim”文件夹中。
 
在“~/.vimrc”中加入如下内容:
" 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':
let g:tex_flavor='latex'
 
在“~/.vim/ftplugin/tex.vim”文件中加入如下内容:
" this is mostly a matter of taste. but LaTeX looks good with just a bit
" of indentation.
set sw=2
" TIP: if you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:
 
打开vim,在命令模式下输入如下命令:
helptags ~/.vim/doc
 
本文永久更新地址:http://www.linuxdiyf.com/linux/29973.html