让你的vim成为所见即所得的latex编辑器(伪:))

Vim、Emacs配置和使用
回复
头像
zhuqin_83
帖子: 10606
注册时间: 2006-05-13 4:02
联系:

让你的vim成为所见即所得的latex编辑器(伪:))

#1

帖子 zhuqin_83 » 2007-11-30 6:34

参见:http://ubuntuforums.org/showthread.php?t=615157

tex的安装总不用说了

代码: 全选

sudo apt-get install texlive
vim么,最好装一个vim-gnome,外加一个vim-latexsuite和vim-addon-manager。
顺便说一句,7.10下的vim-latexsuite是无法打开的,如果你仅仅安装了vim-latexsuite的话(bug)。所以需要另外加装vim-addon-manager,然后执行

代码: 全选

sudo vim-addons -w latex-suite
其他扩展也一样,其实不加sudo也行,只是仅对当前用户有效而已。

然后编辑~/.vimrc,把下面这段复制进去,保存即可。

代码: 全选

""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" for LaTeX files
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
au BufEnter *.tex set autowrite "Save before making PDF"
au BufEnter *.tex set updatetime=1000 "Wait 1000 milliseconds (change if you want to)"
au BufEnter *.tex set makeprg=pdflatex\ -halt-on-error\ %\ >/dev/null "make the pdf file, suppress output, don't do anything if there are errors"

"make the file after specified time of not moving and after every save"
au CursorHold *.tex call UpdateFile()
au BufWritePost *.tex call UpdateFile()

" update function
function! UpdateFile()
    silent make
        silent !evince -w %<.pdf>/dev/null &  "refresh the file in evince.  -w option keeps focus on vim console"
        redraw!       "remove artifacts during saves"
        endfunction

" run evince at runtime"
        au BufRead *.tex silent !evince %<.pdf>/dev/null &
这样,你每次修改tex文件后他都会自动编译生成pdf文档,并用evince打开(其实是刷新evince,即只打开一个)。
所谓的WYSIWYG latex vim(伪)就做好了,谢谢大家!
HP Pavilion DV6-2064CA: AMD Turion II Ultra Dual-Core Mobile M640, HD4650, 2GBx2 DDR2-800, Seagate 500GB 7200RPM SATA, BD-ROM
DELL UltraSharp 2209WA
Arch64, Testing repo
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#2

帖子 bones7456 » 2007-11-30 8:56

:lol: 强!这样也行,不过我不会用tex...
关注我的blog: ε==3
头像
ciclo
帖子: 786
注册时间: 2007-01-25 16:43
来自: 塔尔塔洛斯

#3

帖子 ciclo » 2007-12-14 16:40

不错的。
不过长篇会比较慢(20+页的中文)
我生平瞧不起两种人:
1.那些瞧不起用windows的人的人
2.用windows的人
3.不识数的人

博客:http://blog.chunhao.net
主页:http://chunhao.net
头像
ceclinux
帖子: 308
注册时间: 2013-01-17 2:42
系统: Ubuntu 12.04LTS

Re: 让你的vim成为所见即所得的latex编辑器(伪:))

#4

帖子 ceclinux » 2013-11-25 12:03

非常感谢,但是更新一次focus到了evince上,而非gvim
Ubuntu 12.04 LTS
laptop:Acer 4750G CPU:I5-2410
内存:2+2G 硬盘:500+750
http://www.ceclinux.org
回复