有很多关于如何配置
Vim/GVim Perl开发
on PerlMonks.org的线程。我的目的是发布这个问题是尝试尽可能创建一个理想的配置Perl开发使用Vim / GVim。请发布您的建议.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: Support for Perl 5 and Perl 6 in Vim
> delimitMate provides auto-completion for quotes,parens,brackets,etc. in insert mode.它比closepairs.vim处理撇号更智能。
> perlhelp.vim: Interface to perldoc
> taglist.vim: Source code browser
ftplugins
> perldoc.vim: perldoc command from vim
CPAN模块
> Vim::X
调试工具
我刚刚发现了大约VimDebug.我还没有能够在Windows上安装它,但看起来很有前途的描述。
解决方法
从
chromatic’s blog(略微适应能够使用从所有模式的相同映射)。
vmap,pt :!perltidy<CR> nmap,pt :%! perltidy<CR>
命中,pt在正常模式下清理整个文件,或在视觉模式下清理选择。您还可以添加:
imap,pt <ESC>:%! perltidy<CR>
但不建议使用输入模式下的命令。