From b824717c682b664ff3d2c4e9651bf0d2762c006c Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 13 Dec 2022 12:53:37 +0100 Subject: [PATCH] vim: prevent errors on startup when plugins are not installed --- config/nvim/after/plugin/lualine.lua | 7 ++++++- config/nvim/after/plugin/tabular.lua | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/nvim/after/plugin/lualine.lua b/config/nvim/after/plugin/lualine.lua index f07bed0..932003e 100644 --- a/config/nvim/after/plugin/lualine.lua +++ b/config/nvim/after/plugin/lualine.lua @@ -1,3 +1,8 @@ +local ok, lualine = pcall(require, 'lualine') +if not ok or not lualine then + return +end + local MODE_MAP = { ['n'] = 'Normal ', ['no'] = 'O-Pend ', @@ -151,7 +156,7 @@ local inactive_sections = { lualine_z = { 'location' }, } -require('lualine').setup { +lualine.setup { options = { icons_enabled = true, component_separators = { left = '', right = '' }, diff --git a/config/nvim/after/plugin/tabular.lua b/config/nvim/after/plugin/tabular.lua index 1635b9d..562cece 100644 --- a/config/nvim/after/plugin/tabular.lua +++ b/config/nvim/after/plugin/tabular.lua @@ -1,4 +1,4 @@ -if not vim.fn.exists('g:tabular_loaded') then return end +if vim.fn.exists('g:tabular_loaded') ~= 1 then return end vim.cmd [[ AddTabularPattern! first_comma /^[^,]*\zs,/ ]] vim.cmd [[ AddTabularPattern! first_colon /^[^:]*\zs:/ ]]