4
$\begingroup$

Is there any shortcut or keyboard hot-key which selects the current cell? I am basically looking for the exact effect as clicking on cell bracket but achieved using keyboard instead of mouse.

I frequently comment and de-comment cells while testing my code using Alt-/ but it is very frustrating to click on cell bracket every time I want to do that.

Please let me know if this is a trivial question and I will delete it.

$\endgroup$

3 Answers 3

2
$\begingroup$

True. I find the close proximity of the cell brackets not ergonomically friendly. Too fine a motion to click.

Answer: Down-arrow, shift up-arrow works.

$\endgroup$
2
  • 4
    $\begingroup$ This is acceptable for 1-line cells, but for cell with huge amount of lines you will have to press down arrow 1000 times before you achieve cell break. And I still don't see any alternative besides using "Alt ." to select whole expression $\endgroup$
    – Igor
    Feb 11, 2022 at 7:28
  • $\begingroup$ @Igor I just checked and in the cases that I tried, if the cursor is at the beginning of the cell you can use Ctrl+Tab to reach the bottom. If not and if you have multiple semicolons in the code then you can hold on the keys Ctrl+tab until you reach the bottom. Alternatively, you can hold on Shift+down-arrow to reach the bottom. For more details see my answer. $\endgroup$ Aug 11, 2022 at 1:44
1
$\begingroup$

Ctrl+dot several times on windows

https://reference.wolfram.com/language/tutorial/KeyboardShortcutListing.html

$\endgroup$
1
$\begingroup$

EDIT:

It seems that the following works on a linux laptop with a qwerty keyboard (I mention this as some of the keyboard shortcuts I have do not seem to work elsewhere):

The keyboard shortcuts below are the same on my laptop and I do not know which one is selecting the current cell

Ctrl+{

or

Ctrl+ Shift+[

also maybe consider the shortcuts package from this answer: https://mathematica.stackexchange.com/a/85824/86543


(Previous version which might work for all laptops but it is not a single keyboard shortcut)

TL;DR:

If: position[cursor]==start_of_cell,

            Ctrl+Tab; Down-arrow; shift+up-arrow
 
            (*kind of reminds me of playing on a
              super nintendo game controller*)

     
else: while(
        not(position[cursor]==end_of_cell),
        hold keys Ctrl+Tab
      );
      Down-arrow; shift+up-arrow           
        
    

If the cell has more than two or three lines, using the shortcut given in @PaulCommentary's answer might become a tad tedious. In that case, at least in the few cases I tried, one could use Ctrl+Tab to reach the bottom of the cell if the cursor is at the beginning of the cell. If the cursor is not at the beginning then the cursor will move to the next semicolon if the cursor is at the beginning of an expression. Holding the keys Ctrl+Tab until one reaches the end, one could then use Down-arrow, shift up-arrow.

Alternatively, one could hold Shift+Down-arrow until one reaches the bottom then use Down-arrow; shift+up-arrow.

$\endgroup$
1
  • $\begingroup$ Great. The first part contains the relevant answer. In a Mac (with American keyboard layout) I use Cmd+Shift+[, which is equivalent to Cmd+{. $\endgroup$
    – Davi
    May 8, 2023 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.