diff --git a/functions/PrettifyJSON.js b/functions/PrettifyJSON.js new file mode 100644 index 00000000..cb1b3dfc --- /dev/null +++ b/functions/PrettifyJSON.js @@ -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) + diff --git a/functions/PrettifyJSON.vim b/functions/PrettifyJSON.vim new file mode 100644 index 00000000..ab10874d --- /dev/null +++ b/functions/PrettifyJSON.vim @@ -0,0 +1,5 @@ + +function! PrettifyJSON() + execute ':r !node ~/.vim_runtime/functions/PrettifyJSON.js %' +endfunction +