diff --git a/README.md b/README.md
index aaaafd9e8939e6fe0ba575f40856852d1fd4584b..841e38eef7db8dde71b18a68c555e68978bad48d 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ Ctrl-D       | (if line *is* empty) End of File
 Ctrl-E, End  | Move cursor to end of line
 Ctrl-F, Right| Move cursor one character right
 Ctrl-H, BackSpace | Delete character before cursor
-Ctrl-I, Tab          | Next completion
+Ctrl-I, Tab  | Next completion
 Ctrl-J, Ctrl-M, Enter | Finish the line entry
 Ctrl-K       | Delete from cursor to end of line
 Ctrl-L       | Clear screen
@@ -94,14 +94,16 @@ Ctrl-U       | Delete from start of line to cursor
 Ctrl-V       | Insert any special character without perfoming its associated action
 Ctrl-W       | Delete word leading up to cursor (using white space as a word boundary)
 Ctrl-Y       | Paste from Yank buffer (Meta-Y to paste next yank instead)
+Meta-<       | Move to first entry in history
+Meta->       | Move to last entry in history
 Meta-B, Alt-Left | Move cursor to previous word
-Meta-C        | Capitalize the current word
-Meta-D        | Delete forwards one word
+Meta-C       | Capitalize the current word
+Meta-D       | Delete forwards one word
 Meta-F, Alt-Right | Move cursor to next word
-Meta-L        | Lower-case the next word
-Meta-T        | Transpose words
-Meta-U        | Upper-case the next word
-Meta-Y        | See Ctrl-Y
+Meta-L       | Lower-case the next word
+Meta-T       | Transpose words
+Meta-U       | Upper-case the next word
+Meta-Y       | See Ctrl-Y
 Meta-BackSpace | Kill from the start of the current word, or, if between words, to the start of the previous word
 
 ## ToDo
diff --git a/src/lib.rs b/src/lib.rs
index bd065a116b6943a3b4e54f5ce87e8b934f500114..eb3e2cc345a6fd6f53883ad6f72a7a76696b2ed6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -690,7 +690,34 @@ fn edit_history_next(s: &mut State, history: &History, prev: bool) -> Result<()>
     } else {
         // Restore current edited line
         s.snapshot();
-    };
+    }
+    s.refresh_line()
+}
+
+/// Substitute the currently edited line with the first/last history entry.
+fn edit_history(s: &mut State, history: &History, first: bool) -> Result<()> {
+    if history.is_empty() {
+        return Ok(());
+    }
+    if s.history_index == history.len() {
+        if first {
+            // Save the current edited line before to overwrite it
+            s.snapshot();
+        } else {
+            return Ok(());
+        }
+    } else if s.history_index == 0 && first {
+        return Ok(());
+    }
+    if first {
+        s.history_index = 0;
+        let buf = history.get(s.history_index).unwrap();
+        s.line.update(buf, buf.len());
+    } else {
+        s.history_index = history.len();
+        // Restore current edited line
+        s.snapshot();
+    }
     s.refresh_line()
 }
 
@@ -897,9 +924,10 @@ impl<R: Read> RawReader<R> {
             // TODO ESC-N (n): search history forward not interactively
             // TODO ESC-P (p): search history backward not interactively
             // TODO ESC-R (r): Undo all changes made to this line.
-            // TODO ESC-<: move to first entry in history
-            // TODO ESC->: move to last entry in history
             match seq1 {
+                '\x08' => Ok(KeyPress::Meta('\x08')), // Backspace
+                '<' => Ok(KeyPress::Meta('<')),
+                '>' => Ok(KeyPress::Meta('>')),
                 'b' | 'B' => Ok(KeyPress::Meta('B')),
                 'c' | 'C' => Ok(KeyPress::Meta('C')),
                 'd' | 'D' => Ok(KeyPress::Meta('D')),
@@ -908,7 +936,6 @@ impl<R: Read> RawReader<R> {
                 't' | 'T' => Ok(KeyPress::Meta('T')),
                 'u' | 'U' => Ok(KeyPress::Meta('U')),
                 'y' | 'Y' => Ok(KeyPress::Meta('Y')),
-                '\x08' => Ok(KeyPress::Meta('\x08')), // Backspace
                 '\x7f' => Ok(KeyPress::Meta('\x7f')), // Delete
                 _ => {
                     // writeln!(io::stderr(), "key: {:?}, seq1: {:?}", KeyPress::Esc, seq1).unwrap();
@@ -1214,6 +1241,16 @@ fn readline_edit(prompt: &str,
                     kill_ring.kill(&text, false)
                 }
             }
+            KeyPress::Meta('<') => {
+                // move to first entry in history
+                kill_ring.reset();
+                try!(edit_history(&mut s, history, true))
+            }
+            KeyPress::Meta('>') => {
+                // move to last entry in history
+                kill_ring.reset();
+                try!(edit_history(&mut s, history, false))
+            }
             KeyPress::Meta('B') => {
                 // move backwards one word
                 kill_ring.reset();