星期五, 十月 30, 2009

[Tools]用vim写latex的插件:Vim-latex

最近需要用到vim来写latex,所以就下了vim-latex这 个包来用。
开始时用的还不是很顺手,因为它的文档写得很差。
而且因为是小众软件,在google上也搜不到什么资料。

用了一个下午,有一些Tips。简单记录一下。
最主要的一条:Read the f**cking source code!
比如,在其晦涩难懂的User Manual里面说到:
These maps insert LaTeX sections such as: ... Example: SSE in insert mode inserts  \section{<++>}<++>
其实,就是在你输入"SSE"的时候自动帮你替换成"\section{<++>}<++>"。 vim-latex之所以好用,是因为它提供一系列快捷键来使你编辑LaTeX更方便。但是我一开始肯定是记不住这些所谓的快捷键的,而我又查不到网上有 快捷键列表之类的文档。等到真正写latex的时候,仍然不会去使用,这个让人很烦躁。
解决方法就是:读源代码。这里特指读一下vim的plugin里面的代码。
~/.vim/ftplugin/latex-suite$ grep --color -n -r --include=* --include=*.* ./* -e SSE ./envmacros.vim:256:call s:Tex_SectionMacros('SSE', 'section') ./texrc:423:"       SSE for section ./wizardfuncs.vim:333:\."\n SSE   ".g:Tex_Leader2."se   section" 
找一下envmacros.vim,就可以看到所有的 Macros:
" Sections {{{ call s:Tex_SectionMacros('SPA', 'part') call s:Tex_SectionMacros('SCH', 'chapter') call s:Tex_SectionMacros('SSE', 'section') call s:Tex_SectionMacros('SSS', 'subsection') call s:Tex_SectionMacros('SS2', 'subsubsection') call s:Tex_SectionMacros('SPG', 'paragraph') call s:Tex_SectionMacros('SSP', 'subparagraph') " }}}
Have fun!

1 条评论:

ashi 说...

really have fun~~