Skip to content

taku0/json-par

Repository files navigation

License GPL 3 Run Tests

JSON Par mode

Emacs minor mode for structural editing of JSON, inspired by lispy.

Features

See the manual for details.

Installation

Install json-par package from MELPA.

To install without MELPA, download latest release and execute M-x package-install-file for the .tar archive.

Then add the following line to your .emacs:

(add-hook 'json-mode-hook (lambda () (json-par-mode 1)))

Enabling aggressive-indent-mode is also recommended.

Using only one or two functions

If you feel JSON Par mode officious, you can just pick a few functions and bind them to key sequences you like. Example:

(require 'json-mode)
(require 'json-par-mode)
(define-key json-mode-map (kbd "M-/") #'json-par-insert-guessed)
(define-key json-mode-map (kbd "C-c a") #'json-par-beginning-of-member)
(define-key json-mode-map (kbd "C-c e") #'json-par-end-of-member)
(define-key json-mode-map (kbd "C-c c") #'json-par-clone-member-forward)

Hacking

To build the package locally, run make package.

To install the built package, run make install.

To run tests, run make test.

Make sure to run make lint before submitting a pull request.

For other commands, run make help.

About comments

Supporting comments with jsonc-mode is a hidden feature and intentionally undocumented. It may not work for some cases.

Related projects

  • lispy: json-par is a lispy for JSON.
  • Paredit Mode: “JSON Par mode” is named after Paredit Mode.
  • Puni: Generic structured editing for many modes.
  • Symex mode: Structural editing for Lisp.

Acknowledgments

json-par is inspired from lispy.

Full list of contributors.

License

GPLv3. See COPYING for details. Copyright (C) 2021 taku0.