From 480a102f642746794ea0978b23d175b47e189c46 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 6 Mar 2023 09:04:16 +0000 Subject: [PATCH] fix(vim-prettier): run when 'filetype' is javascript, remove outdated config --- vim-prettier/prettier.vim | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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