Port Emacs Cheat Sheet to json format.

master
punchagan 2015-06-17 03:59:23 +00:00 committed by Puneeth Chaganti
parent 66a0058f2c
commit 0aa4a1f38e
5 changed files with 251 additions and 543 deletions

View File

@ -1,48 +0,0 @@
package DDG::Goodie::EmacsCheatSheet;
# ABSTRACT: A cheatsheet for useful emacs commands
use DDG::Goodie;
zci answer_type => "emacs_cheat_sheet";
zci is_cached => 1;
name "EmacsCheatSheet";
description "emacs cheatsheet";
source "http://www.rgrjr.com/emacs/emacs_cheat.html";
category "cheat_sheets";
topics "computing", "geek", "programming", "sysadmin";
code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/EmacsCheatSheet.pm";
attribution github => ["https://github.com/jim-brighter", "Jim Brighter"],
twitter => "jim_brighter";
primary_example_queries "emacs cheatsheet", "emacs cheat sheet", "emacs commands", "emacs help";
secondary_example_queries "emacs reference", "emacs guide", "emacs quick reference";
triggers startend => "emacs cheatsheet",
"emacs cheat sheet",
"emacs help",
"emacs commands",
"emacs guide",
"emacs reference",
"emacs quick reference",
"cheatsheet emacs",
"cheat sheet emacs",
"help emacs",
"commands emacs",
"guide emacs",
"reference emacs",
"quick reference emacs";
my $TEXT = scalar share('emacs_cheat_sheet.txt')->slurp,
my $HTML = scalar share('emacs_cheat_sheet.html')->slurp;
handle remainder => sub {
return
heading => 'Emacs Cheat Sheet',
answer => $TEXT,
html => $HTML,
};
1;

View File

