Multiline

The plugin inverses the shift button when ARROW UP, ARROW DOWN or ENTER is pressed. This is to prevent arrow keys from browsing command history, but change line instead. Also it prevents the enter key from executing commands, but create new line instead. Hold SHIFT to achieve standard behaviour.

Command line interface

Syntax

The plugin is activated by entering a new line as the first character on a line (SHIFT+ENTER).

keyboard_multiline.js

  1. /**
  2. * If in a multiline statement, make new line on enter and change lines with arrows.
  3. * Then hold shift to browse command history or fire command.
  4. **/
  5. ts.onkeydown.push(function(e) {
  6. if (this.cursor_indexOf('\n') == 0) switch (e.key) {
  7. case 'enter':
  8. case 'up':
  9. case 'down':
  10. e.shift = !e.shift;
  11. break;
  12. }
  13. return true;
  14. });

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>