comparison dot_config/nvim/config.lua @ 323:3b25f3aa7014

Use efm folders to store efm configuration per language To add a language configuration: - create a file under lua/efm/<filetype>.lua - require the langauges table from efm/languages - add the configuration
author zegervdv <zegervdv@me.com>
date Mon, 21 Dec 2020 17:16:16 +0100
parents deb606f02fc4
children 64a0c6cec54c
comparison
equal deleted inserted replaced
322:deb606f02fc4 323:3b25f3aa7014
128 on_attach = on_attach; 128 on_attach = on_attach;
129 } 129 }
130 end 130 end
131 131
132 if (vim.fn.executable('efm-langserver') == 1) then 132 if (vim.fn.executable('efm-langserver') == 1) then
133 languages = {}; 133 require 'efm/python'
134 134
135 languages.python = {}; 135 -- May not be installed, use pcall to handle errors
136 if (vim.fn.executable('black') == 1) then 136 pcall(require, 'efm/systemverilog')
137 table.insert(languages.python, { 137
138 formatCommand = "black -", 138 local language_cfg = require'efm/languages'
139 formatStdin = true
140 })
141 end
142 if (vim.fn.executable('flake8') == 1) then
143 table.insert(languages.python, {
144 lintCommand = "flake8 --stdin-display-name ${INPUT} -",
145 lintStdin = true,
146 lintIgnoreExitCode = true,
147 lintFormats = {"%f:%l:%c: %m"}
148 })
149 end
150 139
151 lsp.efm.setup{ 140 lsp.efm.setup{
152 on_attach = on_attach; 141 on_attach = on_attach;
153 init_options = {documentFormatting = true}; 142 init_options = {documentFormatting = true};
154 root_dir = lsputil.root_pattern('.git', '.hg'); 143 root_dir = lsputil.root_pattern('.git', '.hg');
155 settings = { 144 settings = {
156 rootMarkers = {".git/", ".hg/"}, 145 rootMarkers = {".git/", ".hg/"},
157 languages = languages 146 languages = language_cfg
158 }; 147 };
159 } 148 }
160 end 149 end