From 6bb111eaba95b80c0e0dfd0bfb380bad19a45c77 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 18 Aug 2020 20:01:12 +0200 Subject: Embed plugin guards --- build | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'build') diff --git a/build b/build index d8f38262..052b3a8a 100755 --- a/build +++ b/build @@ -102,14 +102,16 @@ copy_file() { fi mkdir -p "${file_path}" - touch "$file_in_dst" - # Use comma instead of / to handle cases like c/c++ - if [[ "${package_name}" == "jsx" ]]; then - sed -e "s,%%PACK%%,${package_name}," -e "/%%CONTENT%%/{r ${file_in_tmp}" -e "d;}" plugin_guard_jsx.vim.template >> "$file_in_dst" - else - sed -e "s,%%PACK%%,${package_name}," -e "/%%CONTENT%%/{r ${file_in_tmp}" -e "d;}" plugin_guard.vim.template >> "$file_in_dst" - fi + ( + if [[ "${package_name}" == "jsx" ]]; then + printf "if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1)\n\n" + else + printf "if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '$package_name') == -1\n\n" + fi + cat "$file_in_tmp" + printf "\nendif\n" + ) >> "$file_in_dst" } update_readme() { -- cgit v1.2.3