blob: 9cccb61d312e6e8277dbafca9461584cfba78344 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
if exists('g:loaded_prettier')
finish
endif
let g:loaded_prettier = 1
" => Plugin config
if !exists('g:prettier#autoformat') | let g:prettier#autoformat = 1 | endif
" => Prettier CLI config
" max line lengh that prettier will wrap on
if !exists('g:prettier#config#print_width') | let g:prettier#config#print_width = 80 | endif
" number of spaces per indentation level
if !exists('g:prettier#config#tab_width') | let g:prettier#config#tab_width = 2 | endif
" use tabs over spaces
if !exists('g:prettier#config#use_tabs') | let g:prettier#config#use_tabs = 'false' | endif
" print semicolons
if !exists('g:prettier#config#semi') | let g:prettier#config#semi = 'true' | endif
" single quotes over double quotes
if !exists('g:prettier#config#single_quote') | let g:prettier#config#single_quote = 'true' | endif
" print spaces between brackets
if !exists('g:prettier#config#bracket_spacing') | let g:prettier#config#bracket_spacing = 'false' | endif
" put > on the last line instead of new line
if !exists('g:prettier#config#jsx_bracket_same_line') | let g:prettier#config#jsx_bracket_same_line = 'true' | endif
" none|es5|all
if !exists('g:prettier#config#trailing_comma') | let g:prettier#config#trailing_comma = 'all' | endif
" flow|babylon
if !exists('g:prettier#config#parser') | let g:prettier#config#parser = 'flow' | endif
command! Prettier call prettier#Prettier()
if !hasmapto('<Plug>(Prettier)') && maparg('<Leader>p', 'n') ==# ''
nmap <unique> <Leader>p <Plug>(Prettier)
endif
nnoremap <silent> <Plug>(Prettier) :Prettier<CR>
|