Browse
SublimeLinter-xmllint This linter plugin for SublimeLinter provides an interface to xmllint. It will be used with files that have the “XML” syntax. A collection of DocBook XML snippets for Sublime Text 2 and 3 What does this do? This repo contains snippets that help automate syntax generation for technical writers and developers writing content in DocBook XML. They are specifically designed for a text editor called Sublime Text, but are compatible with others that use snippets.
Prettify/Minify/Query/Goto/Validate/Lint JSON plugin for Sublime Text 2 & 3
Labelsjson, pretty, lint, minify, validate, query, json2xml
Installs
- Total797K
- Win327K
- Mac341K
- Linux128K
Jan 8 | Jan 7 | Jan 6 | Jan 5 | Jan 4 | Jan 3 | Jan 2 | Jan 1 | Dec 31 | Dec 30 | Dec 29 | Dec 28 | Dec 27 | Dec 26 | Dec 25 | Dec 24 | Dec 23 | Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 176 | 211 | 204 | 229 | 209 | 76 | 92 | 61 | 132 | 189 | 188 | 209 | 83 | 79 | 144 | 176 | 187 | 212 | 225 | 70 | 101 | 210 | 265 | 228 | 233 | 229 | 83 | 84 | 239 | 242 | 207 | 249 | 209 | 89 | 91 | 232 | 253 | 212 | 253 | 280 | 81 | 91 | 213 | 236 | 247 | 238 |
Mac | 175 | 232 | 251 | 278 | 205 | 77 | 62 | 45 | 139 | 180 | 210 | 171 | 71 | 80 | 108 | 154 | 200 | 269 | 218 | 88 | 93 | 211 | 262 | 306 | 299 | 265 | 103 | 89 | 266 | 282 | 304 | 286 | 282 | 86 | 85 | 255 | 293 | 276 | 272 | 237 | 89 | 71 | 204 | 231 | 304 | 280 |
Linux | 55 | 57 | 68 | 70 | 52 | 35 | 29 | 20 | 24 | 53 | 57 | 45 | 30 | 24 | 27 | 36 | 65 | 66 | 68 | 30 | 35 | 61 | 66 | 75 | 82 | 71 | 20 | 25 | 71 | 82 | 86 | 85 | 73 | 34 | 24 | 64 | 76 | 80 | 86 | 80 | 25 | 32 | 77 | 86 | 72 | 88 |
Readme
- Source
- raw.githubusercontent.com
Prettify/Minify/Query/Goto/Validate/Lint JSON plugin for Sublime Text 3 & 4
Installation
Package Control (Recommended)
Install this sublime text ¾ package via Package Control search for package: “Pretty JSON”
Manual Installation
Sublime Text 4
cd <Packages directory>
(MacOS:~/Library/Application Support/Sublime Text/Packages
)git clone https://github.com/dzhibas/SublimePrettyJson.git 'Pretty JSON'
Sublime Text 3
cd <Packages directory>
(MacOS:~/Library/Application Support/Sublime Text 3/Packages
)git clone https://github.com/dzhibas/SublimePrettyJson.git 'Pretty JSON'
cd Pretty JSON
git checkout st3
Sublime Text 2No longer supported
Usage
To prettify JSON, make selection of json (or else it will try to use full view buffer) and press keys:
- Linux: ctrl+alt+j
- Windows: ctrl+alt+j
- OS X: cmd+ctrl+j
or through Command Palette Ctrl+Shift+P find “Pretty JSON: Format JSON” (you can search for part of it like 'pretty format')
If selection is empty and configuration entry use_entire_file_if_no_selection is true, tries to prettify whole file
If JSON is not valid it will be displayed in status bar of Sublime Text
Validate JSON
Using Command Palette Ctrl+Shift+P find “Pretty JSON: Validate” (you can search for partial string 'validate') this will validate selection or full file and will show in dialog if it's valid or invalid. In case of found errors view will jump to error and will highlight it
Compress / Minify JSON
Using Command Palette Ctrl+Shift+P find “Pretty JSON: Minify JSON” (you can search for part of it like 'json minify') this will make selection or full buffer as single line JSON which later you can use in command lines (curl/httpie) or somewhere else…
To map a key combination like Ctrl+Alt+M to the Minify command, you can add a setting like this to your .sublime-keymap file (eg: Packages/User/Default (Windows).sublime-keymap
):
Convert JSON to XML
Using Command Palette Ctrl+Shift+P search for “Pretty JSON: json2xml” (you can search for part of it like '2XML') this will convert your selected JSON of full buffer to XML and replace syntax and buffer to XML output
./jQ query/filter usage
Demo:
If on your machine “./jq” tool is available with ctrl+atl+shift+jyou can run against your json. output will be opened in new view so you can once again apply jq on new buffer
You can find instructions of tool here:
Default configuration
use_entire_file_if_no_selection
- Default:
true
- Default:
indent
- Default:
2
- Integer represents amount of spaces
t
will utilize a tab character
- Default:
sort_keys
- Default:
false
- Default:
ensure_ascii
- Default:
false
- Default:
line_separator
- “,”
value_separator
- “: ”
- Value separator in config, so if you need to get rid of extra space you can remove it with this param
keep_arrays_single_line
- Default:
false
- If we need to re-structure arrays and make them single-line
- Default:
max_arrays_line_length
- Default:
120
- If array for example '[“a”, “b”, 123213, ….]' length will reach max it will be kept multi-line
- Default:
pretty_on_save
- Default:
false
- Do we need to automatically Pretty JSON on save
- Default:
validate_on_save
- Default:
true
- Do we need validate JSON files on each save
- Default:
reindent_block
- Default:
false
- If we are formatting a selection, if we need to reindent theresulting block to follow the flow of the source documentthe posible values are 'minimal' and 'start'
using
minimal
, the resulting json lines are indented as much spaces as the line where the selection starts. e.ggets formatted as:
using
start
, the resulting json lines are indented a numberof spaces equal to the column number of the start of the selectionwith
start
the previous example gets formatted as:- Default:
Using tabs for indentation
You can change configuration key indent to string value 't'
or any other string
Be sure 'Indent Using Spaces'
is unchecked otherwise you will not see effect and ST3/4 will convert it back to spaces
Contributors
Others
If you YAMLing then maybe you interested in this plugin: PrettyYAML
Sublime Xml Format
If you build your project in Maven and use Sublime Text for coding, this trick may be useful. I assume you have Package Control already installed.
Sublime Text C++ Packages
First, add repository with SublimeMaven plugin. To do this, press Shift+Ctrl+P, select Package Control: Add Repository. Type in https://github.com/nlloyd/SublimeMaven and press Enter.
Press Shift+Ctrl+P again and select Package Control: Install Package. Search for SublimeMaven and press Enter.
It should be installed now. Now go to Tools>Build System and select Maven.
Sublime Text Xml Formatter
Now open folder with you project (having pom.xml in it), press Ctrl+B. Type in your desired Maven parameter, press Enter and you're good to go!