tminor / jsonnet-mode

Emacs major mode for editing Jsonnet files.
GNU General Public License v3.0
46 stars 17 forks source link

License: GPL v3 CI Coverage Status

jsonnet-mode

Provides Emacs font-lock, indentation, and some useful functions for the Jsonnet templating language.

Table of Contents

Dependencies

The jsonnet-eval-buffer method depends on the jsonnet binary, which should be available on your exec-path. For installation details, see here for go-jsonnet and here for the C++ implementation.

Features

Indentation

Indentation is provided by a function implemented with SMIE. To use the old indentation function (not recommended), set jsonnet-use-smie to nil.

Formatting

jsonnet-reformat-buffer (bound to C-c C-r by default) uses the jsonnetfmt utility to reformat your buffer. jsonnet-mode's indentation function should match its output in most cases.

Rendering

jsonnet-eval-buffer runs jsonnet to evaluate and render a jsonnet-mode buffer. It's bound to C-c C-c by default. If any errors are encountered, they should be conveniently displayed in compilation-mode.

It will create a buffer called *jsonnet output*. Default display behaviour of these buffers can be customized using display-buffer-alist (see The Zen of Buffer Display for examples of how to do this).

Navigation

jsonnet-mode also provides some methods to make navigation easier. In particular, jsonnet-jump (bound to C-c C-f) allows you to jump to the definition of a given identifier.

Configuration

There are several customizable parameters that you may configure in this mode:

Buffer display

The potential buffers that the mode creates are:

If you require special customization of their display, you can either use display-buffer-alist as described above or investigate the options provided in your distribution of GNU Emacs.