On 07/09/11 04:11, pansz wrote:
On Wed, Sep 7, 2011 at 9:48 AM, Peng Yu<[email protected]>  wrote:
On Tue, Sep 6, 2011 at 7:19 AM, Taylor Hedberg<[email protected]>  wrote:
You may have already tried this, but since JSON is just a subset of
JavaScript syntax, have you tried setting 'filetype' to "javascript"?
That's the simplest solution that comes to mind, though I don't know
whether you want JSON to be indented differently than JS.

Sorry to ask a naive question. How to let vim recognize .json file as
.javascript by default? Should I create a .vim file in ftplugin or
somewhere? Would you please show me the details?

You can have this in your .vimrc:

     autocmd BufNewFile,BufRead *.json            setf javascript


Yes, or if you have a number of similar "new filetypes" to recognize, see ":help new-filetype". The advantage of doing it that way is that ":filetype off" and "filetype on" statements will also toggle the recognition of your new filetype.

In this particular case I would recommend the method described in paragraph C under that helptag.


Best regards,
Tony.
--
"Hit any key to continue" is very confusing when you have two keyboards.

--
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

Reply via email to