Skip to content

Commit 0de948c

Browse files
authored
Merge pull request #120 from lhchavez/prettier-vue
prettier: Add support for vue
2 parents 3be5d14 + 9d57b16 commit 0de948c

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ helpfiles in the `doc/` directory. The helpfiles are also available via
2525
* Python (Autopep8 or YAPF)
2626
* TypeScript (clang-format)
2727
* Shell (shfmt)
28+
* [Vue](http://vuejs.org) (prettier)
2829

2930
# Commands
3031

@@ -86,6 +87,7 @@ augroup autoformat_settings
8687
autocmd FileType java AutoFormatBuffer google-java-format
8788
autocmd FileType python AutoFormatBuffer yapf
8889
" Alternative: autocmd FileType python AutoFormatBuffer autopep8
90+
autocmd FileType vue AutoFormatBuffer prettier
8991
augroup END
9092
```
9193

autoload/codefmt/prettier.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let s:plugin = maktaba#plugin#Get('codefmt')
1717

1818
" See https://prettier.io for a list of supported file types.
1919
let s:supported_filetypes = ['javascript', 'markdown', 'html', 'css', 'yaml',
20-
\ 'jsx', 'less', 'scss', 'mdx']
20+
\ 'jsx', 'less', 'scss', 'mdx', 'vue']
2121

2222

2323
""

vroom/prettier.vroom

+35
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,38 @@ It can format specific line ranges of code using :FormatLines.
101101
}
102102
function Greet(){if(!greeting){return null};}
103103
@end
104+
105+
It is also the default formatter for several file types.
106+
107+
@clear
108+
% f();
109+
110+
:silent file /foo/foo.markdown
111+
:set filetype=markdown
112+
:FormatCode
113+
! prettier .*--stdin-filepath /foo/foo.markdown.*2>.*
114+
$ f();
115+
116+
:silent file /foo/foo.yaml
117+
:set filetype=yaml
118+
:FormatCode
119+
! prettier .*--stdin-filepath /foo/foo.yaml.*2>.*
120+
$ f();
121+
122+
:silent file /foo/foo.jsx
123+
:set filetype=jsx
124+
:FormatCode
125+
! prettier .*--stdin-filepath /foo/foo.jsx.*2>.*
126+
$ f();
127+
128+
:silent file /foo/foo.mdx
129+
:set filetype=mdx
130+
:FormatCode
131+
! prettier .*--stdin-filepath /foo/foo.mdx.*2>.*
132+
$ f();
133+
134+
:silent file /foo/foo.vue
135+
:set filetype=vue
136+
:FormatCode
137+
! prettier .*--stdin-filepath /foo/foo.vue.*2>.*
138+
$ f();

0 commit comments

Comments
 (0)