Make sure to trim whitespace from commentstring in snippets
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user