Skip to content

Instantly share code, notes, and snippets.

@awinograd
Last active April 16, 2017 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awinograd/e3d87c670050a3233c3f63db839f23ba to your computer and use it in GitHub Desktop.
Save awinograd/e3d87c670050a3233c3f63db839f23ba to your computer and use it in GitHub Desktop.
vimrc for prettier
autocmd FileType javascript set formatprg=prettier\ --stdin\ --single-quote\ --trailing-comma\ es5
autocmd FileType javascript.jsx set formatprg=prettier\ --stdin\ --single-quote\ --trailing-comma\ es5
nnoremap <silent> <leader>p gggqG<CR>
" I decided to disable running prettier on save b/c of how
" it loses the cursor position and instead just use `<leader>p` occasionally
" That said, here are the commands I used for auto-prettier on save
" autocmd BufWritePre *.js exe "normal! gggqG\<C-o>\<C-o>"
" autocmd BufWritePre *.jsx exe "normal! gggqG\<C-o>\<C-o>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment