diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-18 20:01:12 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-08-18 20:01:12 +0200 |
commit | 6bb111eaba95b80c0e0dfd0bfb380bad19a45c77 (patch) | |
tree | f4b1061fda17d5225c123fa6cd9c9bd1ecb685e1 | |
parent | dfecb6307872d1e7cb77e9fd18fffb921b3e33bf (diff) | |
download | vim-polyglot-6bb111eaba95b80c0e0dfd0bfb380bad19a45c77.tar.gz vim-polyglot-6bb111eaba95b80c0e0dfd0bfb380bad19a45c77.zip |
Embed plugin guards
-rwxr-xr-x | build | 16 | ||||
-rw-r--r-- | plugin_guard.vim.template | 5 | ||||
-rw-r--r-- | plugin_guard_jsx.vim.template | 5 |
3 files changed, 9 insertions, 17 deletions
@@ -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() { diff --git a/plugin_guard.vim.template b/plugin_guard.vim.template deleted file mode 100644 index b2e6c31e..00000000 --- a/plugin_guard.vim.template +++ /dev/null @@ -1,5 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '%%PACK%%') == -1 - -%%CONTENT%% - -endif diff --git a/plugin_guard_jsx.vim.template b/plugin_guard_jsx.vim.template deleted file mode 100644 index 7b310c69..00000000 --- a/plugin_guard_jsx.vim.template +++ /dev/null @@ -1,5 +0,0 @@ -if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1) - -%%CONTENT%% - -endif |