Skip to content

Commit 371187c

Browse files
authored
Merge branch 'master' into master
2 parents 9969f9c + cb54aff commit 371187c

File tree

7 files changed

+23
-11
lines changed

7 files changed

+23
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ yarn|npm installed globally.
4343
" post install (yarn install | npm install) then load plugin only for editing supported files
4444
Plug 'prettier/vim-prettier', {
4545
\ 'do': 'yarn install',
46-
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] }
46+
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'svelte', 'yaml', 'html'] }
4747
```
4848

4949
or simply enable for all formats by:
@@ -225,7 +225,7 @@ To run vim-prettier not only before saving, but also after changing text or leav
225225
" when running at every change you may want to disable quickfix
226226
let g:prettier#quickfix_enabled = 0
227227
228-
autocmd TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
228+
autocmd TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.svelte,*.yaml,*.html PrettierAsync
229229
```
230230

231231
### Overwrite default prettier configuration

doc/prettier.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ node and yarn|npm installed globally.
4747
Plug 'prettier/vim-prettier', {
4848
\ 'do': 'yarn install',
4949
\ 'for': ['javascript', 'typescript', 'css',
50-
\ 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml',
50+
\ 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'svelte', 'yaml',
5151
'html'] }
5252
<
5353
or simply enable for all formats by:
@@ -146,17 +146,17 @@ First ensure that `g:prettier#autoformat` is not enabled on your `vimrc` (it sho
146146

147147
Running before saving sync:
148148
>
149-
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html Prettier
149+
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.svelte,*.yaml,*.html Prettier
150150
<
151151
Running before saving async (vim 8+):
152152
>
153-
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
153+
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.svelte,*.yaml,*.html PrettierAsync
154154
<
155155
Running before saving, changing text or leaving insert mode:
156156
>
157157
" when running at every change you may want to disable quickfix
158158
let g:prettier#quickfix_enabled = 0
159-
autocmd BufWritePre,TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
159+
autocmd BufWritePre,TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.svelte,*.yaml,*.html PrettierAsync
160160
<
161161
Buffer-level custom commands
162162

ftdetect/svelte.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
augroup PrettierFileDetect
2+
autocmd BufNewFile,BufReadPost *.svelte setfiletype svelte
3+
augroup end

ftplugin/svelte.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let b:prettier_ft_default_args = {
2+
\ 'parser': 'svelte',
3+
\ }

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
"@prettier/plugin-php": "^0.16.3",
1818
"@prettier/plugin-ruby": "^0.8.0",
1919
"@prettier/plugin-xml": "^0.7.2",
20+
"prettier-plugin-svelte": "^2.3.1",
2021
"prettier": "^2.3.1"
2122
},
2223
"devDependencies": {
2324
"colors": "^1.3.2",
2425
"jest": "^23.6.0",
2526
"vim-driver": "^1.0.0"
2627
}
27-
}
28+
}

plugin/prettier.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,5 @@ nnoremap <silent> <Plug>(PrettierCliPath) :PrettierCliPath<CR>
174174
175175
augroup Prettier
176176
autocmd!
177-
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.gql,*.markdown,*.md,*.mdown,*.mkd,*.mkdn,*.mdx,*.vue,*.yml,*.yaml,*.html,*.php,*.rb,*.ruby,*.xml noautocmd call prettier#Autoformat()
177+
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.gql,*.markdown,*.md,*.mdown,*.mkd,*.mkdn,*.mdx,*.vue,*.svelte,*.yml,*.yaml,*.html,*.php,*.rb,*.ruby,*.xml noautocmd call prettier#Autoformat()
178178
augroup end

yarn.lock

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,11 @@ preserve@^0.2.0:
26552655
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
26562656
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
26572657

2658+
prettier-plugin-svelte@^2.3.1:
2659+
version "2.3.1"
2660+
resolved "https://registry.yarnpkg.com/prettier-plugin-svelte/-/prettier-plugin-svelte-2.3.1.tgz#926184a490549688dbea0a8d61c1b1ae20218368"
2661+
integrity sha512-F1/r6OYoBq8Zgurhs1MN25tdrhPw0JW5JjioPRqpxbYdmrZ3gY/DzHGs0B6zwd4DLyRsfGB2gqhxUCbHt/D1fw==
2662+
26582663
prettier@>=1.10, prettier@^1.16.4:
26592664
version "1.19.1"
26602665
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz"
@@ -3542,9 +3547,9 @@ write-file-atomic@^2.1.0:
35423547
signal-exit "^3.0.2"
35433548

35443549
ws@^5.2.0:
3545-
version "5.2.2"
3546-
resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f"
3547-
integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==
3550+
version "5.2.3"
3551+
resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.3.tgz#05541053414921bc29c63bee14b8b0dd50b07b3d"
3552+
integrity sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==
35483553
dependencies:
35493554
async-limiter "~1.0.0"
35503555

0 commit comments

Comments
 (0)