MarcWeber / vim-addon-manager

manage and install vim plugins (including their dependencies) in a sane way. If you have any trouble contact me. Usually I reply within 24 hours
Other
660 stars 59 forks source link

No JSON syntax highlighting for 'addon-info' filetype #163

Open dbarnett opened 10 years ago

dbarnett commented 10 years ago

Without the "addon-info" filetype being applied to addon-info files, I automatically get filetype json and syntax is correctly highlighted. With filetype automatically set to "addon-info" by vim-addon-manager, I get no syntax highlighting (since there's no syntax/addon-info.vim file anywhere), and many other plugins that pay attention to filetype don't know how to handle the "addon-info" filetype.

Is there an advantage to creating a whole new "addon-info" filetype? Can we either remove that configuration or add a syntax/addon-info.vim file that pulls in syntax/json.vim (and similarly for other filetype plugin files)?

MarcWeber commented 10 years ago

I'm pretty sure that patches would get accepted by me/ZyX. addon-info files are very small usually, so I don't think its that important to fix.

We have this code thus you can opt out easily:

if s:c.create_addon_info_handlers
  augroup VAM_addon_info_handlers
    autocmd!
    autocmd BufRead,BufNewFile *-addon-info.txt,addon-info.json
      \ setlocal ft=addon-info
      \ | setlocal syntax=json
      \ | syn match Error "^\s*'"
    autocmd BufWritePost *-addon-info.txt,addon-info.json call vam#ReadAddonInfo(expand('%', 1))
  augroup END
endif

In theory its not JSON, just a subset which Vim happens to parse. Is it worth discussing?

dbarnett commented 10 years ago

Ah, I see you are at least setting syntax=json, and my issue there is just that it interferes with vim's hack of calling JSON "javascript":

au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.json   setf javascript

At any rate, just setting an arbitrary filetype name without having any standard configuration defined is a bad experience. The disadvantages of setting an arbitrary "addon-info" filetype are that many settings keep ugly default values that are the filetype maintainer's job to override per-filetype, and plugins like syntastic that pay attention to filetype won't work properly.

What are the advantages, if any?