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

Commenting a motion #260

Open
tstelzer opened this issue Jul 31, 2016 · 1 comment
Open

Commenting a motion #260

tstelzer opened this issue Jul 31, 2016 · 1 comment
Labels

Comments

@tstelzer
Copy link

tstelzer commented Jul 31, 2016

Generally speaking plugin X does Y is not a good argument for implementing a feature, I know, however: I very much miss the ability to comment a motion, from tpopes commentary. Prepending a count helps in a way, but still lacks the precision I am used to in vim. Things like:

Comment out 3 lines up:
gc3k

... outer paragraph:
gcap

... inner braces
gcib

etc.

A workaround would be to select first, and comment out second, but a motion would be preferable.

Combining motions with the multitude of your plugins features would be brilliant indeed. Hope I am not beating a dead horse here, I haven't found a mention of motions in either the docs nor the issues.

In either case, thanks for your great plugin, just found it and am very happy using it!

@alerque
Copy link
Member

alerque commented Aug 1, 2016

I agree this would be a great thing to add. Basically it would just amount to a parallel set of functions that took a motion as a required argument and passed that range to the various comment functions rather than the current selection. You could then bind those functions however you liked. For many scenarios this would just be a reversal of the key sequence already available and one less character (comment_binding<motion> instead of v<motion><comment_binding>), but for some scenarios it would enable more flexibility because motion commands are repeatable in a way that selections are often not.

That being said the original author isn't actively developing this at all right now and I'm basically on the project as a community maintainer. Given my limited time, I'm unlikely to sit down and implement this feature anytime soon. If anybody want's to take a stab at it I will be happy to review and merge when it works.

@alerque alerque added the feature label Aug 1, 2016
timss added a commit to timss/vimconf that referenced this issue Sep 5, 2017
NERD Commenter has a few drawbacks when compared to tcomment:

- Slower to start (2.8ms vs 1.8ms on my machine)
- Lacks motion support (preservim/nerdcommenter#260)
- Clunky key bindings compared to other comment vim plugins

It does however seem to be richer with regards to settings such as
comment alignment, custom language delimiters and otherwise toggle
how comments should be done with the defaults maps. With tcomment
this seems to be defined using all the different maps rather than
tuning the "default" `gcc` or `gc` in visual mode.

There's also the third alternative vim-commentary by tpope. It's much
faster (0.193ms) while still supporting basic motions, sane toggles etc.
It does however lack support for embedded syntax, inline comments and
more that tcomment delivers.

If you want to switch back to NERD Commenter or even vim-commentary
disable this plugin and add whichever to your own config.

– https://github.com/timss/vimconf#disabling-plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants