diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index c7db738..1371888 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -1,4 +1,5 @@ -au BufWrite * :Autoformat +autocmd BufWritePre *.ts Neoformat +let g:neoformat_try_node_exe = 1 setlocal sw=2 ts=2 setlocal fdm=indent setlocal smartindent diff --git a/init.vim b/init.vim index 72676e0..3f8e184 100644 --- a/init.vim +++ b/init.vim @@ -17,7 +17,6 @@ source mapping.vim source jsonnet.vim source nerdtree.vim source wiki.vim -source prettier.vim exec "cd " . oldwd " set up a line number on the current line but relative above and below to help diff --git a/plug.vim b/plug.vim index da319cf..4e182f9 100644 --- a/plug.vim +++ b/plug.vim @@ -56,8 +56,7 @@ Plug 'editorconfig/editorconfig-vim' " syntax checking on steroids Plug 'scrooloose/syntastic' " auto format all the things -" https://github.com/Chiel92/vim-autoformat -Plug 'Chiel92/vim-autoformat' +Plug 'sbdchd/neoformat' " Collection of common configurations for the Nvim LSP client Plug 'neovim/nvim-lspconfig' @@ -99,8 +98,6 @@ Plug 'vim-scripts/groovyindent-unix' " nvm to make JS/TS/Node easier to work with Plug 'marene/nvm.vim' -" automating format JS/TS sources -Plug 'MunifTanjim/prettier.nvim' " All of your Plugins must be added before the following line diff --git a/prettier.vim b/prettier.vim deleted file mode 100644 index 9565665..0000000 --- a/prettier.vim +++ /dev/null @@ -1,53 +0,0 @@ -" https://github.com/MunifTanjim/prettier.nvim#setup -lua < f :lua vim.lsp.buf.formatting()") - -- format on save - vim.cmd("autocmd BufWritePost lua vim.lsp.buf.formatting()") - end - - if client.resolved_capabilities.document_range_formatting then - vim.cmd("xnoremap f :lua vim.lsp.buf.range_formatting({})") - end - end, -}) - -prettier.setup({ - bin = 'prettier', -- or `prettierd` - filetypes = { - "css", - "graphql", - "html", - "javascript", - "javascriptreact", - "json", - "less", - "scss", - "typescript", - "typescriptreact", - }, - - -- prettier format options (you can use config files too. ex: `.prettierrc`) - arrow_parens = "always", - bracket_spacing = true, - embedded_language_formatting = "auto", - end_of_line = "lf", - html_whitespace_sensitivity = "css", - jsx_bracket_same_line = false, - jsx_single_quote = false, - print_width = 80, - prose_wrap = "preserve", - quote_props = "as-needed", - semi = true, - single_quote = false, - tab_width = 2, - trailing_comma = "es5", - use_tabs = false, - vue_indent_script_and_style = false, -}) -EOF