对于Perl开发的理想Vim配置,你有什么建议?

有很多关于如何在PerlMonks.org上为Perl开发配置Vim / GVim的线程。 我发布这个问题的目的是尽可能地尝试使用Vim / GVim为Perl开发创建一个理想的配置。 请发布您对.vimrc设置的建议以及有用的插件。

我会尝试将这些建议合并到一组.vimrc设置以及推荐的插件,ftplugins和语法文件列表中。

.vimrc设置

"Create a command :Tidy to invoke perltidy"
"By default it operates on the whole file, but you can give it a"
"range or visual range as well if you know what you're doing."
command -range=% -nargs=* Tidy <line1>,<line2>!
    perltidy -your -preferred -default -options <args>

vmap <tab> >gv    "make tab in v mode indent code"
vmap <s-tab> <gv

nmap <tab> I<tab><esc> "make tab in normal mode indent code"
nmap <s-tab> ^i<bs><esc>

let perl_include_pod   = 1    "include pod.vim syntax file with perl.vim"
let perl_extended_vars = 1    "highlight complex expressions such as @{[$x, $y]}"
let perl_sync_dist     = 250  "use more context for highlighting"

set nocompatible "Use Vim defaults"
set backspace=2  "Allow backspacing over everything in insert mode"

set autoindent   "Always set auto-indenting on"
set expandtab    "Insert spaces instead of tabs in insert mode. Use spaces for indents"
set tabstop=4    "Number of spaces that a <Tab> in the file counts for"
set shiftwidth=4 "Number of spaces to use for each step of (auto)indent"

set showmatch    "When a bracket is inserted, briefly jump to the matching one"

句法

  • vim-perl:在Vim中支持Perl 5和Perl 6
  • 插件

  • 在插入模式下,delimitMate提供了对引号,parens,括号等的自动完成。 它比closepairs.vim更明智地处理撇号。

  • perlhelp.vim:与perldoc的接口

  • taglist.vim:源代码浏览器

  • ftplugins

  • perldoc.vim:来自vim的perldoc命令
  • CPAN模块

  • VIM :: X
  • 调试工具

    我刚刚发现了关于VimDebug。 我还没有能够在Windows上安装它,但从描述中看起来很有希望。


    从chromatic的博客(略微适应能够使用所有模式的相同映射)。

    vmap ,pt :!perltidy<CR> 
    nmap ,pt :%! perltidy<CR>
    

    点击,pt在普通模式下点清理整个文件,或在视觉模式下清理选择。 您还可以添加:

    imap ,pt <ESC>:%! perltidy<CR>
    

    但不建议使用来自输入模式的命令。


    " Create a command :Tidy to invoke perltidy.
    " By default it operates on the whole file, but you can give it a
    " range or visual range as well if you know what you're doing.
    command -range=% -nargs=* Tidy <line1>,<line2>!
        perltidy -your -preferred -default -options <args>
    

    另请参阅perl-support.vim(Vim / gVim的Perl IDE)。 除了许多其他内容之外,还提供了有关定制Vim(.vimrc),gVim(.gvimrc),ctags,perltidy和Devel:SmallProf的建议。

    链接地址: http://www.djcxy.com/p/8691.html

    上一篇: What are your suggestions for an ideal Vim configuration for Perl development?

    下一篇: Vim and Ctags tips and tricks