@ -0,0 +1,251 @@
{
"id": "emacs_cheat_sheet",
"name": "Emacs",
"description": "Text Editor",
"metadata": {
"sourceName": "EmacsCheatSheet",
"sourceUrl": "https://duckduckgo.com"
},
"section_order": [
"Lingo",
"Quick Answers",
"Cursor Motion",
"Editing",
"Scrolling and Windows",
"Cutting and Pasting",
"Files and Buffers",
"Command-Related Stuff",
"Searching and Replacing",
"Help",
"Misc"
],
"sections": {
"Lingo": [{
"val": "control key (CTRL)",
"key": "C"
}, {
"val": "meta key (ALT or ESC)",
"key": "M"
}],
"Quick Answers": [{
"val": "find file",
"key": "[C-x] [C-f]"
}, {
"val": "save file",
"key": "[C-x] [C-s]"
}, {
"val": "exit Emacs",
"key": "[C-x] [C-c]"
}],
"Cursor Motion": [{
"val": "Move forward by a character",
"key": "C-f"
}, {
"val": "Move backward by a character",
"key": "C-b"
}, {
"val": "Move forward by a word",
"key": "M-f"
}, {
"val": "Move backward by a word",
"key": "M-b"
}, {
"val": "Move forward by a line",
"key": "C-n"
}, {
"val": "Move backward by a line",
"key": "C-p"
}, {
"val": "Move forward by a sentence",
"key": "M-e"
}, {
"val": "Move backward by a sentence",
"key": "M-a"
}, {
"val": "Move forward by a paragraph",
"key": "M-}"
}, {
"val": "Move backward by a paragraph",
"key": "M-{"
}, {
"val": "Move forward by an expression",
"key": "C-M-f"
}, {
"val": "Move backward by an expression",
"key": "C-M-b"
}, {
"val": "Move to the start of a line",
"key": "C-a"
}, {
"val": "Move to the end of a line",
"key": "C-e"
}, {
"val": "Move to the start of a buffer",
"key": "M-<"
}, {
"val": "Move to the end of a buffer",
"key": "M-<"
}],
"Editing": [{
"val": "Delete a character (forward)",
"key": "C-d"
}, {
"val": "Delete a character (backward)",
"key": "DEL"
}, {
"val": "Delete a word (forward)",
"key": "M-d"
}, {
"val": "Delete a word (backward)",
"key": "M-DEL"
}, {
"val": "Delete a line (forward)",
"key": "C-k"
}, {
"val": "Delete a line (backward)",
"key": "[C-SPC] [C-a] [C-w]"
}, {
"val": "Delete a sentence (forward)",
"key": "M-k"
}, {
"val": "Delete a sentence (backward)",
"key": "[C-x] [DEL]"
}, {
"val": "Delete an expression (forward)",
"key": "C-M-k"
}, {
"val": "Delete an expression (backward)",
"key": "C-M-DEL"
}],
"Scrolling and Windows": [{
"val": "Page Down",
"key": "C-v"
}, {
"val": "Page Up",
"key": "M-v"
}, {
"val": "Page Down other window",
"key": "C-M-v"
}, {
"val": "Make current window only window",
"key": "[C-x] [1]"
}, {
"val": "Split window vertically",
"key": "[C-x] [2]"
}, {
"val": "Split window horizontally",
"key": "[C-x] [3]"
}, {
"val": "Grow window vertically",
"key": "[C-x] [^]"
}, {
"val": "Switch to next window",
"key": "[C-x] [o]"
}, {
"val": "Close current window",
"key": "[C-x] [0]"
}],
"Cutting and Pasting": [{
"val": "Set mark",
"key": "C-SPC"
}, {
"val": "Cut (after setting mark and moving to end point)",
"key": "C-w"
}, {
"val": "Copy (after setting mark and moving to end point)",
"key": "M-w"
}, {
"val": "Yank (paste) most recently killed (cut or copied)",
"key": "C-y"
}, {
"val": "Yank next most recently killed",
"key": "M-y"
}],
"Files and Buffers": [{
"val": "Find file (or create if not existing)",
"key": "[C-x] [C-f]"
}, {
"val": "Save file",
"key": "[C-x] [C-s]"
}, {
"val": "Write file",
"key": "[C-x] [C-w]"
}, {
"val": "Save modified buffers",
"key": "[C-x] [s]"
}, {
"val": "Select buffer",
"key": "[C-x] [b]"
}, {
"val": "List buffers",
"key": "[C-x] [C-b]"
}, {
"val": "Kill buffer",
"key": "[C-x] [k]"
}],
"Command-Related Stuff": [{
"val": "Leave current location",
"key": "[ESC] [ESC] [ESC]"
}, {
"val": "Prefix numeric argument # to next command",
"key": "[C-u] [#]"
}, {
"val": "Stop running command, or cancel partially entered command",
"key": "C-g"
}],
"Searching and Replacing": [{
"val": "Incremental search forward",
"key": "C-s"
}, {
"val": "Incremental search backward",
"key": "C-r"
}, {
"val": "Regexp search forward",
"key": "C-M-s"
}, {
"val": "Regexp search backward",
"key": "C-M-r"
}, {
"val": "String replace from here to end of buffer",
"key": "[M-x replace-string RET]"
}, {
"val": "String replace from here to end of buffer, querying for each occurrence",
"key": "[M-x query-replace RET]"
}, {
"val": "Prompts for a grep command, shows hits in a buffer",
"key": "[M-x grep RET]"
}, {
"val": "Visit next grep hit",
"key": "[C-x] [`]"
}],
"Help": [{
"val": "Show command documentation",
"key": "[C-h] [k]"
}, {
"val": "\"Command apropos\"",
"key": "[C-h] [a]"
}, {
"val": "Show command name on message line",
"key": "[C-h] [c]"
}, {
"val": "Describe function",
"key": "[C-h] [f]"
}, {
"val": "Info browser",
"key": "[C-h] [i]"
}],
"Misc": [{
"val": "Undo/redo",
"key": "[C-_] or [C-x] [u]"
}, {
"val": "Quoted insert",
"key": "C-q"
}, {
"val": "Suspend/iconify emacs (type \"%emacs\" to return",
"key": "C-z"
}, {
"val": "Exit emacs",
"key": "[C-x] [C-c]"
}]
}
}

View File

@ -1,46 +0,0 @@
.zci--answer .zero_click_wrapper .zero_click {
padding-left: 0px !important;
margin-left: 0px !important;
margin-right: 0px !important;
}
.zci--answer #sheet-container {
max-height: 45ex;
overflow-y: scroll;
overflow-x: hidden;
}
.zci--answer .sheet-column {
width: 48%;
display: inline-block;
vertical-align: top;
}
.zci--answer .top-elements div {
display: inline-block;
}
.zci--answer table.sheet-table th {
padding-right: 1ex;
vertical-align: top;
text-align: left;
}
.zci--answer table.sheet-table {
width: 100%;
margin-bottom: 1ex;
}
.zci--answer table.sheet-table td {
padding-right: 1ex;
vertical-align: top;
}
.zci--answer table.sheet-table td code {
white-space: nowrap;
}
@media (max-width: 380px) {
.zci--answer .sheet-column {
width: 100%;
}
}

View File

