From f977779693518c748d87fb5babd98f6ef411837c Mon Sep 17 00:00:00 2001 From: John Guidry Date: Fri, 10 Jul 2015 08:19:38 -0500 Subject: [PATCH] Allow disabling individual language packs --- README.md | 9 +++++++++ build | 6 ++++-- plugin_guard.vim.template | 5 +++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 plugin_guard.vim.template diff --git a/README.md b/README.md index 2f4e4e7..d5cc0fd 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,15 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [vm](https://github.com/lepture/vim-velocity) (syntax, indent, ftdetect) - [css-color](https://github.com/ap/vim-css-color) (autoload, syntax) +## Disabling a language pack + +Individual language packs can be disabled by setting `g:polyglot_disabled`. + +```viml +" ~/.vimrc +let g:polyglot_disabled = ['css-color'] +``` + ## Contributing Language packs are periodically updated using automated `build` script. diff --git a/build b/build index 7b1e587..9b7c24b 100755 --- a/build +++ b/build @@ -42,7 +42,7 @@ extract() { subdirs="$subdirs, $base" fi - copy_dir "${dir}${subtree}" "$subdir" + copy_dir "${dir}${subtree}" "$subdir" "$name" fi done @@ -67,7 +67,9 @@ copy_dir() { file_path="$(dirname "${file##$1/}")" mkdir -p "$file_path" touch "$file_path/$(basename "$file")" - cat $file >> $file_path/$(basename "$file") + + # Use comma instead of / to handle cases like c/c++ + sed -e "s,%%PACK%%,$3," -e "/%%CONTENT%%/{r $file" -e "d;}" plugin_guard.vim.template >> $file_path/$(basename "$file") done } diff --git a/plugin_guard.vim.template b/plugin_guard.vim.template new file mode 100644 index 0000000..ccf60b8 --- /dev/null +++ b/plugin_guard.vim.template @@ -0,0 +1,5 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '%%PACK%%') == -1 + + %%CONTENT%% + +endif