diff --git a/vim-prettier/prettier.vim b/vim-prettier/prettier.vim index 233a6ad..72b43ef 100644 --- a/vim-prettier/prettier.vim +++ b/vim-prettier/prettier.vim @@ -3,8 +3,15 @@ " from webinstall.dev/vim-prettier " """""""""""""""""""""""""""""""""""" -" format as-you-type is quite annoying, so we turn it off -let g:prettier#autoformat = 0 +" Change Log +" +" 2023-03-06: +" - run when filetype matches javascript +" (e.g. shebang is #!/usr/bin/env node) +" - remove explicit file extension detection +" (this now works as expected by default) -" list all of the extensions for which prettier should run -autocmd BufWritePre .babelrc,.eslintrc,.jshintrc,*.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync +augroup RunPrettierByFiletype + " run Prettier not just by file extension, but also if the filetype is detected as javascript or typescript + autocmd FileType javascript,typescript autocmd BufWritePre PrettierAsync +augroup END