From 66c1a7c8fcba6ef118469e0845ddd8638069d35a Mon Sep 17 00:00:00 2001 From: mitermayer Date: Sat, 15 Feb 2020 09:49:17 +0000 Subject: Added support for prettier xml plugin - updated package.json deps - added tests - updated lock file --- ftplugin/html.vim | 2 +- ftplugin/xml.vim | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 ftplugin/xml.vim (limited to 'ftplugin') diff --git a/ftplugin/html.vim b/ftplugin/html.vim index 4d37544..c0c39b4 100644 --- a/ftplugin/html.vim +++ b/ftplugin/html.vim @@ -1,6 +1,6 @@ " markdown/php files run this as well " https://stackoverflow.com/questions/22839269/why-does-vim-default-markdown-ftplugin-source-html-ftplugins-is-there-any-ways -if &ft ==# 'html' +if expand("%:e") ==# 'html' let b:prettier_ft_default_args = { \ 'parser': 'html', \ } diff --git a/ftplugin/xml.vim b/ftplugin/xml.vim new file mode 100644 index 0000000..70aec32 --- /dev/null +++ b/ftplugin/xml.vim @@ -0,0 +1,14 @@ +" markdown/php files run this as well +" https://stackoverflow.com/questions/22839269/why-does-vim-default-markdown-ftplugin-source-html-ftplugins-is-there-any-ways +if expand("%:e") ==# 'xml' + let b:prettier_ft_default_args = { + \ 'parser': 'xml', + \ } +endif + +augroup Prettier + autocmd! + if get(g:, 'prettier#autoformat') + autocmd BufWritePre *.xml call prettier#Autoformat() + endif +augroup end -- cgit v1.3