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

Change the default Toggle Comment shortcut from Ctrl + K to Ctrl + # #3822

Closed
SolsticeProjekt opened this issue Jan 18, 2022 · 21 comments · Fixed by godotengine/godot#83109
Closed
Milestone

Comments

@SolsticeProjekt
Copy link

Describe the project you are working on

This regards all source code written in the editor, by everyone who uses it.

My apologies if this is not the place to post a suggestions for the editor,
but two pages directed me to github for proposals.

Describe the problem or limitation you are having in your project

As a heavy user of Sublime, CTRL+K screws with my muscle memory and now I am repeatedly using the wrong shortcut.
In both editors. It's a horribly distracting, accumulative waste of life-time. It's not just the second I'm losing to this,
but the "being ripped out of my flow" causing frustration.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I propose this shortcut for being added as a default, because I am used to it in Sublime. It's incredibly intuitive being able to comment out a line at the press of the key that's actually used for commenting. I can understand that I could just get used to using CTRL+K, but I have reasons why I believe it should be CTRL+# instead of CTRL+K.

  1. Sublime has a userbase of 17 million people (according to careerkarma.com), who are used to using CTRL+[Un-/Comment Character].
  2. It makes a lot of sense to have the shortcut be CTRL+[Un-/Comment Character] and there is no obvious connection between comments and the letter K, not counting german's word "Kommentar".
  3. All of those who also use Sublime don't have to change the shortcuts or screw with their muscle memory.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Uh ...

[Grand Vision of Sublime's Users' workflow becoming a tiny bit more optimized/less disrupted]

If this enhancement will not be used often, can it be worked around with a few lines of script?

My proposal is related to the editor.
My apologies if this is not the correct place.
If so, please point me to where it belongs.

Is there a reason why this should be core and not an add-on in the asset library?

It's a convenience issue, which, I believe, should be in the editor by default.

In my admittedly worthless opinion this short-cut should be default across all text editors ever,
simply because it makes intuitive sense to have CTRL+[Comment Character] as the hotkey for un-/commenting a line.

Thank you for your scaringly valuable time.

@YuriSizov
Copy link
Contributor

YuriSizov commented Jan 18, 2022

As a heavy user of Sublime, CTRL+K screws with my muscle memory and now I am repeatedly using the wrong shortcut.

I propose this shortcut for being added as a default, because I am used to it in Sublime.

Well, I thank you for being so candid (emphasis mine) 🙃 However, we cannot change defaults based on some user's personal preference. You can, however, rebind the shortcut however you want using the editor settings.

All of those who also use Sublime don't have to change the shortcuts or screw with their muscle memory.

You can always keep using Sublime with Godot by connecting to Godot editor's LSP for GDScript.

I have reasons why I believe it should be CTRL+# instead of CTRL+K

I have one for the opposite: there is no Ctrl + # in my keyboard layout. It would be Ctrl + Shift + 3 for me. Not helpful at all.

@Mickeon
Copy link

Mickeon commented Jan 18, 2022

For me, the CTRL + K shortcut is pretty far away. Furthermore, in my keyboard layout, # is not an easily accessible character, either. I mapped the shortcut to CTRL + Q and I have been quite comfortable with it, and I look forward to do something similar in future IDEs I'm going to use.

That's to say, that shortcuts can be highly personal. They vary as a result of personal taste, coding style, habits, past experience, and of course, keyboard layout.
But fortunately, keyboard shortcuts can be personalized from the default, without impacting any other user's preferences.

@Calinou Calinou changed the title In the editor, please add CTRL+# as hotkey for un-/commenting a line. Change the default Toggle Comment shortcut from Ctrl + K to Ctrl + # Jan 18, 2022
@AhmedElTabarani
Copy link

AhmedElTabarani commented Jan 19, 2022

In Vscode and most IDE, we use Ctrl + / so we can use the same shortcut ?

In mac Command + /

@Mickeon
Copy link

Mickeon commented Jan 19, 2022

