Erroneous


Ⅰ. 插件描述

The right way to handle errors

Ⅱ. 基本信息

创建日期:  2012-02-06
使用用户:  1
Github星:  7
插件作者:  Idan Arye

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'idanarye/erroneous'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'idanarye/erroneous'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'idanarye/erroneous'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/idanarye/vim-erroneous

Ⅳ. 文档说明

INTRODUCTION

Erroneous is a plugin for handling errors from external programs. Vim provides
you with the :make command to run compilers and parse the errors using the
'errorformat' option, but you must set the 'errorformat' option in advance. If
you use more than one language regularly, you'll have to change 'errorformat'

  1. This is usually done with file-type plugins - but that means you have to
  2. compile from one of the source files(you can't, for example, compile

from one of the configuration XML files). You can also set a long, compound
'errorformat' that can catch errors in many formats - but from my experience
those catch-all 'errorformat's tend to identify error-description lines as
error headlines and create entries in the quickfix list that are mapped to
nowhere and send you to empty buffers. Not as fun as it sounds...

Erroneous takes a different approach - instead of parsing stderr based on the
filetype, parsing is done based on the shell command that invoked the program
that created the error. So, if you run javac MyClass.java Erroneous will
automatically set the 'errorformat' to parse javac errors, while running
gcc main.c will cause Erroneous to set 'errorformat' to parse gcc errors.

Erroneous can also read shebangs to know how to parse errors of interepted
scripts in linux, and it provides API for other plugins that want to determine
the error format by other means.

USAGE

First you need to set the g:erroneous_errorFormatChooserPatterns and/or the
g:erroneous_errorFormatChooserWords dictionaries. Then use the supplied
commands(see erroneous-commands for list of commands) to run shell commands
and parse their error formats according to what you configured in those
dictionaries.

Refer to the vim-doc for examples and more information.

IMPORTANT NOTE

Erroneous can not be used for running commands that require user interaction,
since it redirects stderr and stdout to files and only displays them once the
program finishes.

OPTIONAL REQUIREMENT: RUBY

Erroneous can run without Ruby support in Vim, but with Ruby and unless you run
Windows, when Erroneous runs a command, you can see it's output as it runs.
Without Ruby, Erroneous redirects the command's stdout and stderr to files that
it reads, so you can only get the results once the command finishes. That also
means that without Ruby, you will see stdout and then stderr, even if the
command was writing to them both alternately.

So: use Ruby. It's awesome.

BUILD SYSTEM SUPPORT

Erroneous can read and parse error output from
Make, Rake and
Apache Ant, Apache Maven,
XBuild(which is the same as
MSBuild) and
Waf.

添加新评论