summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-10-04 19:00:16 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-10-04 19:00:16 +0200
commitd221139bd70fd474be52237dc8e6440e6da632bd (patch)
tree5b94fd6f5ffed4225d6540cb81705f7c319f4818 /scripts
parent073e4d44beb431e3846992d9145719d90d626a42 (diff)
downloadvim-polyglot-d221139bd70fd474be52237dc8e6440e6da632bd.tar.gz
vim-polyglot-d221139bd70fd474be52237dc8e6440e6da632bd.zip
Address BufWritePost error, fixes #573
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build12
1 files changed, 2 insertions, 10 deletions
diff --git a/scripts/build b/scripts/build
index 48ed10a1..fe07db70 100755
--- a/scripts/build
+++ b/scripts/build
@@ -390,17 +390,9 @@ def rule_to_code(rule)
end
if rule.has_key?("filetype")
- if rule.has_key?("fallback")
- return <<~EOS
- setf #{rule["filetype"]}
- call s:WritePostOnce('call polyglot#detect##{camelize(rule["extensions"].first)}()')
- return
- EOS
- end
-
return <<~EOS
set ft=#{rule["filetype"]} | return
- #{indent(rule_to_code(except(rule, "filetype")), 0)}
+ #{indent(rule_to_code(except(rule, "filetype", "fallback")), 0)}
EOS
end
@@ -570,7 +562,7 @@ def generate_ftdetect(packages, heuristics)
for heuristic in package_heuristics.uniq
extensions = heuristic["extensions"].map { |e| "*.#{e}" }
- autocommands << " au! BufNewFile,BufRead #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()\n"
+ autocommands << " au! BufNewFile,BufRead,BufWritePost #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()\n"
end
if autocommands != ""