dotfiles/config/nvim/lua/efm.lua
2021-06-21 19:44:12 +03:00

45 lines
1.2 KiB
Lua

-- Python
local black = {
formatCommand = "black ${filename}", formatStdin = true
}
local flake8 = {
lintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"}
}
-- Javascript
local prettier = {
formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true
}
local eslint = {
lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}",
lintIgnoreExitCode = true,
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"},
formatCommand = "./node_modules/.bin/eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}",
formatStdin = true
}
-- GoLang
local golint = {
lintCommand = "golint",
lintIgnoreExitCode = true,
lintFormats = {"%f:%l:%c: %m"},
lintSource = "golint"
}
-- Setup
require"lspconfig".efm.setup {
init_options = {documentFormatting = true, codeAction = false},
filetypes = {"python", "javascript", "typescript", "go"},
settings = {
rootMarkers = {".git/"},
languages = {
python = {flake8, black},
javascript = {eslint, prettier},
typescript = {eslint, prettier},
go = {golint}
}
}
}