6

Quick question for those, who are well acquainted with Overleaf: is there a keybinding that enables multiple selection? For example, when I work in the tabular environment, I select one \cellcolor command and see that all other instances of \cellcolor across the table are being put into frame. I would like to know if it possible to have multiple selections, so I can simultaneously edit all of them? I believe there should be some simple trick but I cannot find out. Your advice is appreciated!

3
  • 1
    Have you posed this question to the Overleaf Helpdesk folks? I hear the LaTeX group is very good.
    – Mico
    Jun 30, 2020 at 4:29
  • 4
    [Disclaimer/Disclosure: I'm a support personnel at Overleaf.] The source editor currently uses the ACE library, so if you've already highlighted an instance of \cellcolor in the editor, then on Windows Ctrl+Alt+K (or Ctrl+Opt+G on the Mac for me) will also select all other \cellcolor. You can also use Ctrl-F (or Cmd-F on Mac) to open the search dialog; then use the "All" button to perform a bulk replacement. Another way to get multiple cursors at arbitrary locations, is to hold down the Ctrl key (or the Cmd key on a Mac) while clicking on the required locations.
    – imnothere
    Jun 30, 2020 at 6:08
  • Thank you very much for such a comprehensive answer! I will put it to use tomorrow.
    – user136555
    Jun 30, 2020 at 6:14

3 Answers 3

11

TL;DR the Ctrl+D as in Sublime Text or VS Code is Ctrl+Alt+Right in Overleaf.

The full list of keyboard shortcuts that work for me in Overleaf to create multiple cursors / selections:

  • Ctrl+Alt+Right (or additionally Ctrl+Alt+L in Vim mode): search for next occurence of word under cursor, add it to selection
  • Ctrl+Alt+Left (or additionally Ctrl+Alt+H in Vim mode): search for previous occurence of word under cursor, add it to selection
  • Ctrl+Alt+Down (or additionally Ctrl+Alt+J in Vim mode): add cursor one line below
  • Ctrl+Alt+Up (or additionally Ctrl+Alt+K in Vim mode): add cursor one line above

For these above, hold also Shift to skip items / lines.

  • Ctrl + click somewhere: add new cursor
  • Alt + click and drag through multiple lines: block selection, add multiple cursors
  • Ctrl+Alt+K if keybindings set to None: select all occurences of text under cursor

Furthermore, if using multiple selections with Vim mode, it's good to know that you need to press Shift+A or Shift+I to enter insert mode.

1
  • 1
    This answer has saved me a good 20-30 hours of grunt work. May be more.
    – Academic
    May 11, 2023 at 18:53
1

I added an answer since I can't comment yet. ha7ilm's answer is what I was searching for.

I wanted to comment that the manual mouse click approach, as suggested by Sdlion, works in Windows/Linux, too, using Ctrl. And this comes from bullet point 5 of ha7ilm's answer. And this is how I was doing it until I found this post.

Also, in Linux, you might need to unbind some keyboard combinations to make it work.

0

On Mac a more manual approach but similar to SublimeText / Code multi-cursor editing is with the mouse:

  1. Double click the word
  2. Maintain pressed the key
  3. Double click the other words you want to simultaneously edit.

This would put the cursor at the end of all the selected words. But you can arbitrarily put second, third, etc cursors anywhere if you just maintain pressed while you click.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .