22

In my local jupyter-notebook i can edit mutliple lines of code at the same time: simply press ctrl + click at the respective lines. In google Colab that does not seem to work. Is this feature available somehow?

I work with Firefox on a Ubuntu 16.04.

Sebastiano1991
  • 867
  • 1
  • 10
  • 26

3 Answers3

34

It's available. Instead of Ctrl + Click, please use

  • Alt + Click for Windows
  • Option + Click for MacOS

To select all occurrences of the current selection, please use

  • Ctrl + Shift + L for Windows
  • Command + Shift + L for MacOS
korakot
  • 37,818
  • 16
  • 123
  • 144
  • 1
    Awesome crl+shiftt+L works for linux/ubuntu16.04 as well. However alt+click does not work for my ubuntu. Do you know that one for ubuntu as well? – Sebastiano1991 Feb 06 '20 at 16:07
  • On Mac OS you can also select multiple lines using `Option + Shift + Click` and then dragging to select the lines you want. – user566245 Oct 15 '20 at 20:26
  • Ctrl + Shift + L doesn't seem to work on my Pixelbook. The cell highlights matching occurrences of the selection in the same cell but I can't seem to find out how to include them into the selection in a single keystroke. Alt + Click does work, but it's a lot of effort to include all matching occurrences if there are a lot of them. – Wolfram Arnold Jan 20 '21 at 22:08
  • Update: Ctrl + Shift +L works but _only if_ nothing is selected at the time of pressing those keys. – Wolfram Arnold Jan 24 '21 at 19:23
  • 1
    On another side-note: CTRL+D expands the selection to all occurrences of the selection. – Wolfram Arnold Jan 26 '21 at 20:32
9

(In Linux - Chromium, at least)

I managed to do block select but only on contiguous lines, not multi-cursor unfortunately.

Shift+Alt + Up/Down to select multiple lines. Now you can release Alt and use Left/Right to move to the sides. Whatever you do now will affect the whole block.

enter image description here

And, if you select one or more lines with Shift (doesn't need to be the whole content, this affects all the lines with cursor), and then release Shift and press Alt+Up/Down, you will move those lines altogether up/down

enter image description here

By Rainer Glüge: On Linux+Firefox:

  • Block-Select: Ctrl+Shift+Alt+Cursor Keys.
  • Multi-Cursor: Alt+Click
  • Multi-Select: Select one occurence, then Ctrl+Shift+L
Rub
  • 2,071
  • 21
  • 37
0

Simplest way:

You can just press Shift+Ctrl+Up/Down keys. (Tried with Ubuntu + Google Chrome).

Shift+Alt also works, but I find Shift+Ctrl easier.

zabop
  • 6,750
  • 3
  • 39
  • 84