overleaf icon indicating copy to clipboard operation
overleaf copied to clipboard

Changing a hotkey (Toggle Comment Ctrl + / )

Open hulk1st opened this issue 10 years ago • 12 comments

Hi,

this is certainly not the best place to ask for this but I don't know where else to ask. Can anyone point me to the file where the hotkeys are defined? Unfortunately it is not possible to run the "toggle comment" hotkey on some non-english keyboard layouts, which many users have in our case. Hence I would like to re-define the command, since I feel it is one of the most important hotkeys which really makes life easier.

Thanks a lot in advance!

hulk1st avatar Apr 17 '16 22:04 hulk1st

Seems to be its defined here:

https://github.com/sharelatex/web-sharelatex/blob/83ef761ec9402ac56ada05bfd1abc4460a710340/public/coffee/ide/editor/directives/aceEditor.coffee

Otherwise search for "ctrl" in this repository, which leads for example to the file with the content of the "Show Hotkeys" window.

Seems sad this hasn't been answered before, since I myself just ran into this issue, though not due to non-english keyboard layouts but because the browser itself has multiple shortcuts/hotkeys defined.

I would like to ask the team behind sharelatex to make the hotkeys configurable on a per-user basis. Logging the pressed keys should not be problematic and storing and reading the key combinations from a database or file is rather trivial i'd guess.

ghost avatar May 09 '16 09:05 ghost

Thank you, it seems to work partly. This is more of a workaround than a solution, as it additionally enables Ctrl+Shift+/ besides Ctrl+/ to address foreign keyboard layouts, but does not allow re-defining as far as I can see. This is not a proper solution, as (on Mac OS X) Cmd+Shift+/ is the Safari shortcut to show all tabs, so sometimes it results in the expected behavior and toggles comment, sometimes it shows the tabs as defined for the browser.

Anyway, thanks again for the link!

hulk1st avatar May 09 '16 21:05 hulk1st

Why?

bindKey: { win: "Ctrl-/|Ctrl-Shift-/", mac: "Command-/|Command-Shift-/" },

Just insert whatever you want there. Obviously | separates multiple keyboard combinations. "-" says press them together.

Otherwise, if you didn't set up your own sharelatex, you'll be dependent on the sharelatex team to incorporate individual per user changing of these key bindings in, for example, the profile. Don't know when or if that'll happen. I'm no developer in this project.

ghost avatar May 11 '16 06:05 ghost

Yes sorry, seems to work fine now. Not sure what solved it in the end, either deleting cache+cookies, logging out and in again or restarting the browser. Anyway, now it's working. The description for "Menu -> Show Hotkeys" is changed in web/app/views/project/editor/hotkeys.jade.

hulk1st avatar May 11 '16 09:05 hulk1st

I still have this issue on a non-english keyboard :(

msandim avatar Jun 20 '16 22:06 msandim

Hey @msandim , which OS and browser are you using? What about ShareLaTeX, is it your own installation?

paulojreis avatar Jun 21 '16 09:06 paulojreis

Why? Did you edit web/public/coffee/ide/editor/directives/aceEditor.coffee end then recompile? I suggest including the following shortcut as well:

bindKey: { win: "Ctrl-/|Ctrl-Shift-/|Ctrl-.", mac: "Command-/|Command-Shift-/|Command-." }, because the dot key is not used by other browser shortcuts unlike the slash key.

hulk1st avatar Jun 21 '16 09:06 hulk1st

Same issue here after a few years, "cmd + /" does not work on non-English keyboards.

I have to actually press "cmd + shift + 7" to get "cmd + /" and Google Chrome overrides the shortcut opening its own menu.

gabrer avatar Apr 10 '21 18:04 gabrer

Safari 14.1 on macOS Big Sur uses cmd+/ for "Hide Status Bar" 🙄

Adding a different keyboard shortcut for "Hide Status Bar" (specific to the Safari app) as described here made cmd+/ usable in Overleaf. It wasn't necessary to restart Safari.

pdmosses avatar May 17 '21 17:05 pdmosses

I still have the same issue, I'm using macOS, Español - ISO layout and Brave as my main web browser. Already changed the keyboard shortcut cmd-shift-7 (as cmd-/ isn't detected natively for my keyboard layout) for whatever it was used for in the keyboard shortcuts department in Settings.

Even though it works on Safari, I don't understand why it doesn't on Brave (Chromium based browser maybe?)

@gabrer did you find an answer to this?

carlostrejos97 avatar Jul 03 '21 20:07 carlostrejos97

@carlostrejos97 Not yet unfortunately

gabrer avatar Jul 04 '21 09:07 gabrer

In addition to the other mentioned issues, Microsoft Edge has Ctrl+Shift+A as the "Search through existing tabs" shortcut, which I use on a minute-basis. Very annoying that this doubles with Overleaf's "Activate track changes" shortcut, would be great if this were configurable.

e-pet avatar Aug 19 '23 11:08 e-pet