Replace autoformat and prettier with neoformat
This commit is contained in:
parent
671dbd3bf9
commit
151a65cf23
4 changed files with 3 additions and 59 deletions
|
@ -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
|
||||
|
|
1
init.vim
1
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
|
||||
|
|
5
plug.vim
5
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
|
||||
|
|
53
prettier.vim
53
prettier.vim
|
@ -1,53 +0,0 @@
|
|||
" https://github.com/MunifTanjim/prettier.nvim#setup
|
||||
lua <<EOF
|
||||
local null_ls = require("null-ls")
|
||||
local prettier = require("prettier")
|
||||
|
||||
null_ls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.cmd("nnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.formatting()<CR>")
|
||||
-- format on save
|
||||
vim.cmd("autocmd BufWritePost <buffer> lua vim.lsp.buf.formatting()")
|
||||
end
|
||||
|
||||
if client.resolved_capabilities.document_range_formatting then
|
||||
vim.cmd("xnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.range_formatting({})<CR>")
|
||||
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
|
Loading…
Reference in a new issue