Replies: 1 comment 4 replies
-
I am afraid I understand only part of the question.
So you'd like to have it in Visual mode like this:
Having this behavior is possible, but will not be officially supported. Here is a snippet: local is_vis_mode = false
local maybe_restore_vis_mode = function(context)
if is_vis_mode and context.action == 'comment' then vim.schedule(function() vim.cmd('normal! gv') end) end
is_vis_mode = false
end
local vis_operator_rhs = function()
is_vis_mode = true
return MiniComment.operator()
end
require('mini.comment').setup({ hooks = { post = maybe_restore_vis_mode } })
vim.keymap.set('x', 'gc', vis_operator_rhs, { desc = 'Comment selection', expr = true }) This basically overcomes the issue of determining whether the action meets the criteria for preserving visual selection (via
I don't really understand this. Could you elaborate? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to keep the visual selection after commenting (out) a block of code.
Also I would not like to change lines.
Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions