Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brown/bazel-mode
GNU Emacs mode for editing Bazel BUILD files
https://github.com/brown/bazel-mode
Last synced: 11 days ago
JSON representation
GNU Emacs mode for editing Bazel BUILD files
- Host: GitHub
- URL: https://github.com/brown/bazel-mode
- Owner: brown
- License: gpl-3.0
- Created: 2018-04-09T02:33:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-13T01:04:02.000Z (over 3 years ago)
- Last Synced: 2024-07-31T07:15:50.288Z (3 months ago)
- Language: Emacs Lisp
- Size: 27.3 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
- awesome-bazel - brown/bazel-mode
README
Bazel Mode
==========Bazel Mode is a GNU Emacs major mode for editing Bazel BUILD, WORKSPACE, and
bzl files, which are written in the Starlark language.To use Bazel Mode, add the following to your .emacs file after replacing
"/path/to/bazel-mode/directory" with the location where you installed Bazel
Mode:(add-to-list 'load-path "/path/to/bazel-mode/directory")
(autoload 'bazel-mode "bazel-mode" "Major mode for Bazel BUILD files." t)
(add-to-list 'auto-mode-alist '("/BUILD\\(\\..*\\)?\\'" . bazel-mode))
(add-to-list 'auto-mode-alist '("/WORKSPACE\\'" . bazel-mode))
(add-to-list 'auto-mode-alist '("\\.\\(BUILD\\|WORKSPACE\\|bzl\\)\\'" . bazel-mode))Bazel Mode supports reformatting BUILD files with buildifier. To use this
feature, you'll need to download and install buildifier, which is part of
Google's buildtools package:git clone https://github.com/bazelbuild/buildtools.git
cd buildtools
bazel build //buildifierand then install buildifier in some directory that's in your PATH shell
environment variable.Once buildifier is installed, you can use it in two different ways. First,
Bazel Mode supports reformatting BUILD buffers by running bazel-format, which
is bound to the key sequence C-c C-f. Additionally, you can configure Emacs to
automatically format files with buildifier before saving them by adding the
following to your .emacs file:(add-hook 'bazel-mode-hook
(lambda ()
(add-hook 'before-save-hook #'bazel-format nil t)))