@ -1,302 +0,0 @@
<div id="sheet-container">
<div class="top-elements">
<div class="sheet-column">
<h6>Lingo:</h6>
<p>C: control key (CTRL)<br>
M: meta key (ALT or ESC)<br></p>
</div>
<div class="sheet-column">
<h6>Quick Answers:</h6>
<p><code>C-x C-f</code>: find file<br>
<code>C-x C-s</code>: save file<br>
<code>C-x C-c</code>: exit emacs<br></p>
</div>
</div>
<h6>Cursor Motion</h6>
<table class="sheet-table">
<tr>
<th rowspan=3>Amount</th>
<th colspan=4>Operation</th>
</tr>
<tr>
<th>Move</th>
<th>Move</th>
<th>Delete</th>
<th>Delete</th>
</tr>
<tr>
<th>Forward</th>
<th>Backward</th>
<th>Forward</th>
<th>Backward</th>
</tr>
<tr>
<td>Characters</td>
<td><code>C-f</code></td>
<td><code>C-b</code></td>
<td><code>C-d</code></td>
<td><code>DEL</code></td>
</tr>
<tr>
<td>Words</td>
<td><code>M-f</code></td>
<td><code>M-b</code></td>
<td><code>M-d</code></td>
<td><code>M-DEL</code></td>
</tr>
<tr>
<td>Lines</td>
<td><code>C-n</code></td>
<td><code>C-p</code></td>
<td><code>C-k</code></td>
<td><code>C-SPC C-a C-w</code></td>
</tr>
<tr>
<td>Sentences</td>
<td><code>M-e</code></td>
<td><code>M-a</code></td>
<td><code>M-k</code></td>
<td><code>C-x DEL</code></td>
</tr>
<tr>
<td>Expressions</td>
<td><code>C-M-f</code></td>
<td><code>C-M-b</code></td>
<td><code>C-M-k</code></td>
<td><code>C-M-DEL</code></td>
</tr>
<tr>
<td>Paragraphs</td>
<td><code>M-}</code></td>
<td><code>M-{</code></td>
<td>None</td>
<td>None</td>
</tr>
<tr>
<td>End/Start of Line</td>
<td><code>C-e</code></td>
<td><code>C-a</code></td>
<td>None</td>
<td>None</td>
</tr>
<tr>
<td>End/Start of Buffer</td>
<td><code>M-&gt;</code></td>
<td><code>M-&lt;</code></td>
<td>None</td>
<td>None</td>
</tr>
</table>
<div class="sheet-column">
<h6>Scrolling and Windows</h6>
<table class="sheet-table">
<tr>
<td><code>C-v</code></td>
<td>Page Down</td>
</tr>
<tr>
<td><code>M-v</code></td>
<td>Page Up</td>
</tr>
<tr>
<td><code>C-M-v</code></td>
<td>Page Down other window</td>
</tr>
<tr>
<td><code>C-x 1</code></td>
<td>Make current window only window</td>
</tr>
<tr>
<td><code>C-x 2</code></td>
<td>Split window vertically</td>
</tr>
<tr>
<td><code>C-x 3</code></td>
<td>Split window horizontally</td>
</tr>
<tr>
<td><code>C-x ^</code></td>
<td>Grow window vertically</td>
</tr>
<tr>
<td><code>C-x o</code></td>
<td>Switch to next window</td>
</tr>
<tr>
<td><code>C-x 0</code></td>
<td>Close current window</td>
</tr>
</table>
<h6>Cutting and Pasting</h6>
<table class="sheet-table">
<tr>
<td><code>C-SPC</code></td>
<td>Set mark</td>
</tr>
<tr>
<td><code>C-w</code></td>
<td>Cut (after setting mark and moving to end point)</td>
</tr>
<tr>
<td><code>M-w</code></td>
<td>Copy (after setting mark and moving to end point)</td>
</tr>
<tr>
<td><code>C-y</code></td>
<td>Yank (paste) most recently killed (cut or copied)</td>
</tr>
<tr>
<td><code>M-y</code></td>
<td>Yank next most recently killed</td>
</tr>
</table>
</div>
<div class="sheet-column">
<h6>Files and Buffers</h6>
<table class="sheet-table">
<tr>
<td><code>C-x C-f</code></td>
<td>Find file (or create if not existing)</td>
</tr>
<tr>
<td><code>C-x C-s</code></td>
<td>Save file</td>
</tr>
<tr>
<td><code>C-x C-w</code></td>
<td>Write file</td>
</tr>
<tr>
<td><code>C-x s</code></td>
<td>Save modified buffers</td>
</tr>
<tr>
<td><code>C-x b</code></td>
<td>Select buffer</td>
</tr>
<tr>
<td><code>C-x C-b</code></td>
<td>List buffers</td>
</tr>
<tr>
<td><code>C-x k</code></td>
<td>Kill buffer</td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
</table>
<h6>Command-Related Stuff</h6>
<table class="sheet-table">
<tr>
<td><code>ESC ESC ESC</code></td>
<td>Leave current location</td>
</tr>
<tr>
<td><code>C-u #</code></td>
<td>Prefix numeric argument # to next command</td>
</tr>
<tr>
<td><code>C-g</code></td>
<td>Stop running command, or cancel partially entered command</td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
<tr>
<td colspan=2>&nbsp;</td>
</tr>
</table>
</div>
<h6>Searching and Replacing</h6>
<table class="sheet-table">
<tr>
<td><code>C-s</code></td>
<td>Incremental search forward</td>
</tr>
<tr>
<td><code>C-r</code></td>
<td>Incremental search backward</td>
</tr>
<tr>
<td><code>C-M-s</code></td>
<td>Regexp search forward</td>
</tr>
<tr>
<td><code>C-M-r</code></td>
<td>Regexp search backward</td>
</tr>
<tr>
<td><code>M-x replace-string RET</code></td>
<td>String replace from here to end of buffer</td>
</tr>
<tr>
<td><code>M-x query-replace RET</code></td>
<td>String replace from here to end of buffer, querying for each occurrence</td>
</tr>
<tr>
<td><code>M-x grep RET</code></td>
<td>Prompts for a grep command, shows hits in a buffer</td>
</tr>
<tr>
<td><code>C-x `</code></td>
<td>Visit next grep hit</td>
</tr>
</table>
<div class="sheet-column">
<h6>Help</h6>
<table class="sheet-table">
<tr>
<td><code>C-h k</code></td>
<td>Show command documentation</td>
</tr>
<tr>
<td><code>C-h a</code></td>
<td>"Command apropos"</td>
</tr>
<tr>
<td><code>C-h c</code></td>
<td>Show command name on message line</td>
</tr>
<tr>
<td><code>C-h f</code></td>
<td>Describe function</td>
</tr>
<tr>
<td><code>C-h i</code></td>
<td>Info browser</td>
</tr>
</table>
</div>
<div class="sheet-column">
<h6>Misc</h6>
<table class="sheet-table">
<tr>
<td><code>C-_ or C-x u</code></td>
<td>Undo/redo</td>
</tr>
<tr>
<td><code>C-q</code></td>
<td>Quoted insert</td>
</tr>
<tr>
<td><code>C-z</code></td>
<td>Suspend/iconify emacs (type "%emacs" to return)</td>
</tr>
<tr>
<td><code>C-x C-c</code></td>
<td>Exit emacs</td>
</tr>
</table>
</div>
</div>

View File

@ -1,147 +0,0 @@
Lingo:
C: control key (CTRL)
M: meta key (ALT or ESC)
Quick Answers:
C-x C-f: find file
C-x C-s: save file
C-x C-c: exit emacs
Cursor Motion
Operation
Move
Move
Delete
Delete
Forward
Backward
Forward
Backward
Characters
C-f
C-b
C-d
DEL
Words
M-f
M-b
M-d
M-DEL
Lines
C-n
C-p
C-k
C-SPC C-a C-w
Sentences
M-e
M-a
M-k
C-x DEL
Expressions
C-M-f
C-M-b
C-M-k
C-M-DEL
Paragraphs
M-}
M-{
None
None
End/Start of Line
C-e
C-a
None
None
End/Start of Buffer
M-&gt;
M-&lt;
None
None
Scrolling and Windows
C-v
Page Down
M-v
Page Up
C-M-v
Page Down other window
C-x 1
Make current window only window
C-x 2
Split window vertically
C-x 3
Split window horizontally
C-x ^
Grow window vertically
C-x o
Switch to next window
C-x 0
Close current window
Cutting and Pasting
C-SPC
Set mark
C-w
Cut (after setting mark and moving to end point)
M-w
Copy (after setting mark and moving to end point)
C-y
Yank (paste) most recently killed (cut or copied)
M-y
Yank next most recently killed
Files and Buffers
C-x C-f
Find file (or create if not existing)
C-x C-s
Save file
C-x C-w
Write file
C-x s
Save modified buffers
C-x b
Select buffer
C-x C-b
List buffers
C-x k
Kill buffer
Command-Related Stuff
ESC ESC ESC
Leave current location
C-u #
Prefix numeric argument # to next command
C-g
Stop running command, or cancel partially entered command
Searching and Replacing
C-s
Incremental search forward
C-r
Incremental search backward
C-M-s
Regexp search forward
C-M-r
Regexp search backward
M-x replace-string RET
String replace from here to end of buffer
M-x query-replace RET
String replace from here to end of buffer, querying for each occurrence
M-x grep RET
Prompts for a grep command, shows hits in a buffer
C-x `
Visit next grep hit
Help
C-h k
Show command documentation
C-h a
"Command apropos"
C-h c
Show command name on message line
C-h f
Describe function
C-h i
Info browser
Misc
C-_ or C-x u
Undo/redo
C-q
Quoted insert
C-z
Suspend/iconify emacs (type "%emacs" to return)
C-x C-c
Exit emacs