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 --- init.lua | 1 - lua/core/formatter.lua | 6 +++++- lua/plugins.lua | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index fcb3687f..680555f2 100644 --- a/init.lua +++ b/init.lua @@ -8,7 +8,6 @@ require "plugins" vim.g.colors_name = O.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs. require "settings" require "lv-utils" -require "core.formatter" -- TODO: these guys need to be in language files -- require "lsp" 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