add functions/PrettifyJSON.vim
This commit is contained in:
parent
29bab2d6c3
commit
ae11bf7ce6
2 changed files with 17 additions and 0 deletions
12
functions/PrettifyJSON.js
Normal file
12
functions/PrettifyJSON.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
function prettifyJSON(filePath) {
|
||||||
|
fs.readFile(filePath, (err, data) => {
|
||||||
|
console.log(JSON.stringify(JSON.parse(data), null, 4));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const argFilePath = process.argv[2];
|
||||||
|
|
||||||
|
prettifyJSON(argFilePath)
|
||||||
|
|
5
functions/PrettifyJSON.vim
Normal file
5
functions/PrettifyJSON.vim
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
function! PrettifyJSON()
|
||||||
|
execute ':r !node ~/.vim_runtime/functions/PrettifyJSON.js %'
|
||||||
|
endfunction
|
||||||
|
|
Loading…
Reference in a new issue