登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Q超越兔子的蜗牛O--逸云沙鸥Linux

飘飘何所似,天地一沙鸥;落霞与孤鹜齐飞,秋水共长天一色~~

 
 
 

日志

 
 

vim 插件安装管理--perl-support  

2010-02-09 10:18:57|  分类: Linux学习笔记 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
    慢慢对Vim的基本使用熟悉后,就会真正感受到他的强大了!
    这里我转载了,两篇很牛的VIM 使用技巧。大家理解过后就可以更加得心应手的Viming,更加高效的创建、编辑、编译执行自己的程序了。

   这里以,VIM 的 perl-support 为例,和大家分享一下,VIM 插件安装配置技巧。

[基本篇]
-------------
1. VIM 官网:http://www.vim.org/ , 下载VIM 或者 直接搜索 自己感兴趣的插件:http://www.vim.org/scripts/script_search_results.php ,各种插件成千上万,找到自己感兴趣的,eg. 输入perl-support,得到:perl-support.vim : Perl IDE -- Write and run Perl-scripts using menus and hotkeys. 
2. 下载保存 ,感兴趣的插件压缩包,在自己的主目录下建立 .vim 文件夹 , 然后将 zip 包内的文件解压到 .vim 文件夹中 。OK,插件装好了。
3. 打开终端,新建perl 脚本, test.pl,注意一定要加后缀名.pl ,因为插件按 后缀来决定是否启用以支持这个文件的编辑等处理!这样,新建的 perl 脚本中已经 按照模板自动添加了一些代码。可能不全是你自己想要的。

[中级篇]
---------------------
4. 编辑 模板: 打开终端:vi ~/.vim/perl-support/templates/Templates ,在 主模板中 加入自己的关键信息;注意 里面双竖线中间部分是宏的名字,|AUTHOR|,在其他子模板中可以 直接使用,会自动扩展。

5.编辑其他子模板,主要是 comments.template ,找到 == comment.file-description-pl == start ==
后面的部分内容就是新的perl脚本中自动加入的代码。修改之!

分享一下我的comments.template 模板
--------------------------------------
§%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
== comment.file-description-pl == start ==
#!/usr/bin/perl 
#==============================================================================#
#-------------------------------help-info-start--------------------------------#
=head1 Name
    
    |FILENAME| --> <CURSOR>

=head1 Usage

    perl  |FILENAME|  [options] <input file>

    -help    ( tag)    print this help to screen
-log     ( str)    write log to a file
-o       ( str)    write result to a file
=head1 Example

    perl  |FILENAME|  input_file
    perl  |FILENAME|  ---

=head1 Version

    Verion : 1.0
    Created : |DATE| |TIME| 
    Updated : ---
LastMod : ---


=head1 Contact

    Author : QuNengrong (Qunero)
    E-mail : Quner612@qq.com,QuNengrong@genomics.cn
    Company : BGI

=cut
#-------------------------------help-info-end--------------------------------#
#============================================================================#
use strict;
use warnings;
use Getopt::Long;

my ($Need_help, $Log_file, $Out_file );
GetOptions(
"help" => \$Need_help,
"log=s" => \$Log_file,
"o=s" => \$Out_file,
);

die `pod2text $0` if ($Need_help);

#============================================================================#
#                              Global Variable                               #
#============================================================================#
my $Input_file  = $ARGV[0]  if (exists $ARGV[0]); 

#============================================================================#
#                               Main process                                 #
#============================================================================#

if(defined $Input_file)
{ open(STDIN, '<', $Input_file) or die $!; }
if(defined $Log_file)
{ open(STDERR, '>', $Log_file) or die $!; }
if(defined $Out_file)
{ open(STDOUT, '>', $Out_file) or die $!; }

print STDERR '---Program starts --> '.localtime()."\n";

my @line2arr;
while(<STDIN>){
chomp;
next if(m/^$/);
@line2arr = split /\t+/;

print STDOUT $_."\n";
}



print STDERR '---Program  ends  --> '.localtime()."\n";

#============================================================================#
#                               Subroutines                                  #
#============================================================================#

if(defined $Input_file){
print STDERR "Start\treading input file $Input_file".' --> '.localtime()."\n";
}




if(defined $Input_file){
print STDERR "finish\treading input file $Input_file".' --> '.localtime()."\n";
}


  评论这张
 
阅读(4284)| 评论(3)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018