1. 程式人生 > >Vim-latex 插件 的安裝

Vim-latex 插件 的安裝

https and cto com important something 定義 ack 運行

ref:https://www.jianshu.com/p/ddd825064062


Vim-latex 插件

1. 安裝

Vim-latex 插件是一個強大的Latex插件, 它的安裝方法是:

將下面代碼放在~/.vimrc 中:

Plugin ‘vim-latex/vim-latex‘
" 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

" 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‘

註意, Plugin ‘vim-latex/vim-latex‘一定要在call vundle#begin()call vundle#end() 中間.

在 Vim中運行:

:source %
:PluginInstall

2. 配置: ~/.vim/ftplugin/tex.vim

這個文件以後就是你的用戶配置文件. 所有的 tex 文檔都會自動加載這裏的命令.
~/.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+=:

3. 安裝和插入模板

當新建一個空白的tex文本之後, 可以運行:TTemplate來插入一個模板. 之後, 就會有一個模板列表出現, 選中相應的數字就可以插入.

你也可以自行配置模板的庫文件. 比如, 在~/.vim/ftplugin/latex-suite/templates中, 可以存儲幾個 tex 文件, 這些文件都會出現在你的模板列表裏. 而且, 你還可以自行定義一下模板的存儲目錄, 比如, 在tex.vim中, 輸入

let g:Tex_CustomTemplateDirectory=‘你的模板目錄’

然後, 這個目錄下的所有文件, 也都將出現在模板列表中.



作者:李老師的好學生
鏈接:https://www.jianshu.com/p/ddd825064062
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權並註明出處。

Vim-latex 插件 的安裝