44  Keyboard Shortcuts Reference

This appendix provides essential keyboard shortcuts for the tools commonly used in biostatistics and data science workflows.

44.1 Bash/Terminal Shortcuts

Process Control

Shortcut Description
Ctrl + C Interrupt/kill current process
Ctrl + Z Suspend current process (use fg to resume)
Ctrl + D Exit shell / End of input
Ctrl + L Clear screen
Ctrl + S Pause terminal output
Ctrl + Q Resume terminal output

44.2 Vim Shortcuts

Modes

Key Description
i Enter Insert mode (before cursor)
a Enter Insert mode (after cursor)
I Insert at beginning of line
A Insert at end of line
o Open new line below
O Open new line above
v Enter Visual mode (character)
V Enter Visual mode (line)
Ctrl + V Enter Visual Block mode
Esc Return to Normal mode
: Enter Command mode

Editing (Normal Mode)

Key Description
x Delete character under cursor
X Delete character before cursor
dd Delete entire line
dw Delete word
d$ or D Delete to end of line
d0 Delete to beginning of line
yy Yank (copy) entire line
yw Yank word
p Paste after cursor
P Paste before cursor
r Replace single character
R Enter Replace mode
cc Change entire line
cw Change word
c$ or C Change to end of line
u Undo
Ctrl + R Redo
. Repeat last command
~ Toggle case
>> Indent line
<< Unindent line

Search and Replace

Command Description
/pattern Search forward for pattern
?pattern Search backward for pattern
n Find next occurrence
N Find previous occurrence
* Search for word under cursor
:%s/old/new/g Replace all occurrences in file
:s/old/new/g Replace all occurrences in line
:%s/old/new/gc Replace with confirmation

File Operations

Command Description
:w Save file
:w filename Save as filename
:q Quit
:q! Quit without saving
:wq or :x Save and quit
ZZ Save and quit (Normal mode)
:e filename Open file
:r filename Insert file contents

44.3 RStudio Shortcuts

Console

Shortcut Description
Ctrl + Enter Run current line/selection
Ctrl + Shift + Enter Run entire script
Ctrl + Alt + R Run from beginning to current line
Ctrl + Alt + E Run from current line to end
Ctrl + Alt + B Run from beginning to cursor
Ctrl + L Clear console
Esc Interrupt R
Tab Autocomplete
Ctrl + Up Command history popup

Editor

Shortcut Description
Ctrl + S Save current file
Ctrl + Shift + S Save all open files
Ctrl + Z Undo
Ctrl + Shift + Z Redo
Ctrl + F Find
Ctrl + H Find and replace
Ctrl + Shift + F Find in files
Ctrl + D Delete line
Ctrl + Shift + D Duplicate line
Alt + Up/Down Move line up/down
Ctrl + Shift + C Comment/uncomment line
Ctrl + Shift + / Reflow comment
Ctrl + I Reindent lines
Ctrl + Shift + A Reformat code
Ctrl + Shift + M Insert pipe (%>% or |>)
Alt + - Insert assignment (<-)
Ctrl + Shift + R Insert code section

Projects and Sessions

Shortcut Description
Ctrl + Shift + N New file
Ctrl + O Open file
Ctrl + Shift + P Command palette
Ctrl + Shift + F10 Restart R session
Ctrl + Q Quit RStudio

44.4 Jupyter Notebook Shortcuts

Command Mode (Blue Border)

Press Esc to enter Command mode.

Key Description
Enter Enter Edit mode
H Show keyboard shortcuts
A Insert cell above
B Insert cell below
X Cut selected cells
C Copy selected cells
V Paste cells below
Shift + V Paste cells above
D, D Delete selected cells
Z Undo cell deletion
Y Change cell to Code
M Change cell to Markdown
R Change cell to Raw
1-6 Change to heading level 1-6
Up/K Select cell above
Down/J Select cell below
Shift + Up/K Extend selection above
Shift + Down/J Extend selection below
Shift + M Merge selected cells
O Toggle output
Shift + O Toggle output scrolling
I, I Interrupt kernel
0, 0 Restart kernel
S or Ctrl + S Save notebook
L Toggle line numbers

