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