Selaa lähdekoodia

Prevent multiple language servers from being spawned after every file save of init.lua (#96)

* Prevent multiple language servers from being spawned

Prevent multiple language servers from being spawned after every save of init.lua, which eventually leads to high RAM usage and system freeze.

* Supress error messages

add `silent!` in case of error message when nvim-lspconfig is not installed
amalgame21 3 vuotta sitten
vanhempi
sitoutus
c4d7212de3
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      init.lua

+ 1 - 1
init.lua

@@ -87,7 +87,7 @@ end
 -- Automatically source and re-compile packer whenever you save this init.lua
 local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
 vim.api.nvim_create_autocmd('BufWritePost', {
-  command = 'source <afile> | PackerCompile',
+  command = 'source <afile> | silent! LspStop | silent! LspStart | PackerCompile',
   group = packer_group,
   pattern = vim.fn.expand '$MYVIMRC',
 })