diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-08 08:31:09 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-08 08:31:09 +0200 |
commit | 1993b9f68fff3cb87413fdc2e328763c291578c4 (patch) | |
tree | 045e40a0b623bfe7047cd266eac5d70d9024ead0 /scripts | |
parent | bb3de8fa5e509d5f5faf173fd1a92635a0023274 (diff) | |
download | vim-polyglot-1993b9f68fff3cb87413fdc2e328763c291578c4.tar.gz vim-polyglot-1993b9f68fff3cb87413fdc2e328763c291578c4.zip |
Fix encoding of vim files
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/build b/scripts/build index 8f46b217..573a8891 100755 --- a/scripts/build +++ b/scripts/build @@ -275,10 +275,14 @@ def copy_file(package, src, dest) output << "if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, '#{name}') == -1\n\n" end contents = File.read(input) + # fix encoding if required + contents.gsub!(/!@#%#/, "") rescue contents = contents.force_encoding('iso-8859-1').encode('utf-8') # ..= is feature of new vims... contents.gsub!(' ..= ', ' .= ') # https://github.com/vim/vim/pull/7091 - contents.gsub!('fileencoding=', 'encoding=') + contents.gsub!(/set(local)? fileencoding=utf-8/, '') + contents.gsub!(/ fileencoding=utf-8/, '') + contents.gsub!('À-ÿ', '\u00ac-\uffff') output << contents output << "\nendif\n" end @@ -476,8 +480,8 @@ def extract(packages) globs = [package.fetch("glob", package.fetch('globs', '**/*.{vim,ctags,vital,txt}'))].flatten globs.each do |glob| Dir.glob("#{subdir}/#{glob}", base: subtree).each do |p| - next unless File.file?("#{subtree}/#{p}") - copy_file(package, "#{subtree}/#{p}", p) + next unless File.file?("#{subtree}#{p}") + copy_file(package, "#{subtree}#{p}", p) end end elsif File.exist?(subpath) |