3 A full xterm clone written in javascript. Used by
4 [**tty.js**](https://github.com/chjj/tty.js).
11 var term = require('term.js');
12 app.use(term.middleware());
19 window.addEventListener('load', function() {
20 var socket = io.connect();
21 socket.on('connect', function() {
22 var term = new Terminal({
28 term.on('data', function(data) {
29 socket.emit('data', data);
32 term.on('title', function(title) {
33 document.title = title;
36 term.open(document.body);
38 term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');
40 socket.on('data', function(data) {
44 socket.on('disconnect', function() {
53 While term.js has always supported copy/paste using the mouse, it now also
54 supports several keyboard based solutions for copy/paste.
56 term.js includes a tmux-like selection mode (enabled with the `screenKeys`
57 option) which makes copy and paste very simple. `Ctrl-A` enters `prefix` mode,
58 from here you can type `Ctrl-V` to paste. Press `[` in prefix mode to enter
59 selection mode. To select text press `v` (or `space`) to enter visual mode, use
60 `hjkl` to navigate and create a selection, and press `Ctrl-C` to copy.
62 `Ctrl-C` (in visual mode) and `Ctrl-V` (in prefix mode) should work in any OS
63 for copy and paste. `y` (in visual mode) will work for copying only on X11
64 systems. It will copy to the primary selection.
66 Note: `Ctrl-C` will also work in prefix mode for the regular OS/browser
67 selection. If you want to select text with your mouse and copy it to the
68 clipboard, simply select the text and type `Ctrl-A + Ctrl-C`, and
69 `Ctrl-A + Ctrl-V` to paste it.
71 For mac users: consider `Ctrl` to be `Command/Apple` above.
75 Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)