您对Perl开发的理想Vim配置有什么建议? [英] What are your suggestions for an ideal Vim configuration for Perl development?

查看:123
本文介绍了您对Perl开发的理想Vim配置有什么建议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



.vimrc settings



 创建命令:Tidy以调用perltidy
默认情况下,它对整个文件进行操作,可以给它一个
范围或视觉范围,如果你知道你在做什么。
command -range =%-nargs = * Tidy< line1>,< line2> ;!
\perltidy -your -preferred -default -options< args>

vmap< tab> > gvv选项卡中的选项卡缩进代码
vmap< s-tab> < gv

nmap< tab> I< tab>< esc> 在正常模式下制作选项卡缩进代码
nmap< s-tab> ^ i< bs>< esc>

let perl_include_pod = 1包含带有perl.vim的pod.vim语法文件
let perl_extended_vars = 1突出显示复杂表达式,例如@ {[$ x,$ y]}
let perl_sync_dist = 250使用更多的上下文来突出显示

set nocompatible使用Vim默认值
set backspace = 2允许在插入模式下对所有内容留空间

set autoindent始终将自动缩进设置为
设置expandtab在插入模式下插入空格而不是制表符使用缩进空格
set tabstop = 4 ; Tab>在文件中计数为
set shiftwidth = 4每个步骤使用的空格数量(自动)缩进

set showmatch当插入括号时跳到匹配的一个



语法





插件





ftplugins





CPAN模块





调试工具



我刚刚发现了 VimDebug

解决方案

chromatic's blog (略微调整以便能够使用来自所有模式的相同映射)。

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

在正常模式下点击,pt 上传整个文件,或在可视模式下清理选择。您还可以添加:

  imap,pt< ESC>:%! perltidy< CR>但是不建议使用输入模式下的命令。


There are a lot of threads pertaining to how to configure Vim/GVim for Perl development on PerlMonks.org. My purpose in posting this question is to try to create, as much as possible, an ideal configuration for Perl development using Vim/GVim. Please post your suggestions for .vimrc settings as well as useful plugins.

I will try to merge the recommendations into a set of .vimrc settings and to a list of recommended plugins, ftplugins and syntax files.

.vimrc settings

"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

plugins

ftplugins

CPAN modules

Debugging tools

I just found out about VimDebug. I have not yet been able to install it on Windows, but looks promising from the description.

解决方案

From chromatic's blog (slightly adapted to be able to use the same mapping from all modes).

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

hit ,pt in normal mode to clean up the whole file, or in visual mode to clean up the selection. You could also add:

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

But using commands from input mode is not recommended.

这篇关于您对Perl开发的理想Vim配置有什么建议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