When I was first beginning with Godot, something about the CTRL + K hit well.
Shortcuts are always really overwhelming to learn and master. CTRL + D makes sense to me because the "D" stands for "Duplicate". Likewise, "O" stands for "Open...", and further modifier keys change its subject ("Quick Open Scene, Open Script"...).
I personally associate the "K" in the shortcut to "Komment". It's not quite right, but like the aforementioned shortcuts, I don't find it ambiguous, it makes them easier to remember.
Unfortunately, unlike most characters, "#" is not very consistent across all keyboards. On some, CTRL + # may even be inaccessible.

In Vscode and most IDE, we use Ctrl + / so we can use the same shortcut ?

Ctrl + / in GDScript specifically wouldn't make much sense. There have been proposals to use "//", but comments in GDScript can only be done with "#" as it is. In a way, the original proposal seems more reasonable.

@Xrayez
Copy link
Contributor

Xrayez commented Jan 19, 2022

I don't recommend writing proposals for changing the defaults in Godot proposals, because these kind of suggestions are met with some pushback from the core developers. At least, make the proposal in the form of the poll for people to choose from.

Godot's philosophy is the following: do not change the default, unless there's a new solution that would benefit from changing the default. For example, there was a discussion at Rocket Chat when I proposed to change the default clear color. See Akien's comment:

So I tend to side with "no change to defaults" until we can actually implement something really useful, and not just add more small hacks.


My apologies if this is not the place to post a suggestions for the editor,
but two pages directed me to github for proposals.

No worries, unfortunately there's simply no suitable place to create polls. But hopefully GitHub Discussions may be enabled for things like this, see #2069.

@Xrayez
Copy link
Contributor

Xrayez commented Jan 19, 2022

Ctrl + / in GDScript specifically wouldn't make much sense. There have been proposals to use "//", but comments in GDScript can only be done with "#" as it is. In a way, the original proposal seems more reasonable.

I'm for Ctrl + /. I think it's not tied to specific comment style, because it works correctly depending on a language you're editing in IDE (at least that's the way in VS Code).

@jcostello
Copy link

Ctrl + / is more common in other IDEs. I would use it

@SolsticeProjekt
Copy link
Author

SolsticeProjekt commented Jan 20, 2022

Well, I guess that predictably got shot down.

Ctrl + / would be horribly cumbersome for anyone using a german keyboard layout.

I'm sorry, I'm not someone used to doing this. I mean here. Github. People.
Am I supposed to be the one who closes this, or should I keep it open?

@Xrayez
Copy link
Contributor

Xrayez commented Jan 20, 2022

Am I supposed to be the one who closes this, or should I keep it open?

There's no need to close it yourself, it's the maintainers in Godot who should decide (based on general consensus). But I think we have useful insights here anyways. 🙂

@Calinou
Copy link
Member

Calinou commented Jan 20, 2022

In master, it would be possible to support multiple shortcuts for the same action. This way, we could support Ctrl + K, Ctrl + / and Ctrl + # at the same time (as the last two aren't used anywhere else currently).

@Gurigraphics
Copy link

I think this should be customizable by default as in any IDE.

Because it's like language translation content. This is not something that should be embedded in a compiled file.
It should be in a separate file to be easily edited manually, whereas a visual editor doesn't handle this.

As I already commented in the other topic:
Everything that there is no evidence that it is the best option, becomes the best option when it can be customizable.

In my case, Ctrl + / is the best option.
Ctl + k is tolerable.
And Ctrl + #, it's the worst option. I would never use.

@SolsticeProjekt
Copy link
Author

SolsticeProjekt commented Jan 26, 2022

Hm. So much depends on the keyboard's language layout.

I can see now why K makes sense.
Symbols can vary, letters (besides cyrillic, mandarin, etc.) don't.

I've learned something new! Thanks!

I guess using letters also means there's no need for different shortcuts depending on a keyboard's layout.

@SolsticeProjekt
Copy link
Author

SolsticeProjekt commented Jan 28, 2022

Related to shortcuts: https://www.youtube.com/watch?v=qKLkkqOl7sY

This is about the Add-On Jam. At 0:12 he introduces an add-on
which sets the shortcuts for Blender for Rotation, Scaling and Movement in Godot's 3D editor.

I post this, because apparently there is some need for care regarding shortcuts.

