第一:插件可以到官网上下载,顺便把网址贴上来:http://www.vim.org/scripts/script.php?script_id=556
下载下来以后,解压文件夹,然后看里面的README.perlsupport.
我自己摸索的时候花费了很大的力气,光是看英语的介绍,就把我吓退了几次,如果大家有不明白的地方,欢迎评论交流,或者发邮件rongchaogao@gmail.com
我在下面简单的翻译了一下安装的信息:
================================================================================
INSTALLATION
安装
================================================================================
(1) WINDOWS
windows下的安装
----------------------------------------------------------------------
The subdirectories in the zip archive perl-support.zip mirror the directory
structure which is needed below the local installation directory
$HOME/vimfiles/ (find the value of $HOME with ":echo $HOME" from inside Vim).
在官方网址下载这个插件,然后找到以下的目录文件
(2.0) Save the template files in '$HOME/vimfiles/perl-support/templates/Templates'
if you have changed any of them.
把文件放入到C:\program files\vim\vimfiles
(2.1) Copy the zip archive perl-support.zip to $HOME/vimfiles and run
unzip perl-support.zip
把下载的压缩文件夹放入到C:\program files\vim\vimfiles中,然后解压
(2.2) Loading of plugin files must be enabled. If not use
:filetype plugin on
在vim中“:filetype ”这个命令
This is the minimal content of the file '$HOME/_vimrc'. Create one if there
is none or use the files in $HOME/vimfiles/perl-support/rc as a starting point.
看看有没有_vimrc,如果没有创建一个,一般都有
(2.3) Set at least some personal details in the file
'$HOME/vimfiles/perl-support/templates/Templates'到这个文件夹里的这个文件,用vim打开进行自己的编辑
Here is the minimal personalization (my settings as an example):
SetMacro( 'AUTHOR', 'Dr. Fritz Mehner' )
SetMacro( 'AUTHORREF', 'fgm' )
SetMacro( 'EMAIL', 'mehner.fritz@fh-swf.de' )
SetMacro( 'ORGANIZATION','FH Südwestfalen, Iserlohn' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )
(Read more about the template system in the plugin documentation)
(2.4) Make the plugin help accessable by typing the following command on the
Vim command line:
在vim命令行中输入:helptags c:Program Files\vim\vimfiles\perl-support\doc
:helptags $HOME\vimfiles\doc\
(2.5) Consider additional settings in the file '$HOME/_vimrc'. The files
customization.vimrc and customization.gvimrc are replacements or extensions
for your _vimrc and _gvimrc. You may want to use parts of them. The files
are documented.
有用的就这些信息,当然还有很多其他的东西,大家自己去看看,慢慢理解。我是在xp系统下操作的,win7用户自己选择的文件夹位置可能有所不同。
还有一个比较有用信息,就是perl-support\perl-support\doc中的perl-hot-keys的PDF文件。里面有perl-support中的快捷键。
我们来看看这个PDF怎么看:
这里最上面会有一行解释:
i:代表的是插入模式
n:代表的是普通的模式
v:代表的是visual模式
每一行的快捷键最后面都有一个括号标注这个快捷键在哪几种模式下可以使用
如图\h这个快捷键(n,j)代表的就是在插入模式和普通模式下都可以使用。
我们再举个例子:
这里你只要在vim中输入 \sd 就会出现后面的do { } while这些字符
但是你\sd这几个字符的输入,一定要快,一定要连贯。不然得不到你想要的结果。
下面是我分别输入不同的快捷键后得到的结果:
#\sd
do {
} while ( ); # ----- end do-while -----
#\sf
for ( my $; ; ) {
}
#\sfe
foreach my $ ( ) {
}
#\si
if ( ) {
<-IF_PART->
}
这里同样有perl的代码语法检查;
\rs是检查语法错误的命令
\rr是直接运行的命令
这样可以省下很多的功夫。
2013-01-13
有朋有详细的看过这篇文档了,所以把最近使用的一些经验再写写,避免大家走后路。
再使用的过程中,大家用"\rr"运行以后,大家如果没有关闭运行的窗口,你的perl程序是不能编译的,所以要先把运行的窗口关闭,然后才能对你的perl程序进行修改。
然后输出的文件也是比较常用的是\ip,输出的结果是:
print “\n";
这样可以省下很多的功夫。