# HG changeset patch # User Zeger Van de Vannet # Date 1626419211 -7200 # Node ID 04483ffbd282785e777c3d2326c9ab71da409b29 # Parent 483c3746730ff192c1400f6c33a0a1a9e2172bf2 Replace efm with null-ls diff -r 483c3746730f -r 04483ffbd282 dot_config/nvim/config.lua --- a/dot_config/nvim/config.lua Fri Jul 16 08:53:07 2021 +0200 +++ b/dot_config/nvim/config.lua Fri Jul 16 09:06:51 2021 +0200 @@ -200,6 +200,10 @@ use { 'hrsh7th/vim-vsnip', requires = 'hrsh7th/vim-vsnip-integ' } use { 'glepnir/lspsaga.nvim', config = function() require'lspsaga'.init_lsp_saga {} end } use { 'rmagatti/goto-preview', config = function() require'goto-preview'.setup {} end } + use { + 'jose-elias-alvarez/null-ls.nvim', + requires='nvim-lua/plenary.nvim', + } -- Vanity use { @@ -339,6 +343,7 @@ -- LSP config local lsp = require 'lspconfig' local lsputil = require 'lspconfig.util' +local null_ls = require'null-ls' local on_attach = function(client) local nnoremap = vim.keymap.nnoremap @@ -405,27 +410,12 @@ lsp.pyright.setup { on_attach = on_attach, capabilities = capabilities } -if (vim.fn.executable('efm-langserver') == 1) then - require 'efm/python' - require 'efm/lua' - - -- May not be installed, use pcall to handle errors - -- pcall(require, 'efm/systemverilog') - pcall(require, 'efm/flp') - - local language_cfg = require 'efm/languages' - - local filetypes = {} - for lang, _ in pairs(language_cfg) do table.insert(filetypes, lang) end - - lsp.efm.setup { - on_attach = on_attach, - filetypes = filetypes, - init_options = { documentFormatting = true }, - root_dir = lsputil.root_pattern('.git', '.hg'), - settings = { rootMarkers = { '.git/', '.hg/' }, languages = language_cfg }, - } -end +null_ls.setup { + on_attach = on_attach, + sources = { + null_ls.builtins.formatting.black, + }, +} -- Try importing local config local ok, localconfig = pcall(require, 'localconfig') diff -r 483c3746730f -r 04483ffbd282 dot_config/nvim/lua/efm/languages.lua --- a/dot_config/nvim/lua/efm/languages.lua Fri Jul 16 08:53:07 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -local configs = {} - -return setmetatable({}, configs) diff -r 483c3746730f -r 04483ffbd282 dot_config/nvim/lua/efm/lua.lua --- a/dot_config/nvim/lua/efm/lua.lua Fri Jul 16 08:53:07 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -local languages = require 'efm/languages' - -languages.lua = {} - -if (vim.fn.executable('lua-format') == 1) then - table.insert(languages.lua, { - formatCommand = "lua-format -c ~/.config/lua-format/conf.yml", - formatStdin = true - }) -end diff -r 483c3746730f -r 04483ffbd282 dot_config/nvim/lua/efm/python.lua --- a/dot_config/nvim/lua/efm/python.lua Fri Jul 16 08:53:07 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -local languages = require 'efm/languages' - -languages.python = {}; - -if (vim.fn.executable('black') == 1) then - table.insert(languages.python, { formatCommand = 'black -', formatStdin = true }) -end - --- if (vim.fn.executable('flake8') == 1) then --- table.insert(languages.python, { --- lintCommand = 'flake8 --stdin-display-name ${INPUT} -', --- lintStdin = true, --- lintIgnoreExitCode = true, --- lintFormats = { '%f:%l:%c: %m' }, --- }) --- end -