Make sure to trim whitespace from commentstring in snippets
This commit is contained in:
parent
598c389741
commit
e683120b10
@ -38,7 +38,7 @@ local function comment_prefix()
|
|||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
-- Slice commentstring prefix
|
-- 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 line = vim.api.nvim_get_current_line()
|
||||||
local cursor = vim.api.nvim_win_get_cursor(vim.api.nvim_get_current_win())
|
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
|
-- Check if the current line already has prefix before the cursor
|
||||||
@ -55,7 +55,7 @@ local function comment_suffix()
|
|||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
-- Slice commentstring suffix
|
-- 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
|
if string.len(suffix) == 0 then
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user