I can understand that it makes no sense to support shortcuts for all the tools,
and of course, "where do you draw the line?" applies, but it's still interesting to note.

There's demand for common shortcuts among the tool chain.
In this case, people who use Godot also often use Blender.

Given they both contain 3D Editors, having different shortcuts gives room for frustration.

It's a massive hassle needing to "muscle-memory" both sets of shortcuts,
and it's super easy to constantly get it wrong. This adds to what I've predicted
about my own behaviour above:

I've started using CTRL+K in Sublime and it's REALLY annoying! lol

Yes, I know I can solve this problem myself, but my point is that "helping myself"
kind of stops being a good solution when it's scaled up,
which is why there's demand for an Add-On which sets Blender's shortcuts in Godot's 3D editor.

Sorry about the huge amount of words.

@YuriSizov
Copy link
Contributor

Blender shortcuts are not just about having familiar shortcuts, they come with behavior. Their usefulness is not in having G specifically being bound to translation, but in the tricks you can do with locking axes and switching local and global transformation coordinates on the fly.

It can be any other key instead of GRS.

@SolsticeProjekt
Copy link
Author

I don't understand why you mention the obvious.

Of course it makes no difference which key it is,
as long as it's the same keys in both programs.

@YuriSizov
Copy link
Contributor

You've missed my point. I'm saying that "Blender shortcuts" are useful regardless of which keys we assign to them in Godot. Mechanical memory is good, but those actions are useful because of their functionality, not because of the familiarity of the keys assigned to them. They can in fact differ from Blender and be useful.

Regardless, Sublime is nowhere near an equivalent in that regard.

@SolsticeProjekt
Copy link
Author

SolsticeProjekt commented Jan 29, 2022

You've missed my point. I'm saying that "Blender shortcuts" are useful regardless of which keys we assign to them in Godot. Mechanical memory is good, but those actions are useful because of their functionality, not because of the familiarity of the keys assigned to them. They can in fact differ from Blender and be useful.

Ah, I see your point now. You're right as long as we ignore muscle memory.

Which we can't.

The familiarity of keys matters a lot,
because muscle memory matters for using computers, especially in a mostly non-annoying way, aka all the time.

Imagine needing to switch muscle memory for copy/paste every time you switch from Windows to Linux or Mac.
Imagine all three of them having a separate set of hotkeys for this.
There's a reason why they're the same everywhere and it's a damn good one.

Muscle memory is slow to adapt and
it's incredibly annoying getting used to another movement pattern for a task already memorized.

The brain sends the signal, the muscles just move. That's how we type.
Besides wanting to do the task, there's no conscious action involved once it's learned.

When you change the environment the brain will still fire the same signal (because it's the same task)
causing the same movement,
ending in frustration,
because, despite the task being the same, the movement is wrong.

That's why that add-on implemented the blender shortcuts with the actual blender shortcuts.

It matters that it's the same keys.
Just how it matters that copy/pasting has the same hotkeys across all platforms.

@Gurigraphics
Copy link

I think this should be customizable by default as in any IDE.

In fact, this is already customizable.

Go to Editor -> Configurations -> Shortcut tab -> Script Text Editor -> Toggle comment -> click edit -> and press combinations keys

You can choose what I think is best:

Control+BackSlash
Control+Slash
Control+Period
Control+Hastag

I choose Ctrl+"/" and it was like this

Control+Unknown

But, this works.

@aaronfranke
Copy link
Member

aaronfranke commented Jul 18, 2023

Even if Ctrl+# doesn't exist on many people's keyboard layouts (it's Ctrl+Shift+3 for me too), I think it's still fine since I just wouldn't use it.

On macOS, Cmd+Shift+3 takes a screenshot of the screen, so I guess code would be commented if you tried to take screenshot with this shortcut while focused in the script editor? But it's not a big deal, you can just unbind the shortcut, or unfocus the script editor, or take a screenshot another way.

If it's a usability improvement for many users then I think it's worth it, even if most users won't use it.

@SolsticeProjekt

This comment was marked as off-topic.

@AThousandShips
Copy link
Member

@SolsticeProjekt Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead.

Remember, you ping a lot of people by adding comments like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.