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

[patch] Separate filetype for JSON

Expand Messages
  • David Barnett
    This is a patch to create a separate json filetype and use it for *.json files instead of using javascript. It currently just forwards indent and syntax
    Message 1 of 6 , Jul 14, 2014
    • 0 Attachment
      This is a patch to create a separate json filetype and use it for *.json files instead of using javascript. It currently just forwards indent and syntax settings to the javascript filetype, but it does define its own ftplugin/json.vim file since most of the settings in ftplugin/javascript.vim don't apply to JSON. I'd like to submit it to be integrated in vim under the Vim license.

      My reasons for wanting to do this instead of just using the javascript filetype are:
      * JSON is not JavaScript, it's a very small subset of the language. Comments and many other details of JavaScript syntax are completely invalid in a JavaScript file, so it's misleading to treat them as the same filetype.
      * Several plugins (syntastic, vim-snippets, vim-addon-manager) refer to a "json" filetype that doesn't actually exist unless you install some third-party plugin to apply it. This leads to vim unexpectedly triggering "javascript" actions on "json" files, and in the case of vim-addon-manager means addon-info.json files aren't syntax highlighted at all (https://github.com/MarcWeber/vim-addon-manager/issues/163).

      David

      --
      --
      You received this message from the "vim_dev" 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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • David Fishburn
      +1 -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are replying to. For more information,
      Message 2 of 6 , Jul 15, 2014
      • 0 Attachment

        +1

        --
        --
        You received this message from the "vim_dev" 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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • LCD 47
        ... [...] How about a complete solution: https://github.com/elzr/vim-json.git I ve been using this for almost two years now, and never looked back. /lcd -- --
        Message 3 of 6 , Jul 15, 2014
        • 0 Attachment
          On 14 July 2014, David Barnett <dbarnett@...> wrote:
          > This is a patch to create a separate json filetype and use it for
          > *.json files instead of using javascript. It currently just forwards
          > indent and syntax settings to the javascript filetype, but it does
          > define its own ftplugin/json.vim file since most of the settings in
          > ftplugin/javascript.vim don't apply to JSON. I'd like to submit it to
          > be integrated in vim under the Vim license.
          [...]

          How about a complete solution:

          https://github.com/elzr/vim-json.git

          I've been using this for almost two years now, and never looked
          back.

          /lcd

          --
          --
          You received this message from the "vim_dev" 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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • 'David Barnett' via vim_dev
          Agreed. I d prefer to have full-fledged JSON support, but I d also like to get the filetype fixed ASAP. I went with a relatively minimal change for now that s
          Message 4 of 6 , Jul 15, 2014
          • 0 Attachment
            Agreed. I'd prefer to have full-fledged JSON support, but I'd also like to get the filetype fixed ASAP. I went with a relatively minimal change for now that's less likely to be controversial.

            Has anyone contacted elzr or authors of any other plugins to see if they want to merge their plugin into vim?

            David


            On Tue, Jul 15, 2014 at 3:03 PM, LCD 47 <lcd047@...> wrote:
            On 14 July 2014, David Barnett <dbarnett@...> wrote:
            > This is a patch to create a separate json filetype and use it for
            > *.json files instead of using javascript. It currently just forwards
            > indent and syntax settings to the javascript filetype, but it does
            > define its own ftplugin/json.vim file since most of the settings in
            > ftplugin/javascript.vim don't apply to JSON. I'd like to submit it to
            > be integrated in vim under the Vim license.
            [...]

                How about a complete solution:

                    https://github.com/elzr/vim-json.git

                I've been using this for almost two years now, and never looked
            back.

                /lcd

            --
            --
            You received this message from the "vim_dev" 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

            ---
            You received this message because you are subscribed to a topic in the Google Groups "vim_dev" group.
            To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_dev/TN1NLapzf44/unsubscribe.
            To unsubscribe from this group and all its topics, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.

            --
            --
            You received this message from the "vim_dev" 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

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Bram Moolenaar
            ... Yes, let s first split the filetype, improving the highlighting is a separate thing and can be done in separate steps. ... I prefer authors to explicitly
            Message 5 of 6 , Jul 16, 2014
            • 0 Attachment
              David Barnett wrote:

              > Agreed. I'd prefer to have full-fledged JSON support, but I'd also like to
              > get the filetype fixed ASAP. I went with a relatively minimal change for
              > now that's less likely to be controversial.

              Yes, let's first split the filetype, improving the highlighting is a
              separate thing and can be done in separate steps.

              > Has anyone contacted elzr or authors of any other plugins to see if they
              > want to merge their plugin into vim?

              I prefer authors to explicitly say it's OK to distribute their work with
              Vim. Usually that's by emailing me the code.

              --
              My Go, this amn keyboar oesn't have a .

              /// 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_dev" 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

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Bram Moolenaar
              ... Thanks, I ll include it. I ll remove the checks for pre-Vim 6.0, that s reeeeally old. -- Violators can be fined, arrested or jailed for making ugly faces
              Message 6 of 6 , Jul 16, 2014
              • 0 Attachment
                David Barnett wrote:

                > This is a patch to create a separate json filetype and use it for
                > *.json files instead of using javascript. It currently just forwards
                > indent and syntax settings to the javascript filetype, but it does
                > define its own ftplugin/json.vim file since most of the settings in
                > ftplugin/javascript.vim don't apply to JSON. I'd like to submit it to
                > be integrated in vim under the Vim license.
                >
                > My reasons for wanting to do this instead of just using the javascript filetype are:
                > * JSON is not JavaScript, it's a very small subset of the language.
                > Comments and many other details of JavaScript syntax are completely
                > invalid in a JavaScript file, so it's misleading to treat them as
                > the same filetype.
                > * Several plugins (syntastic, vim-snippets, vim-addon-manager) refer
                > to a "json" filetype that doesn't actually exist unless you install
                > some third-party plugin to apply it. This leads to vim unexpectedly
                > triggering "javascript" actions on "json" files, and in the case of
                > vim-addon-manager means addon-info.json files aren't syntax
                > highlighted at all
                > (https://github.com/MarcWeber/vim-addon-manager/issues/163).

                Thanks, I'll include it. I'll remove the checks for pre-Vim 6.0, that's
                reeeeally old.

                --
                Violators can be fined, arrested or jailed for making ugly faces at a dog.
                [real standing law in Oklahoma, United States of America]

                /// 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_dev" 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

                ---
                You received this message because you are subscribed to the Google Groups "vim_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              Your message has been successfully submitted and would be delivered to recipients shortly.