efm-langserver format on save

This commit is contained in:
Ray Elliott 2021-09-04 11:59:31 +01:00
parent 08ef954cd8
commit cec47a2328
1 changed files with 9 additions and 8 deletions

View File

@ -407,11 +407,12 @@ require'lspconfig'.yamlls.setup{}
require'lspconfig'.stylelint_lsp.setup{}
-- https://github.com/neovim/nvim-lspconfig/wiki
require'lspconfig'.tailwindcss.setup{}
EOF
"}}}
" #efm-langserver {{{
" npm install -g eslint_d
lua << EOF
-- EOF
-- "}}}
--[efm-langserver] {{{
-- " npm install -g eslint_d
local eslint = {
lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}",
lintStdin = true,
@ -447,7 +448,7 @@ local fixjson = {
formatCommand = "fixjson"
}
local util = require "lspconfig".util
local on_attach = function(client)
local on_attach_efm = function(client)
if client.resolved_capabilities.document_formatting then
vim.cmd [[augroup lsp_formatting]]
vim.cmd [[autocmd!]]
@ -457,7 +458,7 @@ local on_attach = function(client)
end
require "lspconfig".efm.setup {
init_options = {documentFormatting = true},
on_attach = on_attach,
on_attach = on_attach_efm,
filetypes = {"javascript", "typescript", "json", "sh", "python"},
root_dir = function(fname)
return util.root_pattern("tsconfig.json")(fname) or
@ -476,7 +477,7 @@ require "lspconfig".efm.setup {
}
EOF
" }}}
" #nvim-lspconfig (keybindings etc) {{{
" #nvim-lspconfig {{{
lua << EOF
local nvim_lsp = require('lspconfig')