add and update vim plugins with sensible defaults
[webi-installers/.git] / vim-prettier / README.md
1 ---
2 title: vim-prettier
3 homepage: https://github.com/prettier/vim-prettier
4 tagline: |
5   vim-prettier adds Prettier support for Vim.
6 ---
7
8 ## Updating `vim-prettier`
9
10 ```bash
11 webi vim-prettier
12 ```
13
14 ## Cheat Sheet
15
16 > `vim-prettier` is a vim plugin wrapper for prettier, pre-configured with
17 > custom default prettier settings.
18
19 You'll also need `ALE`, [`syntastic`](https://webinstall.dev/vim-syntastic), or
20 similar.
21
22 ### How to install by hand
23
24 ```bash
25 git clone --depth=1 https://github.com/prettier/vim-prettier ~/.vim/pack/plugins/start/vim-prettier
26 ```
27
28 ### How to configure your `.vimrc`
29
30 ```vim
31 " don't check syntax immediately on open or on quit
32 let g:syntastic_check_on_open = 1
33 let g:syntastic_check_on_wq = 0
34
35 " we also want to get rid of accidental trailing whitespace on save
36 autocmd BufWritePre * :%s/\s\+$//e
37 ```
38
39 ```vim
40 """""""""""""""""""""""""""
41 " Prettier-specific options "
42 """""""""""""""""""""""""""
43
44 " format as-you-type is quite annoying, so we turn it off
45 let g:prettier#autoformat = 0
46
47 " list all of the extensions for which prettier should run
48 autocmd BufWritePre .babelrc,.eslintrc,.jshintrc,*.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
49 ```
50
51 ### How to install Prettier
52
53 With `webi`:
54
55 ```bash
56 webi prettier
57 ```
58
59 With `node`:
60
61 ```bash
62 npm install -g prettier@2
63 ```