vim-prettier adds Prettier support for Vim.

Updating vim-prettier

webi vim-prettier

Cheat Sheet

vim-prettier is a vim plugin wrapper for prettier, pre-configured with custom default prettier settings.

You'll also need ALE, syntastic, or similar.

How to install by hand

git clone --depth=1 ~/.vim/pack/plugins/start/vim-prettier

How to configure your .vimrc

" don't check syntax immediately on open or on quit
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

" we also want to get rid of accidental trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
" Prettier-specific options "

" format as-you-type is quite annoying, so we turn it off
let g:prettier#autoformat = 0

" 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

How to install Prettier

With webi:

webi prettier

With node:

npm install -g prettier@2


Report an Issue Submit Installer