1.2 Jag: Terminal Editor With Mouse Support and Colour Highlighting - naver/lispe GitHub Wiki

Jag (작)

Version française

jag is a terminal editor that is compatible with Windows, Mac OS and Linux. It is basically the same editor as the one that is currently embedded in LispE.

(In Korean, jag means a job done by someone.)

jag offers:

  • mouse support
  • color highlighting for many languages (C++, python)
  • automatic indentation
  • regular expressions to search and replace
  • undo/redo mode (ctrl-u / ctrl-r)

The editor is pretty small and comes with a multitude of options:

Commandes :
   	- Ctrl-k: delete from cursor up to the end of the line
   	- Ctrl-d: delete a full line
   	- Ctrl-u: undo last modification
   	- Ctrl-r: redo last modification
   	- Ctrl-f: find a string
        - Ctrl-f then Ctrl-r: find a string and replace it with another
   	- Ctrl-n: find next
   	- Ctrl-g: move to a specific line, '$' is the end of the code
   	- Ctrl-l: reload file from disk
   	- Ctrl-t: reindent the code
   	- Ctrl-h: local help
   	- Ctrl-w: write file to disk
   	- Ctrl-c: exit the editor

   	- Alt-x: cut mouse selection
   	- Alt-c: copy mouse selection
   	- Alt-v: paste mouse selection
        - Alt-+: indent to the right
        - Alt--: de-indent to the left

   	- Ctrl-x: Combined Commands
                - f: search with LispE internal regular expressions (see link below)
                - F: search with posix regular expressions 
   		- D: delete a bloc of lines
   		- n: hide/display line numbers
   		- c: copy a bloc of lines
   		- x: cut a bloc of lines
   		- v: paste a bloc of lines
   		- w: write and quit
   		- l: load a file
   		- h: full help
   		- m: toggle mouse on/off
   		- u: toggle between top and bottom of the screen
                - +: indent current line or selected lines to the right
                - -: de-indent current line or selected lines to the left

   		- q: quit

LispE Internal Regular Expression Description

About mouse copy/paste

When the editor is in mouse mode, you must use alt-X, alt-C and alt-V to cut, copy and paste the selection. This selection copies the selected strings into an internal clipboard, which is different from the system clipboard. You can still copy from the system clipboard. However, if you want to cut/copy to the system clipboard, you must deactivate mouse mode first, with Ctrl-X m. You can return to mouse mode with Ctrl-X m again.

Linux Terminals: vt100

On Linux terminals, the mouse is off by default. To trigger the mouse at launch time, you need to add -m on the command line:

jag -m ...

Furthermore, some terminals require a different sets of instructions to handle the mouse than the default one. If the current mouse instructions are not recognized, some weird characters will appear on screen. In that case, you can launch jag with the option -vt100:

jag -m -vt100

Note that -m must precede -vt100.

Compile

First: python configure.py

then compile jag: make jag

See Note On Compiling for more information.

Use

You can edit any file with jag: jag file.

Within LispE

It is actually possible to modify the internal colours that are used to do syntax highlight with the following commands in console mode in LispE.

  • colors: display all possible colors in terminal
  • colors attribute foreground background: display one color with these values
  • syntax: display the selected colors for each token type in a program
  • syntax no: no colors
  • syntax dark: dark mode
  • syntax full: full color mode
  • syntax syncolor: display the '-syncolor' online command for LispE
    • Example: lispe -syncolor 0 31 49 3 0 0 0 34 49 0 90 49 0 32 49 1 91 49
  • syntax type att fg bg: modify the syntactic color associated with 'type'
    • Example: syntax definition 3 31 49

colors displays all available colours on screen. It can be followed with an atttribute, a foreground and a background value as displayed by colors.

syntax displays the colour that are associated to the different types of elements in a programme (strings, comments, keywords etc.) You can control the colours with some specific codes:

  • you can use no as a value
  • full returns to the original colors
  • dark enables the dark mode

You can also modify one of the different definitions with your own colours as displayed with colors.

Handling colors when launching jag or lispe.

syntax syncolor displays the syncolor line that can be used on the command line with lispe or jag.

-syncolor 0 31 49 3 0 0 0 34 49 0 90 49 0 32 49 1 91 49 7 93 40

This line can be used when calling jag or lispe to predefined the syntactic colors in advance:

liste -syncolor 0 31 49 3 0 0 0 34 49 0 90 49 0 32 49 1 91 49 7 93 40