Debian Codegraph @

README.md

raw symbols SCIP
1 # term.js
2
3 A full xterm clone written in javascript. Used by
4 [**tty.js**](https://github.com/chjj/tty.js).
5
6 ## Example
7
8 Server:
9
10 ``` js
11 var term = require('term.js');
12 app.use(term.middleware());
13 ...
14 ```
15
16 Client:
17
18 ``` js
19 window.addEventListener('load', function() {
20 var socket = io.connect();
21 socket.on('connect', function() {
22 var term = new Terminal({
23 cols: 80,
24 rows: 24,
25 screenKeys: true
26 });
27
28 term.on('data', function(data) {
29 socket.emit('data', data);
30 });
31
32 term.on('title', function(title) {
33 document.title = title;
34 });
35
36 term.open(document.body);
37
38 term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');
39
40 socket.on('data', function(data) {
41 term.write(data);
42 });
43
44 socket.on('disconnect', function() {
45 term.destroy();
46 });
47 });
48 }, false);
49 ```
50
51 ## Tmux-like
52
53 While term.js has always supported copy/paste using the mouse, it now also
54 supports several keyboard based solutions for copy/paste.
55
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.
61
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.
65
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.
70
71 For mac users: consider `Ctrl` to be `Command/Apple` above.
72
73 ## Contribution and License Agreement
74
75 If you contribute code to this project, you are implicitly allowing your code
76 to be distributed under the MIT license. You are also implicitly verifying that
77 all code is your original work. `</legalese>`
78
79 ## License
80
81 Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)