Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added toggle block to single comment when single config is nil #9

Merged
merged 4 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/nvim-commaround/commaround.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ local function toggle_block(filetype_config, context)
end
end

local function toggle_single(filetype_config)
local function toggle_single(filetype_config, context)
if filetype_config['single'] == nil then
print('no single line comment available')
toggle_block(filetype_config, context)
return nil
end
if not is_comment_single(filetype_config) then
Expand Down
1 change: 1 addition & 0 deletions lua/nvim-commaround/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ local config = {
tex = {single = "%", block = nil},
typescript = {single = "//", block = {left = "/*", right = "*/"}},
vim = {single = "\"", block = nil},
xml = {single = nil, block = {left = "<!--", right = "-->"}},
}

return {
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-commaround/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local function toggle_comment()
if #lines > 1 then
comments.toggle_block(filetype_config, context)
else
comments.toggle_single(filetype_config)
comments.toggle_single(filetype_config, context)
end
end

Expand Down