mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
15 lines
515 B
VimL
15 lines
515 B
VimL
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', '')
|