fix(vim-prettier): run when 'filetype' is javascript, remove outdated

config
This commit is contained in:
AJ ONeal
2023-03-06 20:21:09 +00:00
parent 1b37080425
commit 480a102f64
+11 -4
View File
@@ -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 <buffer> PrettierAsync
augroup END