Skip to content
/ vim-jfmt Public
forked from bcicen/vim-jfmt

Automatically pretty-print and indent JSON files

Notifications You must be signed in to change notification settings

awead/vim-jfmt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

vim-jfmt

jfmt is a simple plugin for vim to automatically validate and format/pretty-print JSON files.

vim-jfmt

Installing

Ensure you have jq installed and available in your local $PATH

Then, add to your .vimrc using your plugin manager of choice; e.g. vundle:

Plugin 'bcicen/vim-jfmt'

Usage

By default, jfmt will only validate JSON files on save, opening a location list with any parse errors encountered.

To manually format/pretty-print the open file, use the :Jfmt command. To automatically run this on save as well, simply add the below to your .vimrc:

let g:jfmt_autofmt  = 1

Options

Additional options may be provided to jq by setting g:jfmt_jq_options:

" use tabs instead of spaces for indentation
let g:jfmt_jq_options = '--tab'

Likewise, the default filter(.) can be changed by setting g:jfmt_jq_filter

About

Automatically pretty-print and indent JSON files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%