Friday, October 31, 2014

Trouble using blockwise actions on visual selections in a function/command

I'm trying to extend a "copy and comment" action (leveraging one of the numerous "smart comment" plugins). I've a simple line-wise command and was trying to extend to it work on a visual selection.

It looks like vim is set to work linewise (and only linewise) here. Which is not ideal, as rather then commenting a block all at once, I end up with single line comment -> copy repetitions.

Things I've tried:

A command with -range. This is meant to work in a blockwise fashion

A mapping to a function. I have trouble getting the start end end lines. I've tried using `< and `> but these values don't get set (maybe the function is called too soon?).

It seems like there should be a way to manipulate visual blocks in a function, but it's not clear to me. Can someone offer assistance?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment