Skip to content

Commit

Permalink
Added option that disables addon-info handlers
Browse files Browse the repository at this point in the history
(it would be nicer to remove them completely:
 1. there is no addon-info filetype, nobody did provide ftplugin script
 2. since we now allow 'scalar' (in order to use string() and not to write our
    own variable dumper), it is no more JSON
 3. even if it was JSON there is no json syntax in standart distribution, only
    for JSON-compatible YAML (main reason: I do not want to fight VAM about who
    will set filetype)
 4. filetype detection should be done in ftdetect script, not here
 5. syntax is not a business of autoload plugin, especially if it is refered as
    “addon manager”)
  • Loading branch information
ZyX-I committed May 8, 2012
1 parent 96f3202 commit 7af9978
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions autoload/vam.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@

" don't need a plugin. If you want to use this plugin you call Activate once
" anyway
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('%'))
augroup end

fun! vam#DefineAndBind(local,global,default)
return 'if !exists('.string(a:global).') | let '.a:global.' = '.a:default.' | endif | let '.a:local.' = '.a:global
endf
Expand Down Expand Up @@ -70,6 +61,19 @@ else
let s:c['plugin_sources']["vim-addon-manager-known-repositories"] = { 'type' : 'archive', 'url': 'http://github.com/MarcWeber/vim-addon-manager-known-repositories/tarball/master', 'archive_name': 'vim-addon-manager-known-repositories-tip.tar.gz' }
endif

let s:c['create_addon_info_handlers'] = get(s:c, 'create_addon_info_handlers', 1)

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('%'))
augroup END
endif

fun! vam#VerifyIsJSON(s)
" You must allow single-quoted strings in order for writefile([string()]) that
" adds missing addon information to work
Expand Down

0 comments on commit 7af9978

Please sign in to comment.