Loading ...
Sorry, an error occurred while loading the content.
 

Re: JSON file autoformat

Expand Messages
  • Bram Moolenaar
    ... The current Javascript indent plugin seems to do this right. It s old, you probably have it, perhaps you use another file type? -- When I die, I want a
    Message 1 of 2 , Sep 30, 2012
      Primus wrote:

      > I often need to reformat json code.
      >
      > The problem I have is it always indent the first line of a hash
      >
      > e.g.
      > [quote]
      > "a" : {
      > "b" : "c",
      > "d" : "e"
      > }
      > [/quote]
      >
      > becomes
      >
      > [quote]
      > "a" : {
      > "b" : "c",
      > "d" : "e"
      > }
      > [/quote]
      >
      > Is there any way to solve this problem?
      >
      > I am aware of the :%!python -m json.tool method, however it give my
      > code a re-sorting, which I have to avoid.
      >
      > Any idea?
      >
      > Thanks for your advice!

      The current Javascript indent plugin seems to do this right.
      It's old, you probably have it, perhaps you use another file type?

      --
      "When I die, I want a tombstone that says "GAME OVER" - Ton Richters

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.