From f7056ebef338d22a57beb669f1c6afb05bc470e4 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Sat, 28 Sep 2019 14:06:34 +0200 Subject: [PATCH] Add prettier as plugin --- init.vim | 9 ++++++--- vim/ftplugin/json.vim | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 vim/ftplugin/json.vim diff --git a/init.vim b/init.vim index 73a9e15..e59bf82 100644 --- a/init.vim +++ b/init.vim @@ -31,6 +31,7 @@ Plug 'airblade/vim-gitgutter' " git status in gutter column Plug 'radenling/vim-dispatch-neovim' " support for :Start command, needed in dadbod Plug 'lambdalisue/suda.vim' " As w!! did not work anymore in nvim Plug 'https://github.com/alok/notational-fzf-vim' " note taking +Plug 'prettier/vim-prettier', { 'do': 'npm install' } " prettier integration " html / templates{{{ Plug 'mattn/emmet-vim', { 'for': ['html', 'php', 'gohtmltmpl', 'vue', 'markdown'] } " emmet support for vim - easily create markdup wth CSS-like syntax @@ -43,8 +44,6 @@ Plug 'Glench/Vim-Jinja2-Syntax', { 'for': ['html'] } " JavaScript{{{ Plug 'gavocanov/vim-js-indent', { 'for': [ 'javascript' ]} " JavaScript indent support Plug 'moll/vim-node', { 'for': [ 'javascript', 'vue' ]} " node support -"Plug 'othree/yajs.vim', { 'for': [ 'javascript', 'vue' ]} " JavaScript syntax plugin -"Plug 'othree/es.next.syntax.vim', { 'for': [ 'javascript', 'vue' ]} " ES6 and beyond syntax Plug 'https://github.com/othree/jspc.vim', { 'for': [ 'javascript', 'vue' ]} " Function parameter completion Plug 'heavenshell/vim-jsdoc', { 'for': [ 'javascript', 'vue' ]} " Generate JSDoc comments Plug 'posva/vim-vue', { 'for': [ 'javascript', 'html', 'vue' ] } " vue.js integration @@ -241,11 +240,15 @@ let g:neocomplete#sources#omni#input_patterns.tex = \ . ')' "}}} -" C/C++ +" C/C++ {{{ autocmd FileType c,cpp,objc nnoremap f :ClangFormat autocmd FileType c,cpp,objc vnoremap f :ClangFormat "}}} +" Prettier +let g:prettier#config#tab_width = 4 +let g:prettier#exec_cmd_async = 1 + " Completion {{{ " if hidden is not set, TextEdit might fail. diff --git a/vim/ftplugin/json.vim b/vim/ftplugin/json.vim new file mode 100644 index 0000000..ff855dd --- /dev/null +++ b/vim/ftplugin/json.vim @@ -0,0 +1,2 @@ +let g:ale_fixers['json'] = ['prettier'] +let g:ale_fix_on_save = 1