It would be great adding a safe call at each plugin setting like this:
local cmp_status_ok, cmp = pcall(require, "cmp") if not cmp_status_ok then return end
Just in case the call fail, we just get a return without trying to read the rest of config file, the same for the packer config:
-- Use a protected call so we don't error out on first use local status_ok, packer = pcall(require, "packer") if not status_ok then return end
By the way pcall it is, if I am not wrong, the same as a try catch statement.
pcall
try catch
Great suggestion. I updated the git repo. Not sure if I should update this post or not. I am thinking no. And hopefully most people just go look at the source repo.
I always add an update to my posts. A lot of new devs rely on good blogs to get started.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It would be great adding a safe call at each plugin setting like this:
Just in case the call fail, we just get a return without trying to read the rest of config file, the same for the packer config:
By the way
pcall
it is, if I am not wrong, the same as atry catch
statement.Great suggestion. I updated the git repo. Not sure if I should update this post or not. I am thinking no. And hopefully most people just go look at the source repo.
I always add an update to my posts. A lot of new devs rely on good blogs to get started.