From 6a4fc2075635af160e73eb3e0f17e13f5f3f708f Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Sat, 19 Nov 2022 18:30:02 +0900 Subject: [PATCH] Fix different type checks for whitespaceprefix var --- plugin/quickcomment.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/quickcomment.lua b/plugin/quickcomment.lua index 36093d4..7d30a57 100644 --- a/plugin/quickcomment.lua +++ b/plugin/quickcomment.lua @@ -90,13 +90,13 @@ vim.g.quickcomment_togglecommentlines = function (line_start, line_end) local escaped_string_prefix = '' if vim.b.quickcomment_whitespaceprefix ~= nil then - if vim.b.quickcomment_whitespaceprefix ~= 0 - or vim.b.quickcomment_whitespaceprefix == true then + if (type(vim.b.quickcomment_whitespaceprefix) == 'number' and vim.b.quickcomment_whitespaceprefix ~= 0) + or (type(vim.b.quickcomment_whitespaceprefix) == 'boolean' and vim.b.quickcomment_whitespaceprefix == true) then escaped_string_prefix = '%s*' end elseif vim.g.quickcomment_whitespaceprefix ~= nil - and vim.g.quickcomment_whitespaceprefix ~= 0 - or vim.g.quickcomment_whitespaceprefix == true then + and (type(vim.g.quickcomment_whitespaceprefix) == 'number' and vim.g.quickcomment_whitespaceprefix ~= 0) + or (type(vim.g.quickcomment_whitespaceprefix) == 'boolean' and vim.g.quickcomment_whitespaceprefix == true) then escaped_string_prefix = '%s*' end