Difference between revisions of "Emacs Keys"

From Coder Merlin
m (added editorial note: please provide a link)
 
(42 intermediate revisions by 7 users not shown)
Line 1: Line 1:
== Overview ==
{{MovedToMoodle|See CS-001 Computer Science Reference: Keys → Emacs}}
* A key sequence will be displayed as a series of keys, presented from left to right in the order that each key should be pressed.  A space character will separate each of these keys.  For example, if the key sequence is {{Key|q}} {{Key|u}}, this indicates that you should press and release the {{Key|q}} key, and then press and release the {{Key|u}} key.
{{MerlinNoteFromEditor|Please provide a link or explain where this is. I can't find the CS-001 reference or the Keys → Emacs page.}}
* In some cases, a key sequence requires that a key be pressed with a modifier.  In these cases, the modifier will appear first, followed by a hyphen, followed by the second key. A very common modifier is {{Key|SHIFT}}.  For example, {{SpecialKey|SHIFT|Q}} would indicate that you first press (and hold) the {{Key|SHIFT}} key, then press and release the {{Key|Q}} key, then release the {{Key|SHIFT}} key. However, because the need to use the shift key is apparent based on the character required, we generally won't show the need for this modifier.  As an example, if the required sequence is {{Key|4}}, you'd simply press and release the {{Key|4}} key.  However, if the required sequence is {{Key|$}}, you'd need to press and hold the {{Key|SHIFT}} key, press and release the {{Key|$}} key, and then release the {{Key|SHIFT}} key.  All other modifier keys will be displayed explicitly.
* The sequence {{SpecialKey|CONTROL|u}} indicates that you first press (and hold) the {{Key|CONTROL}} key, then press and release the {{Key|u}} key, then release the {{Key|CONTROL}} key.  The emacs manual will refer to this sequence as C-u.
* The sequence {{SpecialKey|ALT|x}} indicates that you first press (and hold) the {{Key|ALT}} key, then press and release the {{Key|x}} key, then release the {{Key|ALT}} key.  The emacs manual will refer to this sequence as M-x.
* If there is a space rather than a dash between keys, the first key must be released before pressing the next key.  For example, {{Key|ESC}} {{Key|x}} indicates that the {{Key|ESC}} key should be pressed and released, and then the {{Key|x}} key should be pressed and released.
* There are some cases which require two modifier keys.  As an example, the sequence {{VerySpecialKey|CONTROL|SHIFT|_}} indicates that you should first press and hold the {{Key|CONTROL}} key, then press and hold the {{Key|SHIFT}} key, then press and release the {{Key|_}} key, and then release the other two modifier keys.
 
== Help ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|h}} {{Key|?}}
| Provide help options
|-
| {{SpecialKey|CONTROL|h}} {{Key|t}}
| Start the tutorial
|-  
| {{SpecialKey|CONTROL|h}} {{Key|k}}
| Provide details about a '''key sequence'''
|-
| {{SpecialKey|CONTROL|h}} {{Key|a}}
| Provide a list of '''commands appropriate''' for the specified description
|-
| {{SpecialKey|CONTROL|h}} {{Key|m}}
| Provide details about the current '''mode'''
|}
 
== Undo and Cancellation ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{VerySpecialKey|CONTROL|SHIFT|_}}
| '''Undo''' the changes made by a command
|-
| {{SpecialKey|CONTROL|g}} {{VerySpecialKey|CONTROL|SHIFT|_}}
| '''Redo''' a previously "undo"
|-
| {{SpecialKey|CONTROL|g}}
| '''Cancel''' a partially typed command or argument prefix
|}
 
== Suspend and Exit ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|x}} {{SpecialKey|CONTROL|c}}
| '''Exit''' emacs
|-
| {{SpecialKey|CONTROL|z}}
| '''Suspend''' emacs temporarily
|}
 
