Vim的LaTeX-suite插件F5自动补全的问题

Vim、Emacs配置和使用
回复
lyricorpse
帖子: 116
注册时间: 2011-04-02 22:08

Vim的LaTeX-suite插件F5自动补全的问题

#1

帖子 lyricorpse » 2012-03-30 16:08

我在http://vim-latex.sourceforge.net/index.php?subject=download&title=Download 下载了这个插件,解压开来文件全丢到~/.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 (我是Ubuntu)

" 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+=:
随后开始按latex-suite-quickstart.txt里的内容开始学习,但是问题来了,当我在

代码: 全选

1 %        File: sample.tex
2 %     Created: Sun Jun 22 04:00 PM 2003 P
3 % Last Change: Sun Jun 22 04:00 PM 2003 P
4 %
5 \documentclass[a4paper]{article}
6 \begin{document}
7 
8 \end{document}
的\begin{document}上一行键入amsmath,然后在normal下按F5后,居然变成了

代码: 全选

\begin{amsmath}

\end{amsmath}
然后我怀疑和.vimrc里的有些原有设置冲突了,干脆新建一个新的.vimrc,只用latex-suite官方给的设置,发现就正确变成\usepackage[]{amsmath}<++>,随后一项项检查原来.vimrc里的设置,发现是和set nowrapscan冲突了,改成set wrapscan后就正常。
解决这个问题本以为可以好好用了,结果又马上发现问题,并且不知道如何解决:
在正文区输入eqnarray,在normal下按F5,结果不是

代码: 全选

\begin{eqnarray}
    \label{}<++>
\end{eqnarray}<++>
而是

代码: 全选

\begin{eqnarray}
    『cursor』
    \label{<++>}
\end{eqnarray}<++>
并且这一次使用纯净的.vimrc照样不成功。。。请问有人知道这个如何解决么?
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: Vim的LaTeX-suite插件F5自动补全的问题

#2

帖子 eexpress » 2012-03-30 16:22

这太复杂了。插件不可能搞定全部的tex关键词。
我只使用本身的自动补全。不要插件。
● 鸣学
谢宝良
帖子: 1983
注册时间: 2010-05-01 21:23

Re: Vim的LaTeX-suite插件F5自动补全的问题

#3

帖子 谢宝良 » 2012-03-30 17:57

这很正常,它默认就是如此的。如果你想得到
\begin{eqnarray}
\label{}<++>
\end{eqnarray}<++>
完全可以自己定义的。这个插件的亮点是可以任意定义。如果你只想使用默认的,肯定不好用。
lyricorpse
帖子: 116
注册时间: 2011-04-02 22:08

Re: Vim的LaTeX-suite插件F5自动补全的问题

#4

帖子 lyricorpse » 2012-03-30 22:32

谢宝良 写了:这很正常,它默认就是如此的。如果你想得到
\begin{eqnarray}
\label{}<++>
\end{eqnarray}<++>
完全可以自己定义的。这个插件的亮点是可以任意定义。如果你只想使用默认的,肯定不好用。
不是的吧。。。默认的不该和它的速成文档一个效果么?我感觉我现在的输入状况似乎是它默认效果的扭曲。。。不知道被哪一块设定给影响了。。。
回复