diff options
Diffstat (limited to '')
| -rw-r--r-- | ftdetect/polyglot.vim | 10 | ||||
| -rw-r--r-- | packages.yaml | 10 | ||||
| -rwxr-xr-x | scripts/test | 16 | ||||
| -rw-r--r-- | scripts/test_extensions.vim | 14 | 
4 files changed, 33 insertions, 17 deletions
| diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 2271f1ed..75e8c60e 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -1291,12 +1291,12 @@ if index(g:polyglot_disabled, 'ansible') == -1    au BufNewFile,BufRead group_vars/* set ft=yaml.ansible    au BufNewFile,BufRead handlers.*.ya?ml set ft=yaml.ansible    au BufNewFile,BufRead host_vars/* set ft=yaml.ansible -  au BufNewFile,BufRead local.ya?ml set ft=yaml.ansible -  au BufNewFile,BufRead main.ya?ml set ft=yaml.ansible -  au BufNewFile,BufRead playbook.ya?ml set ft=yaml.ansible -  au BufNewFile,BufRead requirements.ya?ml set ft=yaml.ansible +  au BufNewFile,BufRead local.y{a,}ml set ft=yaml.ansible +  au BufNewFile,BufRead main.y{a,}ml set ft=yaml.ansible +  au BufNewFile,BufRead playbook.y{a,}ml set ft=yaml.ansible +  au BufNewFile,BufRead requirements.y{a,}ml set ft=yaml.ansible    au BufNewFile,BufRead roles.*.ya?ml set ft=yaml.ansible -  au BufNewFile,BufRead site.ya?ml set ft=yaml.ansible +  au BufNewFile,BufRead site.y{a,}ml set ft=yaml.ansible    au BufNewFile,BufRead tasks.*.ya?ml set ft=yaml.ansible  endif diff --git a/packages.yaml b/packages.yaml index 8e60e801..2443bb73 100644 --- a/packages.yaml +++ b/packages.yaml @@ -1271,11 +1271,11 @@ filetypes:    - asl    - dsl    filenames: -  - playbook.ya?ml -  - site.ya?ml -  - main.ya?ml -  - local.ya?ml -  - requirements.ya?ml +  - "playbook.y{a,}ml" +  - "site.y{a,}ml" +  - "main.y{a,}ml" +  - "local.y{a,}ml" +  - "requirements.y{a,}ml"    - 'group_vars/*'    - 'host_vars/*'    - 'tasks.*.ya?ml' diff --git a/scripts/test b/scripts/test index 084d084a..88a2e973 100755 --- a/scripts/test +++ b/scripts/test @@ -2,10 +2,12 @@  set -e -vim --clean -N -u <( -  echo "filetype plugin indent on" -  echo "syntax enable" -  echo "let &rtp='$PWD,'.&rtp" -  echo "source scripts/test_filetypes.vim" -  echo "exec ':q!'" -) +vim --clean -N --cmd " +  filetype plugin indent on +  syntax enable +  let &rtp='$PWD,'.&rtp +  source ftdetect/polyglot.vim +  source scripts/test_extensions.vim +  source scripts/test_filetypes.vim +  exec ':q!' +" diff --git a/scripts/test_extensions.vim b/scripts/test_extensions.vim new file mode 100644 index 00000000..aea52f94 --- /dev/null +++ b/scripts/test_extensions.vim @@ -0,0 +1,14 @@ +function! TestExtension(filetype, filename, content) +  try +    exec "e " . a:filename +    exec "if &filetype != '" . a:filetype . "' \nthrow &filetype\nendif" +  catch +    echo 'Filename "' . a:filename  . '" does not resolve to extension "' . a:filetype . '"' +    echo '  instead received: "' . v:exception . '"' +    exec ':cq!' +  endtry +endfunction + +call TestExtension('blade', 'test.blade.php', '') +call TestExtension('yaml.ansible', 'playbook.yml', '') +call TestExtension('yaml.ansible', 'host_vars/foobar', '') | 
