diff options
author | christianchiarulli <[email protected]> | 2021-07-13 01:08:03 -0400 |
---|---|---|
committer | christianchiarulli <[email protected]> | 2021-07-13 01:08:03 -0400 |
commit | 359b6fd8e44bc2ad5088aada3f9c037fb85b19af (patch) | |
tree | 970a9169fa9838c4a6bb43eecdaeec841bf87710 | |
parent | eceb656b4bdcd5bb4050c1e2566e95f97b99e20e (diff) |
protected call for formatter.nvim
-rw-r--r-- | init.lua | 1 | ||||
-rw-r--r-- | lua/core/formatter.lua | 6 | ||||
-rw-r--r-- | lua/plugins.lua | 6 |
3 files changed, 8 insertions, 5 deletions
@@ -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 |