Edit Mode (Green Border)

Press Enter to enter Edit mode.

Shortcut Description
Esc Enter Command mode
Ctrl + Enter Run cell
Shift + Enter Run cell, select below
Alt + Enter Run cell, insert below
Ctrl + Shift + - Split cell at cursor
Tab Code completion
Shift + Tab Tooltip/documentation
Ctrl + ] Indent
Ctrl + [ Dedent
Ctrl + A Select all
Ctrl + Z Undo
Ctrl + Shift + Z Redo
Ctrl + D Delete whole line
Ctrl + / Comment/uncomment
Ctrl + Home Go to cell start
Ctrl + End Go to cell end

44.5 VS Code Shortcuts

General

Shortcut Description
Ctrl + Shift + P Command palette
Ctrl + P Quick open file
Ctrl + Shift + N New window
Ctrl + W Close editor
Ctrl + , Open settings
Ctrl + K Ctrl + S Keyboard shortcuts
Ctrl + `` Toggle integrated terminal
F11 Toggle full screen
Ctrl + B Toggle sidebar
Ctrl + Shift + E Explorer focus
Ctrl + Shift + F Search across files
Ctrl + Shift + G Source control
Ctrl + Shift + D Debug
Ctrl + Shift + X Extensions

Editing

Shortcut Description
Ctrl + X Cut line (empty selection)
Ctrl + C Copy line (empty selection)
Ctrl + V Paste
Ctrl + Shift + K Delete line
Ctrl + Enter Insert line below
Ctrl + Shift + Enter Insert line above
Alt + Up/Down Move line up/down
Shift + Alt + Up/Down Copy line up/down
Ctrl + D Select word (repeat for next)
Ctrl + Shift + L Select all occurrences
Ctrl + L Select current line
Ctrl + / Toggle line comment
Shift + Alt + A Toggle block comment
Ctrl + ] Indent line
Ctrl + [ Outdent line
Ctrl + Shift + \ Jump to matching bracket
Ctrl + Z Undo
Ctrl + Shift + Z Redo

Multi-Cursor and Selection

Shortcut Description
Alt + Click Insert cursor
Ctrl + Alt + Up/Down Insert cursor above/below
Ctrl + U Undo cursor operation
Shift + Alt + I Insert cursor at end of each line
Ctrl + Shift + L Select all occurrences of selection
Ctrl + F2 Select all occurrences of word
Shift + Alt + Drag Column selection
Ctrl + Shift + Alt + Arrow Column selection

Search and Replace

Shortcut Description
Ctrl + F Find
Ctrl + H Replace
F3 / Shift + F3 Find next/previous
Alt + Enter Select all occurrences of find match
Ctrl + D Add selection to next find match
Ctrl + K Ctrl + D Move last selection to next find match

Integrated Terminal

Shortcut Description
Ctrl + `` Toggle terminal
Ctrl + Shift + `` Create new terminal
Ctrl + Shift + 5 Split terminal
Ctrl + PageUp/Down Scroll terminal
Shift + PageUp/Down Scroll terminal by page
Customizing Shortcuts

Most applications allow you to customize keyboard shortcuts:

  • RStudio: Tools → Modify Keyboard Shortcuts
  • VS Code: File → Preferences → Keyboard Shortcuts (or Ctrl + K Ctrl + S)
  • Jupyter: Help → Edit Keyboard Shortcuts
  • Bash: Edit ~/.inputrc for readline customizations

Learning the default shortcuts first helps when working on different machines, but customization can boost your personal productivity significantly.

44.6 Platform Differences

Most shortcuts in this appendix use Ctrl as the modifier key (Windows/Linux). On macOS:

Windows/Linux macOS
Ctrl Cmd (⌘)
Alt Option (⌥)
Ctrl + Alt Cmd + Option

Some applications maintain the Ctrl key on macOS for terminal-related shortcuts (Bash, Vim).