From e683120b1053de3f1579ee1eefe1e774c23519e1 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Fri, 8 Mar 2024 15:31:52 +0000 Subject: [PATCH] Make sure to trim whitespace from commentstring in snippets --- snippets/all.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/all.lua b/snippets/all.lua index 2191629..d25440d 100644 --- a/snippets/all.lua +++ b/snippets/all.lua @@ -38,7 +38,7 @@ local function comment_prefix() return '' end -- Slice commentstring prefix - local prefix = string.sub(vim.bo.commentstring, 1, split - 1) + local prefix = vim.trim(string.sub(vim.bo.commentstring, 1, split - 1)) local line = vim.api.nvim_get_current_line() local cursor = vim.api.nvim_win_get_cursor(vim.api.nvim_get_current_win()) -- Check if the current line already has prefix before the cursor @@ -55,7 +55,7 @@ local function comment_suffix() return '' end -- Slice commentstring suffix - local suffix = string.sub(vim.bo.commentstring, split + 2, -1) + local suffix = vim.trim(string.sub(vim.bo.commentstring, split + 2, -1)) if string.len(suffix) == 0 then return '' end