summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ftdetect/polyglot.vim9
-rw-r--r--packages.yaml3
-rw-r--r--plugin/polyglot.vim5
-rwxr-xr-xscripts/build77
4 files changed, 18 insertions, 76 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 87b0cf25..de4665b2 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -59,6 +59,9 @@ if !exists('g:python_highlight_all')
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
call s:SetDefault('g:python_slow_sync', 1)
endif
+
+" filetypes
+
if !has_key(s:disabled_packages, '8th')
au! BufRead,BufNewFile *.8th
endif
@@ -377,7 +380,8 @@ endif
if !has_key(s:disabled_packages, 'aptconf')
au BufNewFile,BufRead */.aptitude/config setf aptconf
- au BufNewFile,BufRead */etc/apt/apt.conf.d/{[-_[:alnum:]]\+,[-_.[:alnum:]]\+.conf} setf aptconf
+ au BufNewFile,BufRead */etc/apt/apt.conf.d/*.conf setf aptconf
+ au BufNewFile,BufRead */etc/apt/apt.conf.d/[^.]* setf aptconf
au BufNewFile,BufRead apt.conf setf aptconf
endif
@@ -1722,6 +1726,9 @@ if !has_key(s:disabled_packages, 'trasys')
au! BufNewFile,BufRead *.inp call polyglot#DetectInpFiletype()
endif
+
+" end filetypes
+
au BufNewFile,BufRead,StdinReadPost *
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
\ | call polyglot#Heuristics() | endif
diff --git a/packages.yaml b/packages.yaml
index 1ff3f0eb..ca5de3a3 100644
--- a/packages.yaml
+++ b/packages.yaml
@@ -179,7 +179,8 @@ filetypes:
filenames:
- apt.conf
- '*/.aptitude/config'
- - '*/etc/apt/apt.conf.d/{[-_[:alnum:]]\+,[-_.[:alnum:]]\+.conf}'
+ - '*/etc/apt/apt.conf.d/[^.]*'
+ - '*/etc/apt/apt.conf.d/*.conf'
---
name: arch
remote: vim/vim:runtime
diff --git a/plugin/polyglot.vim b/plugin/polyglot.vim
index db2976e6..ccdef112 100644
--- a/plugin/polyglot.vim
+++ b/plugin/polyglot.vim
@@ -19,6 +19,11 @@ endif
let g:loaded_sleuth = 1
let g:loaded_polyglot = 1
+" Makes shiftwidth to be synchronized with tabstop by default
+if &shiftwidth == &tabstop
+ let &shiftwidth = 0
+endif
+
function! s:guess(lines) abort
let options = {}
let ccomment = 0
diff --git a/scripts/build b/scripts/build
index 892424aa..c7f4846f 100755
--- a/scripts/build
+++ b/scripts/build
@@ -371,69 +371,7 @@ def extract(packages)
end
def generate_ftdetect(packages, heuristics)
- output = <<~EOS
- " don't spam the user when Vim is started in Vi compatibility mode
- let s:cpo_save = &cpo
- set cpo&vim
-
- " Disable all native vim ftdetect
- if exists('g:polyglot_test')
- autocmd!
- endif
-
- let s:disabled_packages = {}
-
- if exists('g:polyglot_disabled')
- for pkg in g:polyglot_disabled
- let s:disabled_packages[pkg] = 1
- endfor
- endif
-
- function! s:SetDefault(name, value)
- if !exists(a:name)
- let {a:name} = a:value
- endif
- endfunction
-
- call s:SetDefault('g:markdown_enable_spell_checking', 0)
- call s:SetDefault('g:markdown_enable_input_abbreviations', 0)
- call s:SetDefault('g:markdown_enable_mappings', 0)
-
- " Enable jsx syntax by default
- call s:SetDefault('g:jsx_ext_required', 0)
-
- " Needed for sql highlighting
- call s:SetDefault('g:javascript_sql_dialect', 'sql')
-
- " Make csv loading faster
- call s:SetDefault('g:csv_start', 1)
- call s:SetDefault('g:csv_end', 2)
-
- " Disable json concealing by default
- call s:SetDefault('g:vim_json_syntax_conceal', 0)
-
- call s:SetDefault('g:filetype_euphoria', 'elixir')
-
- if !exists('g:python_highlight_all')
- call s:SetDefault('g:python_highlight_builtins', 1)
- call s:SetDefault('g:python_highlight_builtin_objs', 1)
- call s:SetDefault('g:python_highlight_builtin_types', 1)
- call s:SetDefault('g:python_highlight_builtin_funcs', 1)
- call s:SetDefault('g:python_highlight_builtin_funcs_kwarg', 1)
- call s:SetDefault('g:python_highlight_exceptions', 1)
- call s:SetDefault('g:python_highlight_string_formatting', 1)
- call s:SetDefault('g:python_highlight_string_format', 1)
- call s:SetDefault('g:python_highlight_string_templates', 1)
- call s:SetDefault('g:python_highlight_indent_errors', 1)
- call s:SetDefault('g:python_highlight_space_errors', 1)
- call s:SetDefault('g:python_highlight_doctests', 1)
- call s:SetDefault('g:python_highlight_func_calls', 1)
- call s:SetDefault('g:python_highlight_class_vars', 1)
- call s:SetDefault('g:python_highlight_operators', 1)
- call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
- call s:SetDefault('g:python_slow_sync', 1)
- endif
- EOS
+ output = "\n"
extensions = Hash.new { |h, k| h[k] = [] }
@@ -542,18 +480,9 @@ def generate_ftdetect(packages, heuristics)
output << "endif\n\n"
end
-
- output << <<~EOS
- au BufNewFile,BufRead,StdinReadPost *
- \\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
- \\ | call polyglot#Heuristics() | endif
-
- " restore Vi compatibility settings
- let &cpo = s:cpo_save
- unlet s:cpo_save
- EOS
- File.write('ftdetect/polyglot.vim', output)
+ ftdetect = File.read('ftdetect/polyglot.vim')
+ File.write('ftdetect/polyglot.vim', ftdetect.gsub(/(?<=" filetypes\n).*(?=\n" end filetypes)/m, output))
output = <<~EOS
" Line continuation is used here, remove 'C' from 'cpoptions'