spacemacs/layers/+lang/json
2018-05-20 00:41:17 -04:00
..
img
funcs.el
layers.el
packages.el web-beautify: rename spacemacs-web-beautify--modes 2018-05-20 00:41:17 -04:00
README.org Fix documentation link to web-beautify layer README 2018-05-18 02:04:45 -04:00

JSON layer

/TakeV/spacemacs/media/commit/7d19ba1711db953308d5ad04abee8b19e5f66859/layers/+lang/json/img/json.png

Description

This layer adds support for JSON files with json-mode

Features:

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add json to the existing dotspacemacs-configuration-layers list in this file.

Configuration

To define the default indentation set the variable js-indent-level.

web-beautify

See web-beautify layer documentation.

Usage

Reformat

SPC m = will reformat the whole buffer or the active region. Use numerical prefix argument to specify a different indentation than js-indent-level. Use the universal prefix argument to print decoded strings, for instance:

{"name":"foo\"bar","nick":"foo \u00e4 bar","description":"<pre>\nbaz\n</pre>","home":"/home/foobar"}

Will be reformated:

{
  "name": "foo\"bar",
  "nick": "foo ä bar",
  "description": "<pre>
  baz
  </pre>",
  "home": "/home/foobar"
}

Display navigable hierarchy

SPC m h h displays the hierarchy for the whole JSON document or the active region. Use the universal prefix argument SPC u SPC m h h to create the hierarchy for the JSON after the point.

Key Bindings

Key Binding Description
SPC m = DWIM Reformat JSON
SPC m h p Get the path of the value at point
SPC m h h DWIM navigate JSON hierarchy
SPC m h H Navigate JSON hierarchy of the whole buffer

JSON hierarchy

Key Binding Description
RET Expand/Collapse node
TAB Select next node
S-TAB Select previous node