== Navigation ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|v}}
| '''Scroll down''' (forwards) one page
|-
| {{SpecialKey|ALT|v}}
| '''Scroll up''' (backwards) one page
|-
| {{SpecialKey|CONTROL|l}} (second character is lowercase 'L')
| Clear screen and '''redisplay''' the text, moving the cursor to the vertical center
|-
| {{SpecialKey|CONTROL|f}}
| Move the cursor '''forward''' one '''character'''
|-
| {{SpecialKey|CONTROL|b}}
| Move the cursor '''backward''' one '''character'''
|-
| {{SpecialKey|CONTROL|p}}
| Move the cursor '''up''' one '''line''' (previous line)
|-
| {{SpecialKey|CONTROL|n}}
| Move the cursor '''down''' one '''line''' (next line)
|-
| {{SpecialKey|ALT|f}}
| Move the cursor '''forward''' one '''word'''
|-
| {{SpecialKey|ALT|b}}
| Move the cursor '''backward''' one '''word'''
|-
| {{SpecialKey|CONTROL|a}}
| Move the cursor to the '''beginning''' of a '''line'''
|-
| {{SpecialKey|CONTROL|e}}
| Move the cursor to the '''end''' of a '''line'''
|-
| {{SpecialKey|ALT|a}}
| Move the cursor to the '''beginning''' of a '''sentence'''
|-
| {{SpecialKey|ALT|e}}
| Move the cursor to the '''end''' of a '''sentence'''
|-
| {{VerySpecialKey|ALT|SHIFT|<}}
| Move the cursor to the '''beginning''' of the '''file'''
|-
| {{VerySpecialKey|ALT|SHIFT|>}}
| Move the cursor to the '''end''' of the '''file'''
|}
 
== Deleting, Killing, and Yanking Text ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|d}}
| '''Delete character under''' the cursor
|-
| {{Key|DEL}}
| '''Delete character''' to the '''left''' of the cursor
|-
| {{SpecialKey|ALT|d}}
| '''Kill word after''' the cursor
|-
| {{SpecialKey|ALT|DEL}}
| '''Kill word before''' the cursor
|-
| {{SpecialKey|CONTROL|k}}
| '''Kill text''' from the cursor to the '''end of the line'''
|-
| {{SpecialKey|ALT|k}}
| '''Kill text''' from the cursor to the '''end of the sentence'''
|-
| {{SpecialKey|CONTROL|w}}
| '''Kill selected text''' (in region)
|-
| {{SpecialKey|CONTROL|y}}
| '''Yank text''' from the '''first block''' of the kill ring, and insert it at the current cursor position
|-
| {{SpecialKey|ALT|y}}
| '''Yank text''' from the '''previous block''' of the kill ring, and insert it at the current cursor position
|}
 
== Marking a Region ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|SPACE}}
| '''Mark''' the beginning of a region
|}
 
== Repeating Commands ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|u}}&nbsp;<numeric sequence>
| '''Repeat next command''' <numeric sequence> times
|}
 
== Windows ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|1}} (second character is the digit one)
| Return to '''one window''' (closes all other windows)
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|2}}
| '''Split''' the screen '''horizontally'''
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|3}}
| '''Split''' the screen '''vertically'''
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|0}} (the second character is the digit zero)
| '''Close''' the '''current''' window
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|o}} (the second character is lowercase "O")
| Move the '''cursor''' to the '''other window'''
|}
 
== Buffers ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{SpecialKey|CONTROL|b}}
| Display a '''list''' of all '''buffers'''
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|b}}
| '''Switch''' to the specified '''buffer'''
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|<math>\leftarrow</math>}}
| Select '''previous buffer'''
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|<math>\rightarrow</math>}}
| Select '''next buffer'''
|}
 
== Files ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{SpecialKey|CONTROL|f}}
| '''Find''' the specified file
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{SpecialKey|CONTROL|s}}
| '''Save''' the '''current file'''
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|s}}
| '''Save''' '''changed files''' (prompts for all confirmation)
|}
 
== Find and Replace Strings ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|CONTROL|f}}
| Incremental '''forward search'''
|-
| {{SpecialKey|CONTROL|r}}
| Incremental '''reverse search'''
|-
| {{SpecialKey|ALT|x}}&nbsp;replace-string&nbsp;{{Key|RET}}
| '''Replace''' the specified '''string''' with another
|}
 
 
== Formatting ==
{| class='wikitable'
! Key Sequence
! Purpose
|-
| {{SpecialKey|ALT|x}}&nbsp;auto-fill-mode&nbsp;{{Key|RET}}
| Toggle '''auto-fill mode'''
|-
| {{SpecialKey|CONTROL|x}}&nbsp;{{Key|f}}
| Specify '''margin''' in terms of characters
|-
| {{SpecialKey|ALT|q}}
| '''Re-fill''' the paragraph using the current margin
|}

Latest revision as of 08:28, 10 January 2024

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
HintIcon.png
Moved to Moodle logo.svg
See CS-001 Computer Science Reference: Keys → Emacs

 This article can be improved by:  Please provide a link or explain where this is. I can't find the CS-001 reference or the Keys → Emacs page.