From 359b6fd8e44bc2ad5088aada3f9c037fb85b19af Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 13 Jul 2021 01:08:03 -0400 Subject: protected call for formatter.nvim --- lua/core/formatter.lua | 6 +++++- lua/plugins.lua | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'lua') diff --git a/lua/core/formatter.lua b/lua/core/formatter.lua index 50dcb654..06fcb56d 100644 --- a/lua/core/formatter.lua +++ b/lua/core/formatter.lua @@ -48,8 +48,12 @@ end -- end -- end -- end +local status_ok, formatter = pcall(require, "formatter") +if not status_ok then + return +end -require("formatter").setup {} +formatter.setup {} if not O.format_on_save then vim.cmd [[if exists('#autoformat#BufWritePost') diff --git a/lua/plugins.lua b/lua/plugins.lua index 85db0d0d..129bc91d 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -82,9 +82,9 @@ return require("packer").startup(function(use) -- Formatter.nvim use { "mhartington/formatter.nvim", - -- config = function() - -- require "core.formatter" - -- end, + config = function() + require "core.formatter" + end, } -- NvimTree -- cgit v1.2.3