Skip to content
New issue

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

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

Already on GitHub? # to your account

Make ]o (comment textobject) something else #1764

Closed
pickfire opened this issue Mar 7, 2022 · 11 comments · Fixed by #3782
Closed

Make ]o (comment textobject) something else #1764

pickfire opened this issue Mar 7, 2022 · 11 comments · Fixed by #3782
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements

Comments

@pickfire
Copy link
Contributor

pickfire commented Mar 7, 2022

Only problem with # is that it is a shifted key usually, making it harder to quickly use, and breaks the pattern of using a letter for the other textobjects. That said, maybe we open an issue for further discussion?

Originally posted by @EpocSquadron in #1605 (comment)

The issue with ]o is that it in not intuitive, o does not have any link to comment, maybe # will work better I guess, but if we want more consistency, maybe we can change ctrl-c to #, which makes it similar to other languages. Alternatively / could be used I think.

@EpocSquadron
Copy link
Contributor

Another issue with making it a symbol is that if someone is trying to select inside a pair of symbols, we preclude them from doing that. It's common enough in the web world for example to use # as the delimiter for a regex string, to avoid having to escape every / in a url pattern.

On the other hand I would actually prefer to have # be the binding in normal mode for commenting.

@EpocSquadron
Copy link
Contributor

Just to fill in, o was chosen because it is the second letter, and m was already taken. t or n are also in the word, but feel more likely to be needed for something else.

@pickfire
Copy link
Contributor Author

pickfire commented Mar 8, 2022

What about /?

@kirawi kirawi added A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements labels Mar 8, 2022
@EpocSquadron
Copy link
Contributor

IMO same problem as #, it's used as a delimiter for regexes in many languages, and had the meaning of relating to search elsewhere. Between the two I would pick #. I still think a letter is the best option though.

@EpocSquadron
Copy link
Contributor

Another possibility might be too reclaim c for comment, then change the class textobject to something like s for struct, or something.

@pickfire
Copy link
Contributor Author

pickfire commented Mar 9, 2022

I wonder what @sudormrfbin think about it since he chose the keys for class.

@sudormrfbin
Copy link
Member

I personally like the current keybinds, both ]o for comment and ]c for class. o doesn't seem too bad for comment since it's the second letter, and there's always the infobox to help you along if you forget the correct key ;)

@pickfire
Copy link
Contributor Author

Ah, then I guess we should close this issue then since we don't see any better alternatives?

@jeyj0
Copy link

jeyj0 commented Mar 15, 2022

Personally, I would be for reclaiming c for comment. Comments exist in pretty much every programming language, and it's pretty common to interact with them (at least for me).

@zyansheep
Copy link

One advantage to o is that it is close to the [ key, making it a one-handed chord. [c is a little bit slower to hit, especially if you wanna spam [o[o[o[o[o[o[o[o to skip between comments fast. Not sure how major of a use-case this is though...

Try this on your keyboard to see which one is faster: [o[o[o[o[o[o[o[o vs [c[c[c[c[c[c[c[c[c[c

@jeyj0
Copy link

jeyj0 commented Jun 14, 2022

  1. If you need to "spam" a key combination, you should probably have used another way to move instead
  2. This argumentation depends on a default layout. For me, [c is one-handed, while [o isn't. "Location" of keys should rarely be a factor, in my opinion

@the-mikedavis the-mikedavis linked a pull request Sep 10, 2022 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-keymap Area: Keymap and keybindings C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants