diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-30 01:22:44 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-30 01:22:44 +0200 |
commit | a37e7e29392b9496ffb08258d965515e9cf57a80 (patch) | |
tree | 02b51087f251bb168207a90e92520d02f3e3394b /scripts/build | |
parent | c1aac2e2794006d035c8bb9a8c7037b78e8ecbba (diff) | |
download | vim-polyglot-a37e7e29392b9496ffb08258d965515e9cf57a80.tar.gz vim-polyglot-a37e7e29392b9496ffb08258d965515e9cf57a80.zip |
Reduce startup time by avoiding calling slow au!
Diffstat (limited to 'scripts/build')
-rwxr-xr-x | scripts/build | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/build b/scripts/build index a2f43fb2..303f4641 100755 --- a/scripts/build +++ b/scripts/build @@ -395,7 +395,7 @@ def rule_to_code(rule) if rule.has_key?("filetype") if rule.has_key?("fallback") return <<~EOS - set ft=#{rule["filetype"]} | au! BufWritePost <buffer> ++once call polyglot#detect##{camelize(rule["extensions"].first)}() + set ft=#{rule["filetype"]} | au BufWritePost <buffer> ++once call polyglot#detect##{camelize(rule["extensions"].first)}() return EOS end @@ -564,7 +564,7 @@ def generate_ftdetect(packages, heuristics) end if set_globs.size > 0 - autocommands << " au! BufNewFile,BufRead #{set_globs.join(",")} #{set_command}\n" + autocommands << " au BufNewFile,BufRead #{set_globs.join(",")} #{set_command}\n" end end @@ -583,13 +583,13 @@ def generate_ftdetect(packages, heuristics) show_warnings(all_filetypes, expected_filetypes) - ftdetect = File.read('ftdetect/polyglot.vim') + ftdetect = File.read('filetype.vim') starting = '" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE' ending = '" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE' File.write( - 'ftdetect/polyglot.vim', + 'filetype.vim', ftdetect.gsub(/(?<=#{starting}\n)(.*)(?=#{ending})/m) { output } ) |