changeset 404:04483ffbd282

Replace efm with null-ls
author Zeger Van de Vannet <zegervdv@me.com>
date Fri, 16 Jul 2021 09:06:51 +0200
parents 483c3746730f
children 34862cc22221
files dot_config/nvim/config.lua dot_config/nvim/lua/efm/languages.lua dot_config/nvim/lua/efm/lua.lua dot_config/nvim/lua/efm/python.lua
diffstat 4 files changed, 11 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- 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')
--- 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)
--- 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
--- 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
-