term.js

A terminal written in javascript.

Github星跟蹤圖

term.js

A full xterm clone written in javascript. Used by
tty.js.

⚠️ This project is no longer maintained ⚠️. For a maintained fork take a look at sourcelair/xterm.js.

Example

Server:

var term = require('term.js');
app.use(term.middleware());
...

Client:

window.addEventListener('load', function() {
  var socket = io.connect();
  socket.on('connect', function() {
    var term = new Terminal({
      cols: 80,
      rows: 24,
      screenKeys: true
    });

    term.on('data', function(data) {
      socket.emit('data', data);
    });

    term.on('title', function(title) {
      document.title = title;
    });

    term.open(document.body);

    term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');

    socket.on('data', function(data) {
      term.write(data);
    });

    socket.on('disconnect', function() {
      term.destroy();
    });
  });
}, false);

Tmux-like

While term.js has always supported copy/paste using the mouse, it now also
supports several keyboard based solutions for copy/paste.

term.js includes a tmux-like selection mode (enabled with the screenKeys
option) which makes copy and paste very simple. Ctrl-A enters prefix mode,
from here you can type Ctrl-V to paste. Press [ in prefix mode to enter
selection mode. To select text press v (or space) to enter visual mode, use
hjkl to navigate and create a selection, and press Ctrl-C to copy.

Ctrl-C (in visual mode) and Ctrl-V (in prefix mode) should work in any OS
for copy and paste. y (in visual mode) will work for copying only on X11
systems. It will copy to the primary selection.

Note: Ctrl-C will also work in prefix mode for the regular OS/browser
selection. If you want to select text with your mouse and copy it to the
clipboard, simply select the text and type Ctrl-A + Ctrl-C, and
Ctrl-A + Ctrl-V to paste it.

For mac users: consider Ctrl to be Command/Apple above.

Contribution and License Agreement

If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. </legalese>

License

Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)

主要指標

概覽
名稱與所有者chjj/term.js
主編程語言JavaScript
編程語言Makefile (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2013-08-08 14:32:09
推送於2024-03-25 20:44:31
最后一次提交2016-06-06 14:44:20
發布數7
最新版本名稱v0.0.7 (發布於 )
第一版名稱v0.0.1 (發布於 )
用户参与
星數1.6k
關注者數48
派生數338
提交數99
已啟用問題?
問題數66
打開的問題數50
拉請求數14
打開的拉請求數34
關閉的拉請求數18
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?