aboutsummaryrefslogtreecommitdiff
path: root/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/html.vim2
-rw-r--r--ftplugin/xml.vim14
2 files changed, 15 insertions, 1 deletions
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