sbt-quickfix


Ⅰ. 插件描述

SBT plugin that routes compiler and test errors into a quickfix file

Ⅱ. 基本信息

创建日期:  2013-02-07
使用用户:  5
Github星:  56
插件作者:  Dave Cleaver

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# sbt-quickfix

This is an sbt plugin that generates a quickfix file that can be used with Vim.

Inspired by [Alois Cochard's blog post] on setting up quickfix using a bash wrapper around sbt..

Usage

Add this to your ~/.sbt/0.13/plugins/plugins.sbt:

addSbtPlugin("com.dscleaver.sbt" % "sbt-quickfix" % "0.4.1")

Note: this plugin was built for sbt 0.13 use version 0.3.1 for sbt 0.12

Vim Integration

If your vim is setup to use [Pathogen], then the vim-sbt plugin can be installed with this command:

sbt installVimPlugin  #'sbt install-vim-plugin' for older versions of sbt...

This command will replace the plugin files whenever it is run, so it is recommended when upgrading versions of the plugin.

Using the files in Vim

After a compile or test, assuming there was an error, a quickfix file will be created that Vim can use.

If your copy of Vim was compiled with [+clientserver] and you've enabled the vim-enable-server flag in your SBT project (default is true), then this plugin will automatically load the quickfix file into Vim once it's been created.

If you don't have [+clientserver] enabled in Vim, or you have disabled the vim-enable-server feature of the plugin, then you can use a Vim mapping to load the file. By default the mapping is <leader>ff, but you can change this if you wish.

Installation Location

By default the plugin will install to ~/.vim/bundle. This plugin base directory can be added to your global config (e.g. ~/.sbt/0.13/global.sbt) as follows:

QuickFixKeys.vimPluginBaseDirectory := file("intended/directory")

You can disable the vim-enable-server flag in the global.sbt as follows:

QuickFixKeys.vimEnableServer := false

Previous Integration

The initial version of this plugin required that you add the following lines to your ~/.vimrc:

set errorformat=%E\ %#[error]\ %#%f:%l:\ %m,%-Z\ %#[error]\ %p^,%-C\ %#[error]\ %m
set errorformat+=,%W\ %#[warn]\ %#%f:%l:\ %m,%-Z\ %#[warn]\ %p^,%-C\ %#[warn]\ %m
set errorformat+=,%-G%.%#

noremap <silent> <Leader>ff :cf target/quickfix/sbt.quickfix<CR>
noremap <silent> <Leader>fn :cn<CR>

These lines should be removed from ~/.vimrc

To Do

Items that I want to look into in the future:

  • Possibly reformat log output for easier consumption
  • Add ctags generation possibly turning this into a full vim plugin
  • Allow vim server name to be overridden by system property

License

Code is provided under the BSD 3-Clause license available at https://opensource.org/licenses/BSD-3-Clause,
as well as in the LICENSE file.

添加新评论