Skip to content

Instantly share code, notes, and snippets.

@liopash
Created April 13, 2018 14:17
Show Gist options
  • Save liopash/1f1d88eeab24b703d518d71a408399b3 to your computer and use it in GitHub Desktop.
Save liopash/1f1d88eeab24b703d518d71a408399b3 to your computer and use it in GitHub Desktop.
Emacs and SML REPL keyboard shortcuts

Emacs Shortcuts

A list of handy Emacs and SML REPL keyboard shortcuts:

Basics

  • C-x C-c Quit Emacs
  • C-g Cancel the current action
  • C-x C-f Find and open a file (whether or not it already exists)
  • C-x C-s Save a file
  • C-x C-w Write a file (probably more familiar to you as Save as...)

Moving

  • C-e go to end of line
  • C-a go to begin of line

Cut, copy, paste

  • C-space Set a mark and then move the cursor to highlight a region
  • C-w Cut a highlighted region
  • M-w Copy a highlighted region
  • C-k Cut (kill) from the cursor to the end of the line
  • C-y Paste (yank)

Editing

  • C-x u Undo
  • M-; line comment - region or goes to end of line
  • C-u M-; removes line comment
  • C-M-\ indent region

Buffers

  • C-x b Switch to another buffer by entering its name
  • C-x C-b See a list of all current buffers
  • C-x 1 Get rid of buffer list
  • C-x k kill a buffer

Splits

  • C-x 0 Undo window-splitting so there is only 1 buffer; dismiss this split
  • C-x 1 Dismiss all other windows
  • C-x 2 Split the window horizontally into 2 buffers, one above the other
  • C-x o Switch between windows

See Manage Split Windows tutorial.

Commands

  • M-p previous command
  • M-n next command
  • C-c C-s SML REPL command
  • M-<TAB> Indentation
  • <TAB> Indentation
  • C-c C-b Send the contents of the current buffer to ML.
  • C-c C-l Send a `use file' command to the current ML process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment