diff options
| -rw-r--r-- | ftplugin/html.vim | 4 | ||||
| -rw-r--r-- | ftplugin/php.vim | 10 | ||||
| -rw-r--r-- | tests/fixtures/foo.php | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/ftplugin/html.vim b/ftplugin/html.vim index e27828a..4d37544 100644 --- a/ftplugin/html.vim +++ b/ftplugin/html.vim @@ -1,6 +1,6 @@ -" markdown files run this as well +" 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 !~# 'markdown' +if &ft ==# 'html' let b:prettier_ft_default_args = { \ 'parser': 'html', \ } diff --git a/ftplugin/php.vim b/ftplugin/php.vim new file mode 100644 index 0000000..8413ded --- /dev/null +++ b/ftplugin/php.vim @@ -0,0 +1,10 @@ +let b:prettier_ft_default_args = { + \ 'parser': 'php', + \ } + +augroup Prettier + autocmd! + if get(g:, 'prettier#autoformat') + autocmd BufWritePre *.php call prettier#Autoformat() + endif +augroup end diff --git a/tests/fixtures/foo.php b/tests/fixtures/foo.php new file mode 100644 index 0000000..d8439b3 --- /dev/null +++ b/tests/fixtures/foo.php @@ -0,0 +1,4 @@ +<?php + $a='a'; + + $b = $a. $a .' asda'; |
