加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 21:28:35 所属栏目:大数据 来源:网络整理
导读:有很多关于如何配置 Vim/GVim Perl开发 on PerlMonks.org的线程。我的目的是发布这个问题是尝试尽可能创建一个理想的配置Perl开发使用Vim / GVim。请发布您的建议.vimrc设置以及有用的插件。 我将尝试将建议合并到一组.vimrc设置和推荐的插件,ftplugins和语
有很多关于如何配置 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>

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读