diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fafaacc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,25 @@ +; .editorconfig + +root = true + +[**.js] +path = ~/.vim/bundle/js-beautify/js/lib/beautify.js +bin = node +ident_size=2 +ident_style = space +brace_style = collapse +charset = utf-8 +trim_trailing_whitespace = true +wrap_line_length = 120 +max_preserve_newlines = 2 + +[**.css] +path = ~/.vim/bundle/js-beautify/js/lib/beautify-css.js +ident_style = space +ident_size = 2 + +[**.html] +ident_style = space +ident_size = 2 +max_char = 120 +brace_style = expand diff --git a/vimrc b/vimrc index 1f8152a..eca64cd 100644 --- a/vimrc +++ b/vimrc @@ -64,6 +64,9 @@ Bundle 'lambdatoast/elm.vim' " -- reload browser on change Bundle 'Bogdanp/browser-connect.vim' +Bundle 'maksimr/vim-jsbeautify' +Bundle 'einars/js-beautify' + filetype on " ################### @@ -223,3 +226,10 @@ endif " --- type ° to search the word in all files in the current dir nmap ° :Ag =expand("") + +" -- js beautifer +autocmd FileType javascript noremap :call JsBeautify() +autocmd FileType html noremap :call JsBeautify() +autocmd FileType css noremap :call JsBeautify() + +" set noswapfile