Coder Social home page Coder Social logo

vim-bazel's Introduction

Vim Bazel

vim-bazel is a plugin for invoking bazel and interacting with bazel artifacts.

If you're looking for the Syntax and Filetype settings, that lives in vim-ft-bzl and has been integrated directly into the core-Vim syntax and filetype configuration.

Vim-bazel is currently in early development (see Development status).

For details, see the executable documentation in the vroom/ directory or the helpfiles in the doc/ directory. The helpfiles are also available via :help bazel if bazel is installed (and helptags have been generated).

DISCLAIMER: This is not an official Google product.

Commands

Use :Bazel {command} [argument...] to invoke bazel.

Usage example

:Bazel build //some/package:sometarget
INFO: Found 1 target...
Target //pkg/api:go_default_library up-to-date:
  bazel-bin/pkg/api/go_default_library.a
INFO: Elapsed time: 19.443s, Critical Path: 13.79s

Press ENTER or type command to continue

Installation

This example uses vim-plug, whose plugin-adding command is Plug.

.vimrc:

" Add maktaba and bazel to the runtimepath.
" (The latter must be installed before it can be used.)
Plug 'google/vim-maktaba'
Plug 'bazelbuild/vim-bazel'

Start vim and run

:PlugInstall

Development status

Travis Build Status

Major missing features:

  • Import build errors into vim (#1)
  • Asynchronous build support (#2)

See the full list of open issues at https://github.com/bazelbuild/vim-bazel/issues.

FAQ

:Bazel vs. X

Why not just use :!bazel?

The :Bazel command is currently a thin wrapper around :!bazel that supports tab completion. Upcoming improvements will offer many more features that vim's built-in shell support won't be able to offer.

Why not just use :make?

It doesn't add significant benefits for bazel usage in practice.

You can configure vim's built-in :make command to invoke "bazel build" with :set makeprg=bazel\ build. The key benefit of vim's :make command is that it can import errors from the build tool as entries in vim's quickfix list, but limitations in vim's errorformat setting make it tricky or impossible to actually cleanly parse bazel's output for a given build.

It also doesn't add any benefit related to other bazel functionality like "test" and "query" commands.

How does it compare to dispatch.vim?

dispatch.vim's :Make command has the same limitations as :make, above, just with some asynchronous execution strategies.

You can use

:Start -wait=always bazel {command}

to shell out to bazel via dispatch.vim, which works just like :!bazel (mentioned above) but with dispatch.vim's asynchronous execution. Doesn't block vim while executing long builds, but doesn't offer tab completion.

How does it compare to Neomake?

Neomake doesn't seem to add significant benefits for bazel usage in practice.

Like :make, it doesn't support bazel's specific functionality very well and the quickfix support is tricky or impossible to configure properly.

vim-bazel's People

Contributors

artasparks avatar dbarnett avatar dslomov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.