有很多关于如何配置的线程Vim/GVim http://www.vim.org/用于 Perl 开发在 PerlMonks.org 上 http://www.google.com/search?q=vimrc+site%3Aperlmonks.org。我发布这个问题的目的是尝试为使用 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"
syntax
- vim-perl:Vim 中对 Perl 5 和 Perl 6 的支持 https://github.com/vim-perl/vim-perl
plugins
delimitMate 在插入模式下提供引号、括号、方括号等的自动补全功能 http://github.com/Raimondi/delimitMate。它比处理撇号更智能closepairs.vim http://www.vim.org/scripts/script.php?script_id=2373 does.
perlhelp.vim:perldoc 的接口 http://www.vim.org/scripts/script.php?script_id=1913
taglist.vim:源代码浏览器 http://www.vim.org/scripts/script.php?script_id=273
ftplugins
- perldoc.vim:vim 中的 perldoc 命令 http://www.vim.org/scripts/script.php?script_id=209
CPAN模块
- Vim::X https://metacpan.org/pod/Vim::X
调试工具
我刚刚发现VimDebug http://vim.sourceforge.net/scripts/script.php?script_id=663。我还无法在 Windows 上安装它,但从描述来看似乎很有希望。
From 彩色的博客 http://www.modernperlbooks.com/mt/2009/10/from-novice-to-adept-cleaning-up-bad-code.html(稍微调整为能够使用所有模式中的相同映射)。
vmap ,pt :!perltidy<CR>
nmap ,pt :%! perltidy<CR>
hit ,pt
在正常模式下清理整个文件,或在可视模式下清理所选内容。您还可以添加:
imap ,pt <ESC>:%! perltidy<CR>
但不建议使用输入模式的命令。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)