all repos

dotfiles @ fef35c3ef0848715da74780cf5c6629284b059f1

my dotfiles

config/nvim/lua/efm.lua (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- 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}
    }
  }
}