mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Fix ansible ftdetect
This commit is contained in:
@@ -1291,12 +1291,12 @@ if index(g:polyglot_disabled, 'ansible') == -1
|
|||||||
au BufNewFile,BufRead group_vars/* set ft=yaml.ansible
|
au BufNewFile,BufRead group_vars/* set ft=yaml.ansible
|
||||||
au BufNewFile,BufRead handlers.*.ya?ml 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 host_vars/* set ft=yaml.ansible
|
||||||
au BufNewFile,BufRead local.ya?ml set ft=yaml.ansible
|
au BufNewFile,BufRead local.y{a,}ml set ft=yaml.ansible
|
||||||
au BufNewFile,BufRead main.ya?ml set ft=yaml.ansible
|
au BufNewFile,BufRead main.y{a,}ml set ft=yaml.ansible
|
||||||
au BufNewFile,BufRead playbook.ya?ml set ft=yaml.ansible
|
au BufNewFile,BufRead playbook.y{a,}ml set ft=yaml.ansible
|
||||||
au BufNewFile,BufRead requirements.ya?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 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
|
au BufNewFile,BufRead tasks.*.ya?ml set ft=yaml.ansible
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -1271,11 +1271,11 @@ filetypes:
|
|||||||
- asl
|
- asl
|
||||||
- dsl
|
- dsl
|
||||||
filenames:
|
filenames:
|
||||||
- playbook.ya?ml
|
- "playbook.y{a,}ml"
|
||||||
- site.ya?ml
|
- "site.y{a,}ml"
|
||||||
- main.ya?ml
|
- "main.y{a,}ml"
|
||||||
- local.ya?ml
|
- "local.y{a,}ml"
|
||||||
- requirements.ya?ml
|
- "requirements.y{a,}ml"
|
||||||
- 'group_vars/*'
|
- 'group_vars/*'
|
||||||
- 'host_vars/*'
|
- 'host_vars/*'
|
||||||
- 'tasks.*.ya?ml'
|
- 'tasks.*.ya?ml'
|
||||||
|
|||||||
16
scripts/test
16
scripts/test
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
vim --clean -N -u <(
|
vim --clean -N --cmd "
|
||||||
echo "filetype plugin indent on"
|
filetype plugin indent on
|
||||||
echo "syntax enable"
|
syntax enable
|
||||||
echo "let &rtp='$PWD,'.&rtp"
|
let &rtp='$PWD,'.&rtp
|
||||||
echo "source scripts/test_filetypes.vim"
|
source ftdetect/polyglot.vim
|
||||||
echo "exec ':q!'"
|
source scripts/test_extensions.vim
|
||||||
)
|
source scripts/test_filetypes.vim
|
||||||
|
exec ':q!'
|
||||||
|
"
|
||||||
|
|||||||
14
scripts/test_extensions.vim
Normal file
14
scripts/test_extensions.vim
Normal file
@@ -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', '')
|
||||||
Reference in New Issue
Block a user