diff --git a/modules/vim/init.lua b/modules/vim/init.lua index 9f85f65..712df7d 100644 --- a/modules/vim/init.lua +++ b/modules/vim/init.lua @@ -4,20 +4,22 @@ vim.opt.whichwrap = "" vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pylyzer" }) -lvim.format_on_save = true - -local formatters = require "lvim.lsp.null-ls.formatters" -formatters.setup { - { exe = "nixpkgs-fmt", filetypes = { "nix" } }, - { exe = "black", filetypes = { "python" } }, - { - name = "prettier", - filetypes = { - "html", - "json", - "js", - "typescript", - "yaml" +-- null-ls is missing on first-run. only do this if null-ls exists +if pcall(require, "null-ls") then + lvim.format_on_save = true + local formatters = require "lvim.lsp.null-ls.formatters" + formatters.setup { + { exe = "nixpkgs-fmt", filetypes = { "nix" } }, + { exe = "black", filetypes = { "python" } }, + { + name = "prettier", + filetypes = { + "html", + "json", + "js", + "typescript", + "yaml" + }, }, - }, -} + } +end