1# JOE - Joe's Own Editor 2 3[TOC] 4 5## Syntax 6 7__joe [global-options] [ [local-options] filename ]...__ 8<br> 9__jstar [global-options] [ [local-options] filename ]...__ 10<br> 11__jmacs [global-options] [ [local-options] filename ]...__ 12<br> 13__rjoe [global-options] [ [local-options] filename ]...__ 14<br> 15__jpico [global-options] [ [local-options] filename ]...__ 16 17## Description 18 19JOE is a powerful console screen editor. It has a "mode-less" user 20interface which is similar to many user-friendly PC editors. Users of 21Micro-Pro's WordStar or Borland's "Turbo" languages will feel at home. JOE 22is a full featured UNIX screen-editor though, and has many features for 23editing programs and text. 24 25JOE also emulates several other editors. JSTAR is a close imitation of 26WordStar with many "JOE" extensions. JPICO is a close imitation of the 27Pine mailing system's PICO editor, but with many extensions and 28improvements. JMACS is a GNU-EMACS imitation. RJOE is a restricted 29version of JOE, which allows you to edit only the files specified on the 30command line. 31 32Although JOE is actually five different editors, it still requires only one 33executable, but one with five different names. The name of the editor with 34an "rc" appended gives the name of JOE's initialization file, which 35determines the personality of the editor. 36 37JOE is free software; you can distribute it and/or modify it under the 38terms of the GNU General Public License as published by the Free Software 39Foundation. JOE is available over the Internet from 40<http://www.sourceforge.net/projects/joe-editor>. 41 42## Usage 43 44To start the editor, type __joe__ followed by zero or more names of files 45you want to edit. Each file name may be preceded by a local option setting 46(see the local options table which follows). Other global options, which 47apply to the editor as a whole, may also be placed on the command line (see 48the global options table which follows). If you are editing a new file, you 49can either give the name of the new file when you invoke the editor, or in 50the editor when you save the new file. A modified syntax for file names is 51provided to allow you to edit program output, standard input/output, or 52sections of files or devices. See the section [Filenames](#filenames) below for 53details. 54 55Once you are in the editor, you can type in text and use special 56control-character sequences to perform other editing tasks. To find out 57what the control-character sequences are, read the rest of this man page or 58type __^K H__ for help in the editor. 59 60Now for some obscure computer-lore: 61 62The __^__ means that you hold down the __Control__ key while pressing 63the following key (the same way the __Shift__ key works for uppercase 64letters). A number of control-key sequences are duplicated on other keys, 65so that you don't need to press the control key: __Esc__ will work in 66place of __^\[__, __Del__ will work in place of __^?__, __Backspace__ 67will work in place of __^H__, __Tab__ will work in place of __^I__, 68__Return__ or __Enter__ will work in place of __^M__ and 69__Linefeed__ will work in place of __^J__. Some keyboards may give you 70trouble with some control keys. __^___, __^^__ and __^@__ can usually 71be entered without pressing shift (i.e., try __^-__, __^6__ and 72__^2__). Other keyboards may reassign these to other keys. Try: 73__^.__, __^,__ and __^/__. __^Space__ can usually be used in place 74of __^@__. __^\\__ and __^\]__ are interpreted by many communication 75programs, including telnet and kermit. Usually you just hit the key twice 76to get it to pass through the communication program. 77 78On some keyboards, holding the __Alt__ key down while pressing another key 79is the same as typing __Esc__ before typing the other key. 80 81Once you have typed __^K H__, the first help window appears at the top of 82the screen. You can continue to enter and edit text while the help window 83is on. To page through other topics, hit __Esc ,__ and __Esc .__ (that is, 84__Esc ,__ and __Esc .__). Use __^K H__ to dismiss the help window. 85 86You can customize the keyboard layout, the help screens and a number of 87behavior defaults by copying JOE's initialization file (usually 88__/etc/joe/joerc__) to __.joerc__ in your home directory and then 89by modifying it. See the section [joerc](#joerc) below. 90 91To have JOE used as your default editor for e-mail and News, you need to set 92the __EDITOR__ and __VISUAL__ environment variables in your shell 93initialization file (__.cshrc__ or __.profile__) to refer to JOE (JOE 94usually resides as __/usr/bin/joe__). 95 96There are a number of other obscure invocation parameters which may have to 97be set, particularly if your terminal screen is not updating as you think it 98should. See the section [Environment variables](#evariables) below. 99 100<a name="options"></a> 101## Command Line Options 102 103These options can also be specified in the joerc file. Local options can be 104set depending on the file-name extension. Programs (.c, .h or .p extension) 105usually have autoindent enabled. Wordwrap is enabled on other files, but rc 106files have it disabled. 107 108An option is enabled when it's given like this: 109 110 -wordwrap 111 112An option is disabled when it's given like this: 113 114 --wordwrap 115 116Some options take arguments. Arguments are given like this: 117 118 -lmargin 5 119 120The following global options may be specified on the command line: 121 122* asis<br> 123Characters with codes above 127 will be sent to the terminal as-is, instead 124of as inverse of the corresponding character below 128. If this does not 125work, check your terminal server. This option has no effect if UTF-8 126encoding is used. 127<br> 128 129* assume_256color<br> 130Assume ANSI-like terminal emulator supports 256 colors even if termcap entry 131says it doesn't. 132<br> 133 134* assume_color<br> 135Assume ANSI-like terminal emulator supports color even if termcap entry says 136it doesn't. 137<br> 138 139* autoswap<br> 140Automatically swap __^K B__ with __^K K__ if necessary to 141mark a legal block during block copy/move commands. 142<br> 143 144* backpath path<br> 145Sets path to a directory where all backup files are 146to be stored. If this is unset (the default) backup files are stored in the 147directory containing the file. 148<br> 149 150* baud nnn<br> 151Set the baud rate for the purposes of terminal screen optimization 152(overrides value reported by stty). JOE inserts delays for baud rates below 15319200, which bypasses tty buffering so that typeahead will interrupt the 154screen output. Scrolling commands will not be used for 38400 baud and 155above. This is useful for X-terms and other console ttys which really 156aren't going over a serial line. 157<br> 158 159* beep<br> 160Enable beeps when edit commands return errors, for example when the cursor 161goes past extremes. 162<br> 163 164* break_links<br> 165When enabled, JOE first deletes the file before 166writing it in order to break hard-links and symbolic-links. 167<br> 168 169* break_hardlinks<br> 170When enabled, and the file is 171not a symbolic links, JOE first deletes the file before 172writing it in order to break hard-links. 173<br> 174 175* brpaste<br> 176When JOE starts, send command to the terminal emulator that 177enables "bracketed paste mode" (but only if the terminal 178seems to have the ANSI command set). In this mode, text 179pasted into the window is bracketed with ESC \[ 2 0 0 ~ and 180ESC \[ 2 0 1 ~. 181<br> 182 183* colors __scheme__<br> 184Sets the color scheme. 185<br> 186 187* columns nnn<br> 188Set number of columns in terminal emulator (in case 189termcap entry is wrong). This is only useful on old system which don't have 190the "get window size" ioctl. 191<br> 192 193* csmode<br> 194Enable continued search mode: Successive 195__^K F__s repeat the current search instead of prompting for a new one. 196<br> 197 198* dopadding<br> 199Enable JOE to send padding NULs to the terminal (for very old terminals). 200<br> 201 202* exask<br> 203When set, __^K X__ prompts for a new name before saving the file. 204<br> 205 206* floatmouse<br> 207When set, mouse clicks can position the cursor 208beyond the ends of lines. 209<br> 210 211* guess_crlf<br> 212When set, JOE tries to guess the file format 213MS-DOS or UNIX. 214<br> 215 216* guess_indent<br> 217When set, JOE tries to guess the indentation character and indentation 218step based on the contents of the file. The algorithm is to find the 219greatest common factor of the three most common indentations found in the 220file. 221<br> 222 223* guess_non_utf8<br> 224When set, enable guessing of non-UTF-8 files 225in UTF-8 locales. 226<br> 227 228* guess_utf8<br> 229When set, enable guessing of UTF-8 files in 230non-UTF-8 locales. 231<br> 232 233* guess_utf16<br> 234When set, enable guessing of UTF-16 files. If a UTF-16BE or UTF-16LE file 235is detected, it is converted to UTF-8 during load, and converted back to 236UTF-16 during save. 237<br> 238 239* helpon<br> 240When set, start off with the on-line help enabled. 241<br> 242 243* help_is_utf8<br> 244When set, the help text in the joerc file is 245assumed to be UTF-8. 246<br> 247 248* hiline<br> 249When set, the current line is highlighted. The current color scheme must 250support this. 251<br> 252 253* icase<br> 254Search is case insensitive by default when set. 255<br> 256 257* joe_state<br> 258Enable reading and writing of ~/.joe_state file 259<br> 260 261* joexterm<br> 262Set this if xterm was configured with --paste64 263option for better mouse support. 264<br> 265 266* keepup<br> 267The column number on the status line is updated constantly when 268this is set, otherwise it is updated only once a second. 269<br> 270 271* language __language__<br> 272Sets language for aspell. 273<br> 274 275* lightoff<br> 276Automatically turn off __^K B__ __^K K__ highlighting after a 277block operation. 278<br> 279 280* lines nnn<br> 281Set number of lines in terminal emulator (in case termcap entry is wrong). 282This is only useful on old system which don't have the "get window size" 283ioctl. 284<br> 285 286* marking<br> 287Enable marking mode: highlights between __^K B__ and cursor. 288<br> 289 290* menu_above<br> 291Put menus above prompt instead of below them. 292<br> 293 294* menu_explorer<br> 295Stay in menu when a directory is selected (otherwise the directory is added 296to the path and the cursor jumps back to the prompt). 297<br> 298 299* menu_jump<br> 300Jump into the file selection menu when __Tab__ __Tab__ is hit. 301<br> 302 303* mid<br> 304If this option is set and the cursor moves off the window, the window will 305be scrolled so that the cursor is in the center. This option is forced on 306slow terminals which don't have scrolling commands. 307<br> 308 309* left nn<br> 310This sets the number of columns the screen scrolls to the left when cursor 311moves past the left edge or when the crawll command is issued. If nn is 312negative, then it's the fraction of the screen to scroll. For example, -2 313means scroll 1/2 the screen. 314<br> 315 316* right nn<br> 317This sets the number of columns the screen scrolls to the right when cursor 318moves past the right edge or when the crawlr command is issued. If nn is 319negative, then it's the fraction of the screen to scroll. For example, -3 320means scroll 1/3 the screen. 321<br> 322 323* mouse<br> 324Enable xterm mouse support. 325<br> 326 327* nobackups<br> 328Disable backup files. 329<br> 330 331* nocurdir<br> 332Disable current-directory prefix in prompts. 333<br> 334 335* noexmsg<br> 336Disable exiting message ("File not changed so no update needed") 337<br> 338 339* nolinefeeds<br> 340Disable sending linefeeds to 341preserve screen history in terminal emulator's scroll-back buffer (only 342relevant when notite mode is enabled). 343<br> 344 345* nolocks<br> 346Disable EMACS compatible file locks. 347<br> 348 349* nomodcheck<br> 350Disable periodic file modification check. 351<br> 352 353* nonotice<br> 354This option prevents the copyright notice from being displayed when the 355editor starts. 356<br> 357 358* nosta<br> 359This option eliminates the top-most status line. It's nice for when you 360only want to see your text on the screen or if you're using a vt52. 361<br> 362 363* notagsmenu<br> 364Disable selection menu for tags search with multiple results. 365<br> 366 367* notite<br> 368Disable ti and te termcap sequences which are usually 369set up to save and restore the terminal screen contents when JOE starts and 370exits. 371<br> 372 373* pastehack<br> 374If keyboard input comes in as one block assume it's a mouse 375paste and disable autoindent and wordwrap. 376<br> 377 378* noxon<br> 379Disable __^S__ and __^Q__ flow control, possibly allowing __^S__ and __^Q__ to be used as 380editor keys. 381<br> 382 383* orphan<br> 384Orphan extra files given on the command line instead of creating windows for 385them (the files are loaded, but you need to use switch-buffer commands to 386access them). 387<br> 388 389* pg nnn<br> 390Set number of lines to keep during Page Up and Page Down (use -1 for 1/2 391window size). 392<br> 393 394* regex<br> 395Use standard regular expression syntax by default, instead of the JOE syntax 396(where special characters have their meaning only when preceded with 397backslash). 398<br> 399 400* restore<br> 401Set to have cursor positions restored to last positions of previously edited 402files. 403<br> 404 405* rtbutton<br> 406Swap left and right mouse buttons. 407<br> 408 409* search_prompting<br> 410Show previous search string in search command (like in PICO). 411<br> 412 413* skiptop nnn<br> 414When set to N, the first N lines of the terminal screen are not used by JOE 415and are instead left with their original contents. This is useful for 416programs which call JOE to leave a message for the user. 417<br> 418 419* square<br> 420Enable rectangular block mode. 421<br> 422 423* transpose<br> 424Transpose rows with columns in all menus. 425<br> 426 427* title<br> 428Display context (titles) in status line. When enabled this shows the first 429line of the function that the cursor is in on the status line. The syntax 430file context.jsf identifies which lines are title lines. 431<br> 432 433* type<br> 434Select file type, overriding the automatically determined type. The file 435types are defined in the __ftyperc__ file. 436<br> 437 438* undo_keep nnn<br> 439Sets number of undo records to keep (0 means infinite). 440<br> 441 442* usetabs<br> 443Set to allow rectangular block operations to use 444tabs. 445<br> 446 447* wrap<br> 448Enable search to wrap to beginning of file. 449<br> 450 451The following local options may be specified on the command line: 452 453* +nnn<br> 454The cursor starts on the specified line. 455<br> 456 457* autoindent<br> 458Enable auto-indent mode. When you hit __Enter__ on an indented line, the 459indentation is duplicated onto the new line. 460<br> 461 462* c_comment<br> 463Enable __^G__ skipping of C-style comments /* ... */ 464<br> 465 466* cpara __characters__<br> 467Sets list of characters which can indent paragraphs. 468<br> 469 470* cnotpara __characters__<br> 471Sets list of characters which begin lines which are definitely not part of 472paragraphs. 473<br> 474 475* cpp_comment<br> 476Enable __^G__ skipping of C++-style comments // ... 477<br> 478 479* crlf<br> 480JOE uses CR-LF as the end of line sequence instead of just LF. This is for 481editing MS-DOS or VMS files. 482<br> 483 484* encoding __encoding__<br> 485Set file encoding (like utf-8 or 8859-1). 486<br> 487 488* flowed<br> 489Set to force an extra space after each line of a paragraph but the last. 490<br> 491 492* force<br> 493When set, a final newline is appended to the file if 494there isn't one when the file is saved. 495<br> 496 497* french<br> 498When set, only one space is inserted after periods in paragraph reformats 499instead of two. 500<br> 501 502* hex<br> 503Enable hex-dump mode. 504<br> 505 506* highlight<br> 507Enable syntax highlighting. 508<br> 509 510* highlighter_context<br> 511Enable use of syntax file to identify comments and strings which should be 512skipped over during __^G__ matching. 513<br> 514 515* indentc nnn<br> 516Sets the indentation character for shift left and shift right (__^K ,__ and 517__^K .__). Use 32 for __Space__, 9 for __Tab__. 518<br> 519 520* indentfirst<br> 521When set, the smart home key jumps to the indentation point first, otherwise 522it jumps to column 1 first. 523<br> 524 525* istep nnn<br> 526Sets indentation step. 527<br> 528 529* linums<br> 530Enable line number display. 531<br> 532 533* lmargin<br> 534Set left margin. 535<br> 536 537* lmsg<br> 538Define left-side status bar message. 539<br> 540 541* overwrite<br> 542Enable overtype mode. Typing overwrites existing characters instead of 543inserting before them. 544<br> 545 546* picture<br> 547Enable "picture" mode- allows cursor to go past ends of lines. 548<br> 549 550* pound_comment<br> 551__^G__ ignores # ... comments. 552<br> 553 554* purify<br> 555Fix indentation if necessary before shifting or smart backspace. For 556example, if indentation uses a mix of tabs and spaces, and indentc is 557space, then indentation will be converted to all spaces before the shifting 558operation. 559<br> 560 561* rdonly<br> 562Set read-only mode. 563<br> 564 565* rmargin nnn<br> 566Set right margin. 567<br> 568 569* rmsg __string__<br> 570Define right-side status bar message. 571<br> 572 573* semi_comment<br> 574__^G__ ignores ; ... comments. 575<br> 576 577* single_quoted<br> 578__^G__ ignores '...' 579<br> 580 581* smartbacks<br> 582Enable smart backspace and tab. When this mode is set backspace and tab 583indent or unindent based on the values of the istep and indentc options. 584<br> 585 586* smarthome<br> 587Home key first moves cursor to beginning of line, then if hit again, to 588the first non-blank character. 589<br> 590 591* smsg __string__<br> 592Define status command format when cursor is on a character. 593<br> 594 595* spaces<br> 596Insert spaces when __Tab__ key is hit. 597<br> 598 599* syntax __syntax__<br> 600Set syntax for syntax highlighting. 601<br> 602 603* tab nnn<br> 604Set tab stop width. 605<br> 606 607* text_delimiters __word delimiter list__<br> 608Give list of word delimiters which __^G__ will step through. 609 610For example, "begin=end:if=elif=else=endif" means that __^G__ will jump 611between the matching if, elif, else and endif. 612 613* vhdl_comment<br> 614__^G__ ignores -- ... comments 615<br> 616 617* wordwrap<br> 618JOE wraps the previous word when you type past the right margin. 619<br> 620 621* zmsg __string__<br> 622Define status command format when cursor is at end of file. 623<br> 624 625* xmsg __string__<br> 626Define startup message (usually the copyright notice). 627<br> 628 629* aborthint __string__<br> 630Give the key sequence to show in prompts for abort (usually ^C). 631<br> 632 633* helphint __string__<br> 634Give the key sequence to show in prompts for help (usually ^K H). 635<br> 636 637### Colors and attributes 638 639Combine attributes and up to one foreground color and one background color 640to create arguments for color options like text_color. For example: 641bold+bg_green+blue 642 643* Attributes: bold, inverse, blink, dim, underline, italic, stricken (strike out) and dunderline (double-underline) 644 645* Foreground colors: white, cyan, magenta, blue, yellow, green, red, or black 646 647* Background colors: bg_white, bg_cyan, bg_magenta, bg_blue, bg_yellow, bg_green, bg_red or bg_black 648 649With a 16 color or 256 color terminal emulator (export TERM=xterm-16color), these 650brighter than normal colors become available: 651 652> Note that you need an xterm which was compiled to support 16 or 256 colors 653> and a matching termcap/terminfo entry for it. 654 655* Foreground: WHITE, CYAN, MAGENTA, BLUE, YELLOW, GREEN, RED or BLACK 656 657* Background: bg_WHITE, bg_CYAN, bg_MAGENTA, bg_BLUE, bg_YELLOW, bg_GREEN, bg_RED or bg_BLACK 658 659With a 256 color terminal emulator (export TERM=xterm-256color), these become available: 660 661> Note that you need an xterm which was compiled to support 256 colors and a 662> matching termcap/terminfo entry for it. 663 664* fg_RGB and bg_RGB, where R, G and B rand from 0 - 5. So: fg_500 is bright red. 665 666* fg_NN and bg_NN give shades of grey, where the intensity, NN, ranges from 0 - 23. 667 668### Status line definition strings 669 670-lmsg defines the left-justified string and -rmsg defines the 671right-justified string. The first character of -rmsg is the background fill 672character. 673 674-smsg defines the status command (__^K Space__). -zmsg defines it when the cursor 675is at the end of the file. The last character of smsg or zmsg is the fill character. 676 677The following escape sequences can be used in these strings: 678 679 %t 12 hour time 680 %u 24 hour time 681 %T O for overtype mode, I for insert mode 682 %W W if wordwrap is enabled 683 %I A if autoindent is enabled 684 %X Rectangle mode indicator 685 %n File name 686 %m '(Modified)' if file has been changed 687 %* '*' if file has been changed 688 %R Read-only indicator 689 %r Row (line) number 690 %c Column number 691 %o Byte offset into file 692 %O Byte offset into file in hex 693 %a Ascii value of character under cursor 694 %A Ascii value of character under cursor in hex 695 %w Width of character under cursor 696 %p Percent of file cursor is at 697 %l No. lines in file 698 %k Entered prefix keys 699 %S '*SHELL*' if there is a shell running in window 700 %M Macro recording message 701 %y Syntax 702 %e Encoding 703 %x Context (first non-indented line going backwards) 704 %dd day 705 %dm month 706 %dY year 707 %Ename% value of environment variable 708 %Tname% value of option (ON or OFF for Boolean options) 709 710These formatting escape sequences may also be given: 711 712 \i Inverse 713 \u Underline 714 \b Bold 715 \d Dim 716 \f Blink 717 \l Italic 718 \s Strikeout 719 \z Double underline 720<br> 721 722 723## Basic Editing 724 725When you type characters into the editor, they are normally inserted into 726the file being edited (or appended to the file if the cursor is at the end 727of the file). This is the normal operating mode of the editor. If you want 728to replace some existing text, you have to delete the old text before or 729after you type in the replacement text. The __Backspace__ key can be used 730for deleting text: move the cursor to right after the text you want to 731delete and hit __Backspace__ a number of times. 732 733Hit the __Enter__ or __Return__ key to insert a line-break. For 734example, if the cursor was in the middle of a line and you hit __Enter__, 735the line would be split into two lines with the cursor appearing at the 736beginning of the second line. Hit __Backspace__ at the beginning of a 737line to eliminate a line-break. 738 739Use the arrow keys to move around the file. If your keyboard doesn't have 740arrow keys (or if they don't work for some reason), use __^F__ to move 741forwards (right), __^B__ to move backwards (left), __^P__ to move to the 742previous line (up), and __^N__ to move to the next line (down). The right 743and left arrow keys simply move forwards or backwards one character at a 744time through the text: if you're at the beginning of a line and 745you press left-arrow, you will end up at the end of the previous line. The 746up and down arrow keys move forwards and backwards by enough characters so 747that the cursor appears in the same column that it was in on the original 748line. 749 750If you want to indent the text you enter, you can use the __Tab__ key. 751This inserts a special control character which makes the characters which 752follow it begin at the next tab stop. Tab stops normally occur every 8 753columns, but this can be changed with the __^T D__ command. PASCAL and C 754programmers often set tab stops on every 4 columns. 755 756If for some reason your terminal screen gets messed up (for example, if 757you receive a mail notice from biff), you can have the editor refresh the 758screen by hitting __^R__. 759 760There are many other keys for deleting text and moving around the file. For 761example, hit __^D__ to delete the character the cursor is on instead of 762deleting backwards like __Backspace__. __^D__ will also delete a 763line-break if the cursor is at the end of a line. Type __^Y__ to delete 764the entire line the cursor is on or __^J__ to delete just from the cursor 765to the end of the line. 766 767Hit __^A__ to move the cursor to the beginning of the line it's on. Hit 768__^E__ to move the cursor to the end of the line. Hit __^U__ or 769__^V__ for scrolling the cursor up or down 1/2 a screen's worth. 770"Scrolling" means that the text on the screen moves, but the cursor stays at 771the same place relative to the screen. Hit __^K U__ or __^K V__ to move 772the cursor to the beginning or the end of the file. Look at the help 773screens in the editor to find even more delete and movement commands. 774 775If you make a mistake, you can hit __^\___ to "undo" it. On most keyboards 776you hit just __^-__ to get __^\___, but on some you might have to hold 777both the __Shift__ and __Control__ keys down at the same time to get it. 778If you "undo" too much, you can "redo" the changes back into existence by 779hitting __^^__ (type this with just __^6__ on most keyboards). 780 781### Cursor position history 782 783If you were editing in one place within the file, and you then temporarily 784had to look or edit some other place within the file, you can get back to 785the original place by hitting __^K -__. This command actually returns you 786to the last place you made a change in the file. You can step through a 787history of places with __^K -__ and __^K =__, in the same way you can 788step through the history of changes with the "undo" and "redo" commands. 789 790### Save and exit 791 792When you are done editing the file, hit __^K X__ to exit the editor. You 793will be prompted for a file name if you hadn't already named the file you 794were editing. 795 796When you edit a file, you actually edit only a copy of the file. So if you 797decide that you don't want the changes you made to a file during a 798particular edit session, you can hit __^C__ to exit the editor without 799saving them. 800 801If you edit a file and save the changes, a backup copy of that file is 802created in the current directory, with a __~__ appended to the name, which 803contains the original version of the file. 804 805### File operations 806 807 808You can hit __^K D__ to save the current file (possibly under a different 809name from what the file was called originally). After the file is saved, 810you can hit __^K E__ to edit a different file. 811 812If you want to save only a selected section of the file, see the section on 813[Blocks](#blocks) below. 814 815If you want to include another file in the file you're editing, use __^K 816R__ to insert it. 817 818<a name="filenames"></a> 819### Filenames 820 821Wherever JOE expects you to enter a file name, whether on the command line 822or in prompts within the editor, you may also type: 823 824* !command 825 826To read or write data to or from a shell command. For example, 827use __joe '!ls'__ to get a copy of your directory listing to edit or from 828within the editor use __^K D !mail jhallen@world.std.com__ to send the 829file being edited to me. 830 831* >>filename 832 833Use this to have JOE append the edited text to the end of the file 834"filename." 835 836* filename,START,SIZE 837 838Use this to access a fixed section of a file or device. __START__ and 839__SIZE__ may be entered in decimal (ex.: 123) octal (ex.: 0777) or 840hexadecimal (ex.: 0xFF). For example, use __joe /dev/fd0,508,2__ to edit 841bytes 508 and 509 of the first floppy drive in Linux. 842 843* - 844 845Use this to get input from the standard input or to write output to the 846standard output. For example, you can put JOE in a pipe of commands: 847__quota -v | joe | mail root__, if you want to complain about your low 848quota. 849 850### Using JOE in a shell script 851 852JOE used to use /dev/tty to access the terminal. This caused a problem with 853idle-session killers (they would kill JOE because the real tty device was 854not being accessed for a long time), so now JOE only uses /dev/tty if you 855need to pipe a file into JOE, as in: 856 857 echo "hi" | joe 858 859If you want to use JOE in a shell script which has its stdin/stdout 860redirected, but you do not need to pipe to it, you should simply redirect 861JOE's stdin/stdout to /dev/tty: 862 863 joe filename </dev/tty >/dev/tty 864 865 866<br><br> 867 868### Word wrap and formatting 869 870If you type past the right edge of the screen in a C or PASCAL language 871file, the screen will scroll to the right to follow the cursor. If you type 872past the right edge of the screen in a normal file (one whose name doesn't 873end in .c, .h or .p), JOE will automatically wrap the last word onto the 874next line so that you don't have to hit __Enter__. This is called 875word-wrap mode. Word-wrap can be turned on or off with the __^T W__ 876command. JOE's initialization file is usually set up so that this mode is 877automatically turned on for all non-program files. See the section below on 878the [joerc](#joerc) file to change this and other defaults. 879 880Aside for Word-wrap mode, JOE does not automatically keep paragraphs 881formatted like some word-processors. Instead, if you need a paragraph to be 882reformatted, hit __^K J__. This command "fills in" the paragraph that the 883cursor is in, fitting as many words in a line as is possible. A paragraph, 884in this case, is a block of text separated above and below by a blank line. 885 886The margins which JOE uses for paragraph formatting and word-wrap can be set 887with the __^T L__ and __^T R__ commands. If the left margin is set to 888a value other than 1, then when you start typing at the beginning of a line, 889the cursor will immediately jump to the left margin. 890 891There are a number of options which control the paragraph reformatter and 892word wrapper: 893 894* The __cpara__ option provides a list of characters which can indent a 895 paragraph. For example, in e-mail quoted matter is indicated by __\>__ 896 at the beginnings of line, so this character should be in the cpara list. 897 898* The __cnotpara__ option provides a list of characters which, if they are 899 the first non-whitespace character of a line, indicate that the line is not 900 to be included as part of a paragraph for formatting. For example, lines 901 beginning with '.' in nroff can not be paragraph lines. 902 903* Autoindent mode affects the formatter. If autoindent is disabled, only 904 the first line will be indented. If autoindent is enabled, the entire 905 paragraph is indented. 906 907* __french__ determines how many spaces are inserted after periods. 908 909* When __flowed__ is enabled, a space is inserted after each but the 910 last line of the paragraph. This indicates that the lines belong together 911 as a single paragraph in some programs. 912 913* When __overtype__ is enabled, the word wrapper will not insert lines. 914 915### Centering 916 917If you want to center a line within the margins, use the __^K A__ 918command. 919 920### Spell checker 921 922Hit __Esc N__ to check the spelling of the word the cursor is on using the 923aspell program (or ispell program if you modify the joerc file). Hit 924__Esc L__ to check the highlighted block or the entire file if no block is 925highlighted. 926 927JOE passes the language and character encoding to the spell checker. To 928change the language, hit __^T V__. For example, use en_US for English. 929 930### Overtype mode 931 932Sometimes it's tiresome to have to delete old text before or after you 933insert new text. This happens, for example, when you are changing a table 934and you want to maintain the column position of the right side of the table. 935When this occurs, you can put the editor in overtype mode with __^T T__. 936When the editor is in this mode, the characters you type in replace existing 937characters, in the way an idealized typewriter would. Also, __Backspace__ 938simply moves left instead of deleting the character to the left, when it's 939not at the end or beginning of a line. Overtype mode is not the natural 940way of dealing with text electronically, so you should go back to 941insert-mode as soon as possible by typing __^T T__ again. 942 943If you need to insert while you're in overtype mode, hit __^@__. This 944inserts a single __Space__ into the text. 945 946### Control and Meta characters 947 948Each character is represented by a number. For example, the number for 'A' 949is 65 and the number for '1' is 49. All of the characters which you 950normally see have numbers in the range of 32 - 126 (this particular 951arbitrary assignment between characters and numbers is called the ASCII 952character set). The numbers outside of this range, from 0 to 255, aren't 953usually displayed, but sometimes have other special meanings. The number 95410, for example, is used for the line-breaks. You can enter these special, 955non-displayed __control characters__ by first hitting __^Q__ and then 956hitting a character in the range __@ A B C ... X Y Z [ ^ ] \\ \___ to get 957the number 0 - 31, and ? to get 127. For example, if you hit __^Q J__, 958you'll insert a line-break character, or if you hit __^Q I__, you'll insert 959a __Tab__ character (which does the same thing the __Tab__ key does). A useful 960control character to enter is 12 (__^Q L__), which causes most printers to 961advance to the top of the page. You'll notice that JOE displays this 962character as an underlined L. You can enter the characters above 127, the 963__meta characters__, by first hitting __^\\__. This adds 128 964to the next (possibly control) character entered. JOE displays characters 965above 128 in inverse-video. Some foreign languages, which have more letters 966than English, use the meta characters for the rest of their alphabet. You 967have to put the editor in __asis__ mode to have these 968passed untranslated to the terminal. 969 970__Note:__ JOE now normally passes all 8-bits to the terminal unless the 971locale is set to C or POSIX. If the locale is C or POSIX, then the __asis__ 972flag determines if __meta characters__ are shown in inverse video or passed 973directly to the terminal. 974 975__Note:__ In older version of JOE, you had to use __Esc '__ to enter control 976characters. 977 978## Character sets and UTF-8 979 980JOE natively handles two classes of character sets: UTF-8 and byte coded 981(like ISO-8859-1). For these character sets, the file is loaded as-is into 982memory, and is exactly preserved during save, even if it contains UTF-8 983coding errors. 984 985It can not yet natively handle other major classes such as UTF-16 or GB2312. 986There are other restrictions: character sets must use LF (0x0A) or CR-LF 987(0x0D - 0x0A) as line terminators, space must be 0x20 and tab must be 0x09. 988Basically, the files must be UNIX or MS-DOS compatible text files. 989 990This means EBCDIC will not work properly (but you would need to handle fixed 991record length lines anyway) and character sets which use CR terminated lines 992(MACs) will not yet work. 993 994JOE now supports UTF-16 (both big endian and little endian). It supports 995UTF-16 by converting to UTF-8 during load, and converting back to UTF-16 996during save. 997 998The terminal and the file can have different encodings. JOE will translate 999between the two. Currently, one of the two must be UTF-8 for translation to 1000work. 1001 1002The character set for the terminal and the default character set assumed for 1003files is determined by the 'LC_ALL' environment variable (and if that's not 1004set, LC_CTYPE and LANG are also checked). 1005 1006For example, if LC_ALL is set to: 1007 1008 de_DE 1009 1010Then the character set will be ISO-8859-1. 1011 1012If LC_ALL is set to: 1013 1014 de_DE.UTF-8 1015 1016The character set will be UTF-8. 1017 1018Hit __^T E__ to change the coding for the file. Hit __Tab__ __Tab__ at 1019this prompt to get a list of available codings. There are a number of 1020built-in character sets, plus you can install character sets in the 1021~/.joe/charmaps and /usr/share/joe/charmaps directories. 1022 1023Check: /usr/share/i18n/charmaps for example character set files. Only 1024byte oriented character sets will work. Also, the file should not be 1025gzipped (all of the charmap files in /usr/share/i18n/charmaps on my computer 1026were compressed). The parser is very bad, so basically the file has to look 1027exactly like the example one in /usr/share/joe/charmaps. 1028 1029You can hit __^K Space__ to see the current character set. 1030 1031You can hit __^Q x__ to enter a Unicode character if the file coding is 1032UTF-8. 1033 1034## Prompts 1035 1036Most prompts record a history of the responses you give them. You can hit 1037up and down arrow to step through these histories. 1038 1039Prompts are actually single line windows with no status line, so you can use 1040any editing command that you normally use on text within the prompts. The 1041prompt history is actually just other lines of the same "prompt file". Thus 1042you can can search backwards though the prompt history with the normal __^K 1043F__ command if you want. 1044 1045Since prompts are windows, you can also switch out of them with __^K P__ 1046and __^K N__. 1047 1048### Completion and selection menus 1049 1050You can hit __Tab__ in just about any prompt to request JOE to complete the 1051word you are typing. If JOE beeps, there are either no completions or many. 1052As with the "bash" shell, hit __Tab__ twice to bring up a list of all the 1053possibilities. This list is actually a menu, but by default, the cursor 1054does not jump into it since it is usually easier to just type in your 1055selection. You can, however, jump into the menu window with __^K P__ (move to 1056previous window) and use the arrow keys and <Enter> to make your 1057selection. Also in a menu, you can hit the first letter of any of the items 1058to make the cursor jump directly to it. The __^T__ option menu works like 1059this. 1060 1061If the menu is too large to fit in the window, you can hit Page Up and 1062Page Down to scroll it (even if you have not jumped into it). 1063 1064__Tab__ completion works in the search and replace prompts as well. In this 1065case, JOE tries to complete the word based on the contents of the buffer. 1066If you need search for the __Tab__ character itself, you can enter it with __^Q 1067Tab__. 1068 1069Also, you can hit __Esc Enter__ in a text window to request JOE to 1070complete the word you are typing. As with the search prompt, JOE tries to 1071complete the word based on the contents of the buffer. It will bring up a 1072menu of possibilities if you hit __Esc Enter__ twice. 1073 1074 1075## Where am I? 1076 1077 1078Hit __^K Space__ to have JOE report the line number, column number, and 1079byte number on the last line of the screen. The number associated with the 1080character the cursor is on (its ASCII code) is also shown. You can have the 1081line number and/or column number always displayed on the status line by 1082placing the appropriate escape sequences in the status line setup 1083strings. Edit the joerc file for details. 1084 1085## What if I hit __^K__ by accident? 1086 1087Hit the space bar. This runs an innocuous command (it shows the line 1088number on the status bar). 1089 1090## Temporarily suspending the editor 1091 1092 1093If you need to temporarily stop the editor and go back to the shell, hit 1094__^K Z__. You might want to do this to stop whatever you're editing and 1095answer an e-mail message or read this man page, for example. You have to 1096type __fg__ or __exit__ (you'll be told which when you hit __^K Z__) 1097to return to the editor. 1098 1099## Searching for text 1100 1101 1102Hit __^K F__ to have the editor search forwards or backwards for a text 1103fragment (__string__) for you. You will be prompted for the text to 1104search for. After you hit __Enter__, you are prompted to enter options. 1105You can just hit __Enter__ again to have the editor immediately search 1106forwards for the text, or you can enter one or more of these options: 1107 1108* __b__<br> 1109 1110Search backwards instead of forwards. 1111 1112* __i__<br> 1113 1114Treat uppercase and lower case letters as the same when searching. Normally 1115uppercase and lowercase letters are considered to be different. 1116 1117* __nnn__<br> 1118 1119(where __nnn__ is a number) If you enter a number, JOE searches for the 1120Nth occurrence of the text. This is useful for going to specific places in 1121files structured in some regular manner. 1122 1123* __r__<br> 1124 1125Replace text. If you enter the __r__ option, then you will be further 1126prompted for replacement text. Each time the editor finds the search text, 1127you will be prompted as to whether you want to replace the found search text 1128with the replacement text. You hit: __y__ to replace the text and then 1129find the next occurrence, __n__ to not replace this text, but to then find 1130the next occurrence, __r__ to replace all of the remaining occurrences of 1131the search text in the remainder of the file without asking for confirmation 1132(subject to the __nnn__ option above), or __^C__ to stop searching and 1133replacing. 1134 1135You can also hit __B__ or __Backspace__ to back up to the previously 1136found text (if it had been replaced, the replacement is undone). 1137 1138* __a__<br> 1139 1140The search covers all loaded buffers. So to replace all instances of "foo" 1141with "bar" in all .c files in the current directory: 1142 1143 joe *.c 1144 ^K F 1145 foo <Enter> 1146 ra <Enter> 1147 bar <Enter> 1148 1149* __e__<br> 1150 1151The search covers all files in the grep or make error list. You can use a 1152UNIX command to generate a list of files and search and replace through the 1153list. So to replace all instances of "foo" with "bar" in all .c files which 1154begin with f. You can also use "ls" and "find" instead of grep to create 1155the file list. 1156 1157 1158 Esc G 1159 grep -n foo f*.c <Enter> 1160 ^K F 1161 foo <Enter> 1162 re <Enter> 1163 bar <Enter> 1164 1165* __x__<br> 1166 1167JOE will use the standard syntax for regular expressions if this option is 1168given. In the standard syntax, these characters have their special 1169meanings directly, and do not have to be escaped with backslash: ., \*, \+, ?, 1170\{, \}, (, ), |, ^, $ and \[. 1171 1172* __y__<br> 1173 1174JOE will use the JOE syntax for regular expressions instead of the standard 1175syntax. This overrides the "-regex" option. 1176 1177* __v__<br> 1178 1179JOE will send debug information about the regular expression to the startup 1180log. The log can be viewed with the showlog command. 1181 1182You can hit __^L__ to repeat the previous search. 1183 1184You can hit __^K H__ at the search and replace options prompt to bring up a list 1185of all search and replace options. 1186 1187### Regular Expressions 1188 1189A number of special character sequences may be entered as search 1190text: 1191 1192* __\\\*__<br> 1193 1194This finds zero or more of the item to the left. For example, if you give 1195__AB\\\*C__ as the search text, JOE will try to find an A followed by any 1196number of Bs, and then a C. 1197 1198* __\\\+__<br> 1199 1200This finds one or more of the item to the left. For example, if you give 1201__AB\\\+C__ as the search text, JOE will try to find an A followed by one 1202or more Bs, and then a C. 1203 1204* __\\?__<br> 1205 1206This indicates that the item to the left is optional. For example, if you give 1207__AB\\?C__ as the search text, JOE will find AC or ABC. 1208 1209* __\\\{min,max\}__<br> 1210 1211This indicates that JOE should try to find a string with a specific number 1212of occurrences of the item to the left. For example, __AX\\\{2,5\}B__ will 1213match these strings: AXXB, AXXXB, AXXXXB, and AXXXXXB. Min can be left out 1214to indicate 0 occurrences. Max (and the comma) can be left out to indicate 1215any number of occurrences. 1216 1217* __\\.__<br> 1218 1219This finds exactly one character. For example, if you give __A\\.B__ as 1220the search text, JOE will find AXB, but not AB or AXXB. 1221 1222* __\\!__<br> 1223 1224This works like __\.__, but matches a balanced C-language expression. 1225For example, if you search for __malloc(\\!\\\*)__, then JOE will find all 1226function calls to __malloc__, even if there was a __)__ within the 1227parenthesis. 1228 1229* __\\|__<br> 1230 1231This finds the item on the left or the item on the right. For example, if 1232you give __A\\|B__ as the search text, JOE will try to find either an A or 1233a B. 1234 1235* __\\( \\)__<br> 1236 1237Use these to group characters together. For example, if you search for 1238__\\(foo\\)\\\+__, then JOE will find strings like "foo", and "foofoofoo". 1239 1240* __\^ \$__<br> 1241 1242These match the beginnings and endings of lines. For example, if you give 1243__\^test\$__, then JOE with find __test__ on a line by itself. 1244 1245* __\< \\\>__<br> 1246 1247These match the beginnings and endings of words. For example, if you give 1248__\<is\\\>__, then JOE will find the word "is" but will not find the "is" in 1249"this". 1250 1251* __\\\[...]__<br> 1252 1253This matches any single character which appears within the brackets. For 1254example, if __\\\[Tt]his__ is entered as the search string, then JOE finds 1255both __This__ and __this__. Ranges of characters can be entered within 1256the brackets. For example, __\\\[A-Z]__ finds any uppercase letter. If 1257the first character given in the brackets is __^__, then JOE tries to find 1258any character not given in the the brackets. To include __-__ itself, include 1259it as the last or first character (possibly after __^__). 1260 1261* __\\\\__<br> 1262 1263Matches a single \\. 1264 1265* __\n__<br> 1266 1267This finds the special end-of-line or line-break character. 1268 1269 1270A number of special character sequences may also be given in the replacement 1271string: 1272 1273* __\\&__<br> 1274 1275This gets replaced by the text which matched the search string. For 1276example, if the search string was __\<\\\*\\\>__, which matches words, and 1277you give __"\\&"__, then JOE will put quote marks around words. 1278 1279* __\1 - \9__<br> 1280 1281These get replaced with the text which matched the Nth grouping; the text 1282within the Nth set of \\( \\). 1283 1284* __\\l, \\u__<br> 1285 1286Convert the next character of the replacement text to lowercase or uppercase. 1287 1288* __\\L, \\U__<br> 1289 1290Convert all following replacement text to lowercase or uppercase. Conversion 1291stops when \\E is encountered. 1292 1293* __\\\\__<br> 1294 1295Use this if you need to put a __\\__ in the replacement string. 1296 1297* __\n__<br> 1298 1299Use this if you need to put a line-break in the replacement string. 1300 1301Some examples: 1302 1303Suppose you have a list of addresses, each on a separate line, which starts 1304with "Address:" and has each element separated by commas. Like so: 1305 1306Address: S. Holmes, 221b Baker St., London, England 1307 1308If you wanted to rearrange the list, to get the country first, then the 1309city, then the person's name, and then the address, you could do this: 1310 1311Type __^K F__ to start the search, and type: 1312 1313__Address:\\(\\.\\\*\\),\\(\\.\\\*\\),\\(\\.\\\*\\),\\(\\.\\\*\\)\$__ 1314 1315to match "Address:", the four comma-separated elements, and then the end of 1316the line. When asked for options, you would type __r__ to replace the 1317string, and then type: 1318 1319__Address:\4,\3,\1,\2__ 1320 1321To shuffle the information the way you want it. After hitting return, the 1322search would begin, and the sample line would be changed to: 1323 1324Address: England, London, S. Holmes, 221b Baker St. 1325 1326<a name="escapes"></a> 1327### Escape sequences 1328 1329JOE understands the following escape sequences withing search and 1330replacement strings: 1331 1332* \\x{10ffff}<br> 1333 1334This matches a specific Unicode code point given in hexadecimal. 1335 1336* \\xFF<br> 1337 1338This matches a specific character specified in hexadecimal. 1339 1340* \\377<br> 1341 1342This matches a specific character specified in octal. 1343 1344* \\p{Ll}<br> 1345 1346This matches any character in the named Unicode category or block. 1347 1348The block names, such as "Latin-1 Supplement" or "Arabic" can be found here: 1349 1350[Unicode Blocks](ftp://ftp.unicode.org/Public/8.0.0/ucd/Blocks.txt) 1351 1352The category names such as "Ll" can be found here: 1353 1354[Unicode Categories](ftp://ftp.unicode.org/Public/5.1.0/ucd/UCD.html#General_Category_Values) 1355 1356Note that a single letter matches all of the category names which start with 1357that letter. For example, \\p{N} (any number) include \\p{Nd} (decimal 1358digit), \\p{Nl} (letter number) and \\p{No} (other number). 1359 1360* \\d<br> 1361 1362This matches any Unicode digit. This is the same as \\p{Nd}. 1363 1364* \\D<br> 1365 1366This matches anything except for a Unicode digit. This is the same as 1367\\\[^\\p{Nd}]. 1368 1369* \\w<br> 1370 1371This matches any word character. This is the same as 1372\\\[^\\p{C}\\p{P}\\p{Z}]. 1373 1374* \\W<br> 1375 1376This matches anything except for a word character. This is the same 1377as \\\[\\p{C}\\p{P}\\p{Z}]. 1378 1379 1380* \\s<br> 1381 1382This matches any space character. This is the same as 1383\\\[\\t\\r\\f\\n\\p{Z}]. 1384 1385* \\S<br> 1386 1387This matches anything except for a spacing character. This is the 1388same as \\\[^\\t\\r\\f\\n\\p{Z}]. 1389 1390 1391* \\i<br> 1392 1393This matches an identifier start character. This is the same as 1394\\\[\\p{L}\\p{Pc}\\p{Nl}]. 1395 1396* \\I<br> 1397 1398This matches anything except for an identifier start character. This is the 1399same as \\\[^\\p{L}\\p{Pc}\\p{Nl}]. 1400 1401* \\c<br> 1402 1403This matches an identifier continuation character. This is the same as 1404\\\[\\i\\p{Mn}\\p{Mc}\\p{Nd}\\x{200c}\\x{200d}]. 1405 1406* \\C<br> 1407 1408This matches anything except for an identifier continuation character. This 1409is the same as \\\[^\\i\\p{Mn}\\p{Mc}\\p{Nd}\\x{200c}\\x{200d}]. 1410 1411* \\t Tab 1412* \\n Newline 1413* \\r Carriage return 1414* \\b Backspace 1415* \\a Alert 1416* \\f Formfeed 1417* \\e Escape 1418* \\\\ Backslash 1419 1420## Incremental search 1421 1422Use __Esc S__ to start an increment search forwards, or __Esc R__ to start 1423an incremental search backwards. As you type the search string, the cursor 1424will jump to the first text that matches the regular expression you have 1425entered so far. 1426 1427Hit __Esc S__ or __Esc R__ again to find the next occurrence of the text or 1428to switch the direction of the search. 1429 1430__^S__, __^\\__ and __^L__ have the same effect as __Esc S__. __^R__ has the same 1431effect as __Esc R__. These keys are to support JMACS. 1432 1433Hit __Backspace__ to undo the last incremental search action. The last 1434action could be a repeat of a previous search or the entering of a new 1435character. 1436 1437Use __^Q__ to insert control characters into the search text. Previously, 1438\` could also be used for this. 1439 1440Hit any other key to exit the increment search. 1441 1442## Goto matching delimiter 1443 1444Hit __^G__ to jump between matching delimiters. This works on both 1445character delimiters (like '(' and ')') and word delimiters for languages 1446like Pascal and Verilog which use "begin" and "end" to delimit blocks. It 1447also works for matching start and end tags in XML. If a word is not known, 1448__^G__ starts a search with the word moved into the search prompt. 1449 1450For __^G__ to work on word delimiters, the cursor must be positioned 1451on the first letter of the word. So in XML, if the cursor is on the < in 1452<foo>, it will jump to the >. But if it is one the 'f', it will 1453jump to the matching </foo>. Likewise, in C, __^G__ will jump between #if, #else 1454and #endif, but you need to position the cursor on the letter, 1455not the '#'. 1456 1457__^G__ is smart enough to skip delimiters found in quoted or 1458commented-out matter. You need to tell JOE how your language indicates 1459this: see the __ftyperc__ file for examples of how this is done. 1460 1461The are a number of options which control the behavior of __^G__. These 1462options control which kinds of comments __^G__ can skip over: 1463 1464* c_comment 1465* cpp_comment 1466* pount_comment 1467* semi_comment 1468* vhdl_comment 1469 1470These options determine which kinds of strings __^G__ can skip over: 1471 1472* single_quoted 1473* double_quoted 1474 1475This option allows an annotated syntax file to determine which text can be 1476counted as comments or strings which can be skipped over by __^G__: 1477 1478* highlighter_context 1479 1480This option enables the use of syntax files to identify comments and strings 1481which should be skipped over during __^G__ matching. The syntax file states 1482should be annotated with the __string__ and __comment__ keywords for this to 1483work. 1484 1485* text_delimiters 1486 1487This option provides a list of word delimiters to match. For example, 1488"begin=end:if=elif=else=endif" means that __^G__ will jump between the 1489matching if, elif, else and endif. It will also jump between begin and end. 1490 1491__^G__ has a built-in table for matching character delimiters- it knows that 1492__(__ goes with __)__. 1493 1494__^G__ has a built-in parser to handle start/end tag matching for XML. 1495 1496<a name="blocks"></a> 1497 1498## Regions 1499 1500If you want to move, copy, save or delete a specific section of text, you 1501can do it with highlighted blocks. First, move the cursor to the start of 1502the section of text you want to work on, and press __^K B__. Then move 1503the cursor to the character just after the end of the text you want to 1504affect and press __^K K__. The text between the __^K B__ and __^K K__ 1505should become highlighted. Now you can move your cursor to someplace else 1506in your document and press __^K M__ to move the highlighted text there. 1507You can press __^K C__ to make a copy of the highlighted text and insert 1508it to where the cursor is positioned. __^K Y__ to deletes the highlighted 1509text. __^K W__, writes the highlighted text to a file. 1510 1511A very useful command is __^K /__, which filters a block of text through a 1512UNIX command. For example, if you select a list of words with __^K B__ 1513and __^K K__, and then type __^K / sort__, the list of words will be 1514sorted. Another useful UNIX command for __^K /__, is __tr__. If you 1515type __^K / tr a-z A-Z__, then all of the letters in the highlighted block 1516will be converted to uppercase. 1517 1518### How do I deselect a highlighted region? 1519 1520After you are finished with some region operations, you can just leave the 1521highlighting on if you don't mind it (but don't accidentally hit __^K Y__). 1522If it really bothers you, however, just hit __^K B ^K K__, to turn the 1523highlighting off. 1524 1525Beginning with JOE 4.2, you can hit __^C__ to cancel the region selection. 1526 1527### New ways of selecting regions 1528 1529The classic way is to hit __^K B__ at the beginning and __^K K__ at the 1530end. These set pointers called markb and markk. Once these are set you 1531can jump to markb with __Esc B__ and jump to markk with __Esc K__. 1532 1533New way: hit Ctrl-__Right Arrow__ to start selecting rightward. Each time 1534you hit Ctrl-__Right Arrow__, the block is extended one more to the right. 1535This uses a simple macro: "begin_marking,rtarw,toggle_marking". 1536 1537Unfortunately, there is no standard way to get the keysequence given by the 1538terminal emulator when you hit Ctrl-__Right Arrow__. Instead you have to 1539determine this sequence yourself and enter it directly in the joerc file. 1540Some examples are given for Xterm and gnome-terminal. Hit __^Q__ 1541Ctrl-__Right Arrow__ within JOE to have the sequence shown on your screen. 1542Note that Putty uses __Esc Esc \[ C__ which will not appear with __^Q 1543Right Arrow__ (also __Esc Esc__ is the set bookmark command, so you need to 1544unbind it to do this in Putty). 1545 1546Also you can hit Ctrl-__Delete__ to cut and Ctrl-__Insert__ to paste if the 1547sequence for these keys are known. 1548 1549The mouse can also be used to select text if mouse support is enabled in 1550JOE. 1551 1552## Indenting program blocks 1553 1554Auto-indent mode is toggled with the __^T I__ command. The __joerc__ file 1555is normally set up so that files with names ending with .p, .c or .h have 1556auto-indent mode enabled. When auto-indent mode is enabled and you hit 1557__Enter__, the cursor will be placed in the same column that the first 1558non-whitespace character was on in the original line. 1559 1560You can use the __^K ,__ and __^K .__ commands to shift a block of text to 1561the left or right. If no highlighting is set when you give these commands, 1562the program block (as indicated by indentation) that the cursor is located in 1563will be selected, and will be moved by subsequent __^K ,__ and __^K .__ 1564commands. 1565 1566The number of columns these commands shift by and the character used for 1567shifting can be set through the istep and indentc options. These options 1568are available in the __^T__ menu. Also, __^T =__ can be used to quickly 1569select from a number of common values for indentation step and character. 1570 1571JOE has a number of additional options related to indenting programs: 1572 1573* smartbacks<br> 1574Enable smart backspace and tab. When this mode is set __Backspace__ and __Tab__ 1575indent or unindent based on the values of the istep and indentc options. 1576<br> 1577 1578* smarthome<br> 1579The __Home__ and __^A__ keys first move the cursor to the beginning of the 1580line, then if hit again, to the first non-blank character. 1581<br> 1582 1583* indentfirst<br> 1584Smart home goes to first non-blank character first, instead of going 1585to the beginning of the line first. 1586<br> 1587 1588* purify<br> 1589Fix indentation if necessary before shifting or smart backspace. For 1590example, if indentation uses a mix of tabs and spaces, and indentc is 1591space, then indentation will be converted to all spaces before the shifting 1592operation. 1593<br> 1594 1595* guess_indent<br> 1596When set, JOE tries to guess the indentation character and indentation 1597step based on the contents of the file. The algorithm is to find the 1598greatest common factor of the three most common indentations found in the 1599file. 1600<br> 1601 1602## Rectangle mode 1603 1604Type __^T X__ to have __^K B__ and __^K K__ select rectangular blocks 1605instead of stream-of-text blocks. This is also known as columnar mode. 1606This mode is useful for moving, copying, deleting or saving columns of text. 1607You can also filter columns of text with the __^K /__ command- if you want 1608to sort a column, for example. The insert file command, __^K R__ is also 1609affected. 1610 1611When rectangle mode is selected, overtype mode is also useful 1612(__^T T__). When overtype mode is selected, rectangles will replace 1613existing text instead of getting inserted before it. Also the delete block 1614command (__^K Y__) will clear the selected rectangle with __Spaces__ and __Tabs__ 1615instead of deleting it. Overtype mode is especially useful for the filter 1616block command (__^K /__), since it will maintain the original width of the 1617selected column. 1618 1619## Picture mode 1620 1621Use __^T P__ to enter or exit picture mode. Picture mode helps with ASCII 1622drawings. 1623 1624Picture mode controls how JOE handles the case where the cursor is past the 1625ends of lines. This happens when you use the up or down arrow keys to move 1626the cursor from the end of a long line to a short line. 1627 1628If you attempt to type a character in this case: 1629 1630If picture mode is off, the cursor will jump to the end of the line and 1631insert it there. 1632 1633If picture mode is on, the line is filled with spaces so that the character 1634can be inserted at the cursor position. 1635 1636## Windows 1637 1638You can edit more than one file at the same time or edit two or more 1639different places of the same file. To do this, hit __^K O__, to split the 1640screen into two windows. Use __^K P__ or __^K N__ to move the cursor 1641into the top window or the lower window. Use __^K E__ to edit a new 1642file in one of the windows. A window will go away when you save the file 1643with __^K X__ or abort the file with __^C__. If you abort a file which 1644exists in two windows, one of the window goes away, not the file. 1645 1646You can hit __^K O__ within a window to create even more windows. If you 1647have too many windows on the screen, but you don't want to eliminate them, 1648you can hit __^K I__. This will show only the window the cursor is in, or 1649if there was only one window on the screen to begin with, try to fit all 1650hidden windows on the screen. If there are more windows than can fit on 1651the screen, you can hit __^K N__ on the bottom-most window or __^K P__ 1652on the top-most window to get to them. 1653 1654If you gave more than one file name to JOE on the command line, each file 1655will be placed in a different window. 1656 1657You can change the height of the windows with the __^K G__ and __^K T__ 1658commands. 1659 1660### Windowing system model 1661 1662JOE has an unusual model for its windowing system. Basically you have a ring 1663of windows, but only a section of this ring may fit on the screen. The windows 1664not on the screen still exist, they are just scrolled off. When you hit 1665__^K N__ on the bottom window of the screen, it scrolls further windows from 1666the ring onto the screen, possibly letting the top window scroll out of 1667view. 1668 1669Native JOE tries to keep each loaded buffer in a window, so users can find 1670all of the buffers by scrolling through the windows. The __explode__ 1671command (__^K I__) either expands all windows to the size of the screen so 1672that only one window can fit on the screen, or shrinks them all as much as 1673possible to fit many on the screen. 1674 1675On the other hand, JOE supports "orphan" buffers- files loaded into the 1676editor, but which are not in a window. __^C__ normally closes a window and 1677discards the buffer that was in it. If you hit __^C__ on the last remaining 1678window, it will normally exit the editor. However, if there are orphan 1679buffers, __^C__ will instead load them into this final window to give you 1680a chance to explicitly discard them. If the __orphan__ option is given on 1681the command line, as in __joe -orphan *.c__, then JOE only loads the first 1682file into a window and leaves all the rest as orphans. 1683 1684__orphan__ also controls whether the edit command __^K E__ creates a new 1685window for a newly loaded file, or reuses the current window (orphaning its 1686previous occupant). 1687 1688The __bufed__ command prompts for a name of a buffer to switch into a window. 1689Its completion list will show all buffers, including orphans and buffers 1690which appear in other windows. __Esc V__ and __Esc U__ (__nbuf__ and 1691__pbuf__ commands) allow you to cycle through all buffers within a single 1692window. 1693 1694Windows maintain a stack of occupants to support the pop-up shell window 1695feature. When a pop-up window is dismissed, the previous buffer is returned 1696to the window. 1697 1698## Scratch buffers 1699 1700Scratch buffers are buffers which JOE does not worry about trying to 1701preserve. JOE will not ask to save modified scratch buffers. Pop-up shell 1702windows, the startup log and compile and grep message windows are scratch 1703buffers. You can create your own scratch buffer with the __scratch__ 1704command. 1705 1706The following commands load scratch buffers: 1707 1708* __showlog__ Show startup log 1709* __mwind__ Show message window (compile / grep messages from __Esc C__ and 1710 __Esc G__ commands). 1711 1712## Keyboard macros 1713 1714Macros allow you to record a series of keystrokes and replay them with the 1715press of two keys. This is useful to automate repetitive tasks. To start a 1716macro recording, hit __^K \[__ followed by a number from 0 to 9. The 1717status line will display (Macro n recording...). Now, type in the series of 1718keystrokes that you want to be able to repeat. The commands you type will 1719have their usual effects. Hit __^K ]__ to stop recording the macro. Hit 1720__^K__ followed by the number you recorded the macro in to execute one 1721iteration of the key-strokes. 1722 1723For example, if you want to put "**" in front of a number of lines, you can 1724type: 1725 1726__^K \[ 0 ^A \*\* __<down arrow\> __^K ]__ 1727 1728Which starts the macro recording, moves the cursor to the beginning of the 1729line, inserts "\*\*", moves the cursor down one line, and then ends the 1730recording. Since we included the key-strokes needed to position the cursor 1731on the next line, we can repeatedly use this macro without having to move 1732the cursor ourselves, something you should always keep in mind when 1733recording a macro. 1734 1735### Keyboard macro subroutines 1736 1737If you find that the macro you are recording itself has a repeated set of 1738key-strokes in it, you can record a macro within the macro, as long as you 1739use a different macro number. Also you can execute previously recorded 1740macros from within new macros. 1741 1742### Query suspend 1743 1744If your macro includes a prompt for user input, and you want the user to 1745fill in the prompt every time the macro is executed, hit __^K ?__ at the 1746point in the macro recording where the user action is required. Keyboard 1747input will not be recorded at this point. When the user completes the 1748prompt, macro recording will continue. 1749 1750When the macro is executed, the macro player will pause at the point where 1751__^K ?__ was entered to allow user input. When the user completes the 1752prompt, the player continues with the rest of the macro. 1753 1754### Repeat 1755 1756You can use the repeat command, __^K \\__, to repeat a macro, or any other 1757edit command or even a normal character, a specified number of times. Hit 1758__^K \\__, type in the number of times you want the command repeated and 1759press __Enter__. The next edit command you now give will be repeated 1760that many times. 1761For example, to delete the next 20 lines of text, type: 1762 1763__^K \\ 20__<return>__^Y__ 1764 1765## Macros and commands 1766 1767A macro is a comma separated list of commands. When the macro is executed, 1768each command is executed until either the end of the list is reached, or one 1769of the commands fails (non-zero return value from the command). Failed 1770commands beep if you have beeps enabled (__^T B__). 1771 1772Hit __Esc D__ to insert the current set of keyboard macros as text into the 1773current buffer. For example, the "\*\*" insert macro above looks like this: 1774 1775 home,"**",dnarw ^K 0 Macro 0 1776 1777You could insert this into your .joerc file and change the key sequence (the 1778__K 0__) to something more permanent. 1779 1780### Define your own 1781 1782You can bind macros to key sequences or define your own named macros in the 1783joerc file. For example, this will define a macro called __foo__: 1784 1785 :def foo eof,bol 1786 1787__foo__ will position the cursor at the beginning of the last line of the 1788file. __eof__ jumps to the end of the file. __bol__ jumps to the beginning 1789of a line. Once a macro has been named this way it will show up in the 1790completion list of the __Esc X__ command prompt. 1791 1792### Command prompt 1793 1794You can execute a macro directly by typing it into the command prompt. Hit 1795__Esc X__ to bring up the command prompt. Hit __Tab__ at this prompt for a 1796completion list of all available commands. 1797 1798Here is a [complete list of commands](#list). 1799 1800### Macro don't stop modifier 1801 1802Sometimes, you expect commands to sometimes fail, but want the rest of the 1803commands in the list to be executed anyway. To mark a command which is 1804allowed to fail, postfix it with '!'. For example, here a macro which hits 1805down page in the window above: 1806 1807 prevw,pgdn!,nextw 1808 1809If prevw fails, the macro is aborted as usual. Even if pgdn fails (already 1810at end of buffer), nextw will be executed so that the cursor is returned to 1811the original window. 1812 1813### Macro repeat argument modifiers 1814 1815Repeat arguments can be specified with __^K \\__. When a command is executed 1816with a repeat argument, it is repeatedly executed the specified number of 1817times. If the repeat argument is negative, an opposite command (if one 1818exists) is executed instead. For example, if you repeat "rtarw" -3 times, 1819"ltarw" will be repeated 3 times. If a negative argument is given for a 1820command which does not have an opposite, the repeat argument is ignored. 1821 1822Normally, if a repeat argument is specified for a macro, the macro is simply 1823repeated the given number of times. If a negative argument is given, the 1824argument is ignored. 1825 1826Sometimes you want to allow negative arguments for macros and have their 1827behavior modified. To do this, postfix each command within the macro which 1828should be switched to its opposite for negative arguments with '-'. For 1829example, here is the page down other window macro: 1830 1831 prevw,pgdn-!,nextw 1832 1833Now if you execute this with an argument of -2, it will be repeated twice, 1834but pgup will be executed instead of pgdn. (note that several postfix 1835modifiers can be placed after each command). 1836 1837Sometimes when a repeat argument is given to macro, you want only one of the 1838commands in the list to be repeated, not the entire macro. This can be 1839indicated as follows: 1840 1841 prevw,pgdn#!,nextw 1842 1843If this is executed with an argument of 2, prevw is executed once, pgdn is 1844executed twice, and nextw is executed once. 1845 1846Finally, even more complex semantics can be expressed with the "if" command: 1847 1848 if~,"arg<0",then, 1849 ltarw, 1850 else, 1851 rtarw, 1852 endif 1853 1854When the macro is executed, the "arg" math variable is set to the given 1855repeat argument. The "argset" variable is set to true if the user set an 1856argument, even if it's 1. If no argument was given, argset is false. 1857 1858If any command in the list is postfixed with ~ (if above), the macro is not 1859repeated, even if there is an argument. 'arg' is still set to the given 1860repeat count, however. 1861 1862### 'psh'/'query' interaction 1863 1864The 'psh' command saves the __^K B__ and __^K K__ positions on a stack. When the 1865macro completes, (or when the 'pop' command is called) the positions are 1866restored. 1867 1868The 'query' command suspends macro execution until the current dialog is 1869complete. It also suspends the automatic 'pop' which happens at the end 1870of a macro- so if the macro ends in a dialog you often want to call 'query' 1871to prevent the __^K B__ __^K K__ positions from being restored too early. 1872 1873 1874 1875## Tags search 1876 1877If you are editing a large C program with many source files, you can use the 1878__ctags__ program to generate a __tags__ file. This file contains a 1879list of program symbols and the files and positions where the symbols are 1880defined. 1881 1882 1883First, create the tags file with the "ctags" program. For example: 1884 1885 ctags *.c *.h 1886 1887This will create a file called "tags" in the current directory. 1888 1889JOE looks for the "tags" file in the current directory. If there is none, 1890it will try to open the file specified by the TAGS environment variable. 1891 1892Paths in the tags file are always relative to location of the tags file 1893itself. 1894 1895The tags file contains a list of identifier definition locations in one of 1896these formats: 1897 1898 identifier filename /search-expression/[;comments] 1899 1900 identifier filename ?search-expression?[;comments] 1901 1902 identifier filename line-number[;comments] 1903 1904Some versions of ctags include class-names in the identifiers: 1905 1906 class::member 1907 1908In this case, JOE will match on any of these strings: 1909 1910 member 1911 ::member 1912 class::member 1913 1914Some versions of ctags include a filename in the identifier: 1915 1916 filename:identifier 1917 1918In this case JOE will only find the identifier if the buffer name matches 1919the filename. 1920 1921The search-expression is a vi regular expression, but JOE only supports the 1922following special characters: 1923 1924 ^ at the beginning means expression starts at beginning of line 1925 1926 $ at the end means expression ends at end of line 1927 1928 \x quote x (suppress meaning of /, ?, ^ or $) 1929 1930Type __^K ;__ to bring up a tags search prompt. If the cursor had been on an 1931identifier, the prompt is pre-loaded with it. Tab completion works in this 1932prompt (it uses the tags file to find completions). 1933 1934When you hit __Enter__, the tags search commences: 1935 1936If there is one and only one match, JOE will jump directly to the 1937definition. 1938 1939If there are multiple matches, then the behavior is controlled by the 1940notagsmenu option. If notagsmenu is enabled JOE jumps to the first 1941definition. If you hit __^K ;__ again before hitting any other keys, JOE jumps 1942to the next definition, and so on. The "tagjump" command also performs this 1943function. 1944 1945If notagsmenu is disabled, JOE brings up a menu of all the matches. You 1946select the one you want and JOE jumps to it. If you hit __^K ;__ again before 1947hitting any other keys, the same menu re-appears with the cursor left in the 1948original location. 1949 1950You can hit __^K -__ to move the cursor back to the original location before the 1951tags search (often __^C__ will work as well). 1952 1953Since __^K ;__ loads the definition file into the current window, you 1954probably want to split the window first with __^K O__, to have both the 1955original file and the definition file loaded. 1956 1957## Calculator 1958 1959JOE has a built-in calculator which can be invoked with __Esc M__. 1960 1961### Math functions 1962 1963sin, cos, tan, exp, sqrt, cbrt, ln, log, 1964asin, acos, atan, sinh, cosh, tanh, asinh, acosh, 1965atanh, int, floor, ceil, abs, erf, erfc, j0, 1966j1, y0, y1 1967 1968### Variables 1969 1970* e<br> 1971Set to 'e' 1972<br> 1973 1974* pi<br> 1975Set to 'pi' 1976<br> 1977 1978* top<br> 1979Set to line number of top window line 1980<br> 1981 1982* lines<br> 1983Set to number of lines in file 1984<br> 1985 1986* line<br> 1987Set to current line number 1988<br> 1989 1990* col<br> 1991Set to current column number 1992<br> 1993 1994* byte<br> 1995Set to current byte number 1996<br> 1997 1998* size<br> 1999Set to buffer size 2000<br> 2001 2002* height<br> 2003Set to window height 2004<br> 2005 2006* width<br> 2007Set to window width 2008<br> 2009 2010* char<br> 2011Set to ASCII val of character under cursor 2012<br> 2013 2014* markv<br> 2015True if there is a valid block set (^KB ... ^KK) 2016<br> 2017 2018* rdonly<br> 2019True if file is read-only 2020<br> 2021 2022* arg<br> 2023Current repeat argument 2024<br> 2025 2026* argset<br> 2027True if a repeat argument was given 2028<br> 2029 2030* is_shell<br> 2031True if executed in an active shell window 2032<br> 2033 2034* no_windows<br> 2035No. buffer windows on the screen 2036<br> 2037 2038* ans<br> 2039Result of previous expression 2040<br> 2041 2042 2043### Commands 2044 2045* hex<br> 2046Hex display mode 2047<br> 2048 2049* dec<br> 2050Decimal display mode 2051<br> 2052 2053* ins<br> 2054Insert 'ans' into buffer 2055<br> 2056 2057* sum<br> 2058Sum of numbers in block 2059<br> 2060 2061* cnt<br> 2062Count numbers in block 2063<br> 2064 2065* avg<br> 2066Average value of numbers in block 2067<br> 2068 2069* dev<br> 2070Standard deviation of numbers in block 2071<br> 2072 2073* eval<br> 2074Evaluate math expressions in block (or whole file if no block set). 2075<br> 2076 2077* joe(...)<br> 2078Execute a JOE macro (argument in same format as joerc file macros). Return value of JOE macro is returned (for macro success, return true (non-zero)). 2079<br> 2080 2081 2082For example: 2083 2084 joe(sys,"[ 1 == 1 ]",rtn) 2085 2086([ 1 == 1 ]) is a shell command. "[" is a synonym for 2087the "test" UNIX command. 2088 2089Returns true. 2090 2091Remember: argument for JOE macro command 2092"if" is a math expression. So for example, the 2093macro: 2094 2095 if,"joe(sys,\"[ 1 == 1 ]\",rtn)",then,"TRUE",endif 2096 2097Types TRUE into the buffer. 2098 2099### Operators: 2100 2101* !x<br> 2102Logical not of x. 2103<br> 2104 2105* x^y<br> 2106Raise x to power of y. 2107<br> 2108 2109* a*b<br> 2110Multiply. 2111<br> 2112 2113* a/b<br> 2114Divide. 2115<br> 2116 2117* a%b<br> 2118Modulus. 2119<br> 2120 2121* a+b<br> 2122Add. 2123<br> 2124 2125* a-b<br> 2126Subtract. 2127<br> 2128 2129* a<b<br> 2130True if a is less than b. 2131<br> 2132 2133* a<=b<br> 2134True if a is less than or equal to b. 2135<br> 2136 2137* a>b<br> 2138True if a is greater than b. 2139<br> 2140 2141* a>=b<br> 2142True if a is greater than or equal to b. 2143<br> 2144 2145* a==b<br> 2146True if a equals b. 2147<br> 2148 2149* a!=b<br> 2150True if a does not equal b. 2151<br> 2152 2153* a&&b<br> 2154True if both a and b are true. 2155<br> 2156 2157* a||b<br> 2158True if ether a or b are true. 2159<br> 2160 2161* a?b:c<br> 2162If a is true return b, otherwise return c. 2163<br> 2164 2165* a=b<br> 2166Assign b to a. 2167<br> 2168 2169* a:b<br> 2170Execute a, then execute b. 2171<br> 2172 2173&&, || and ? : work as in C and sh as far as side effects: if the 2174left side of && is false, the right side is not evaluated. 2175 2176: is expression separator. 2177 2178## Shell windows 2179 2180Hit __^K '__ to run a command shell in one of JOE's windows. When the 2181cursor is at the end of a shell window (use __^K V__ if it's not), 2182whatever you type is passed to the shell instead of the buffer. Any output 2183from the shell or from commands executed in the shell is appended to the 2184shell window (the cursor will follow this output if it's at the end of the 2185shell window). This command is useful for recording the results of shell 2186commands- for example the output of __make__, the result of __grep__ping 2187a set of files for a string, or directory listings from __FTP__ sessions. 2188Besides typeable characters, the keys __^C__, __Backspace__, __Del__, __Return__ and 2189__^D__ are passed to the shell. Type the shell __exit__ command to stop recording 2190shell output. If you press __^C__ in a shell window, when the cursor is 2191not at the end of the window, the shell is __kill__ed. 2192 2193If you use Bash, you can hit: __^Q Up Arrow__ and __^Q Down Arrow__ to 2194scroll through Bash's history buffer. Other keys work as well: try 2195__^Q ^A__ to go to beginning of line or __^Q ^E__ to go to end of line. 2196Unfortunately JOE only emulates a dumb terminal, so you have to use a lot of 2197imagination to do any editing beyond hitting backspace. 2198 2199In general, any character quoted with __^Q__ is sent to the shell. 2200 2201Also sent to the shell: __Tab__, __Backspace__, __Enter__, __^C__ and __^D__. 2202 2203<a name="popup"></a> 2204## Pop-up shell windows 2205 2206Hit F1 - F4 to open and switch between shell windows. 2207 2208Pop-up shell windows use a full terminal emulator so that when you type "man ls" it's 2209formatted correctly (it works well enough so that some interactive programs 2210can be used). Even so, the shell window is still an edit buffer. 2211 2212The old shell window (with no terminal emulation) still exists: use __^K '__ to 2213invoke it as usual. This is useful to see control sequences emitted by a 2214program. 2215 2216More of the keys get passed to the running program in pop-up shell windows 2217compared with the older one. There is a :vtshell section of the joerc file to 2218control which ones. In particular arrow keys and Ctrl-C are passed to the 2219program. It means you can easily step through bash history with the arrow 2220keys, or abort programs the normal way with Ctrl-C. 2221 2222On the other hand, loss of Ctrl-C means it's less obvious how to close the 2223window. One way is to move the cursor off of the shell data entry point 2224(with Ctrl-P), and then hit Ctrl-C. Another is to hit __^K Q__. Finally, you 2225can type 'pop' at the command prompt. 2226 2227If you need to pass a key to the shell that JOE normally uses, quote it. For 2228example, if you invoke "emacs -nw" in the shell window, you can exit it with: 2229 2230 ^Q ^X ^C 2231 2232To quickly position the cursor back to the point where data is entered into 2233the shell, hit __^K V__. 2234 2235When you open a shell window, a JOE-specific startup-script is sourced. 2236It's located in /etc/joe/shell.sh (also /etc/joe/shell.csh). It contains 2237some aliases which allow you to control JOE with fake shell commands. I 2238have these commands so far: 2239 2240* clear <br> 2241erase shell window (delete buffer contents) 2242<br> 2243 2244* joe file <br> 2245edit a file in JOE 2246<br> 2247 2248* math 1+2 <br> 2249evaluate equation using JOE's calculator 2250<br> 2251 2252* cd xyz <br> 2253change directory, keep JOE up to date 2254<br> 2255 2256* markb <br> 2257same as ^KB 2258<br> 2259 2260* markk <br> 2261same as ^KK 2262<br> 2263 2264* mark command <br> 2265execute shell command, mark it's output 2266<br> 2267 2268* parse command<br> 2269execute shell command, parse it's output for file names and line numbers (for find or grep) 2270<br> 2271 2272* parser comman<br> 2273execute shell command, parse it's output for errors (for gcc) 2274<br> 2275 2276* release <br> 2277release parsed errors 2278<br> 2279 2280* pop <br> 2281dismiss shell window (same as ^K Q) 2282<br> 2283 2284 2285These work by emitting an escape sequence recognized by the terminal 2286emulator: __Esc { joe_macro }__. When this is received, the macro is executed. 2287For security, only macros defined in the joerc file which begin with 2288"shell_" can be executed this way. 2289 2290### Use cases 2291 2292Pop-up shell windows have a number of nice use cases: 2293 2294* Use it to browse manual pages 2295 2296 Hit F1 and type "man fopen". Use 'b' ('u') and space to control 2297 _more_ (or _less_) while viewing the manual. You can leave the manual 2298 on the screen in one window while editing in another window. 2299 2300* Use it to switch directories 2301 2302 Hit F1 and navigate to the directory while using _cd_. Once 2303 you are in the right place, hit __^K E__ to load a file (or type "edit file" 2304 from the shell). 2305 2306* Use it in conjunction with the error parser to find files 2307 2308 Hit F1 and navigate to a directory. Use grep or find (or both) 2309 to generate a list of files): 2310 2311~~~~ 2312 parse grep -n FIXME *.c 2313~~~~ 2314 2315Or: 2316 2317~~~~ 2318 markb; find . | xargs grep -n FIXME; markk; parse 2319~~~~ 2320 2321(Note that you can't say this: 2322 2323~~~~ 2324 parse find . | xargs grep -n FIXME 2325~~~~ 2326 2327...the issue is that only the words to the left of the pipe symbol 2328are passed as arguments to the parse command). 2329 2330Now use __^P__ to position the cursor on one of the lines of the list. Hit 2331__Esc Space__ to have JOE edit the file and jump to the specified line (also 2332you can use __Esc -__ and __Esc =__ to step through the list). 2333 2334* Use it in conjunction with search and replace to edit many files 2335 2336 Once JOE has a list of files (from above), use search and replace 2337 with the 'e' option to visit all of them: 2338 2339~~~~ 2340 ^K F 2341 Find: <text> 2342 Options: re 2343 Replace: <replacement text> 2344~~~~ 2345 2346* Build your project 2347 2348Easily capture errors from a build with: 2349 2350~~~~ 2351 parserr make 2352~~~~ 2353 2354Hit __Esc =__ and __Esc -__ to step through the errors. 2355 2356 2357### How it works.. 2358 2359* There is a new mode "ansi". (__Esc X__ mode ansi). When this mode is 2360enabled, the screen updater hides escape sequences which are in the 2361buffer. Otherwise you get a big mess from the sequences surrounding 2362colored output from 'ls'. 2363 2364* There is a new built-in syntax: "ansi". (__^T Y__ ansi). This syntax 2365parses the ANSI color control sequences so that text gets colored. 2366 2367* There is a terminal emulator to interpret control sequences from the 2368shell program. It emulates a terminal by modifying the contents of an 2369edit buffer. 2370 2371* When the edit window is resized we tell the shell by issuing the 2372TIOCSSIZE or TIOCSWINSZ ioctl. This way, the program running in the 2373shell knows the window size. 2374 2375## Compiler and grep/find parsers 2376 2377JOE has two parsers which can be used to generate the error list (list of 2378file names / line numbers). 2379 2380The "parserr" command parses the entire buffer, or if the block is set, just 2381the highighted block for compiler error messages. The messages should be in 2382this format: 2383 2384 <junk> file.name <junk> line-number <junk> : <junk> 2385 2386The file name needs to be made of numbers, letters, '/', '.' and '-'. It 2387must have at leat one '.' in it. There needs to be a colon somewhere after 2388the line number. Lines not in this format are ignored. 2389 2390The "gparse' command parses the entire buffer, or if the block is set, just 2391the highlighted block for a list of filenames or filenames with line numbers 2392from "grep -n", "find" and similar programs. 2393 2394 filename 2395 2396 filename:<junk> 2397 2398 filename:line-number:<junk> 2399 2400Once JOE has the error list, there are a number of things you can do with 2401it: 2402 2403* Visit the files/locations in the list with __Esc -__ and __Esc =__ 2404 2405* Search and replace across all files in the list by using the 'e' search 2406 and replace option. 2407 2408* Clear the list by using the "release" command. 2409 2410Also, you can use __Esc Space__ ('jump' command) to parse the line the cursor is 2411on and jump to the parsed filename and line number. 'jump' uses the 2412grep/find parser unless 'parserr' had been previously issued in the buffer. 2413 2414### Grep-find 2415 2416Hit __Esc G__ to bring up the prompt. Enter a command which results in file 2417names with line numbers, for example: 'grep -n fred \*.c'. This will list all 2418instances of 'fred' in the \*.c files. You need the '-n' to get the line 2419numbers. 2420 2421Now you can hit __Esc Space__ on one of the lines to jump to the selected 2422file. Also, you can use __Esc =__ and __Esc -__ to step through each line. 2423 2424### Compile 2425 2426Hit __Esc C__ to save all modified files and then bring up the compile prompt. 2427Enter the command you want to use for the compiler (typically "make -w"). The 2428compiler will run in a shell window. When it's complete, the results are 2429parsed. 2430 2431The '-w' flag should be given to "make" so that it prints messages whenever 2432it changes directories. The message are in this format: 2433 2434 make[1]: Entering directory `/home/jhallen/joe-editor-mercurial/joe' 2435 2436If there are any errors or warnings from the compiler you can hit 2437__Esc Space__ on one of the lines to jump to the selected file. Also, 2438you can use __Esc =__ and __Esc -__ to step through each line. 2439 2440## Syntax highlighting 2441 2442To enable highlight use __^T H__. 2443 2444To select the syntax, use __^T Y__. You can hit __Tab__ __Tab__ at the prompt for a 2445completion list. 2446 2447JOE tries to determine the syntax to use based on the name and contents of 2448the file. The configuration file /etc/joe/ftyperc contains the definitions. 2449 2450Each syntax is defined by a file located /usr/share/joe/syntax/. 2451 2452## How JOE syntax highlighting works 2453 2454*from [c.jsf](http://joe-editor.hg.sourceforge.net/hgweb/joe-editor/joe-editor/file/tip/syntax/c.jsf.in), 2455slightly modified* 2456 2457A deterministic state machine that performs lexical analysis of the target 2458language is provided in a syntax file. (This is the "assembly language" of 2459syntax highlighting. A separate program could in principal be used to 2460convert a regular expression NFA syntax into this format). 2461 2462Each state begins with: 2463 2464 :<name> <color-name> <context> 2465 2466<name\> is the state's name. 2467 2468<color-name\> is the color used for characters eaten by the state 2469(really a symbol for a user definable color). 2470 2471<context\> tells JOE if the current character is part of a comment or a 2472string. This allows JOE to skip over comments and strings when matching 2473characters such as parentheses. To use this feature, the 2474highlighter_context option must be applied to the files highlighted by the 2475corresponding syntax. To apply the option, add it to ftyperc for those file 2476entries. 2477 2478The valid contexts are: 2479 2480 * comment This character is part of a comment. Example: /\* comment \*/ 2481 2482 * string This character is part of a string. Examples: "string" 'c' 'string' 2483 2484The comment and string delimiters themselves should be marked with the 2485appropriate context. The context is considered to be part of the color, so 2486the recolor=-N and recolormark options apply the context to previous 2487characters. 2488 2489The first state defined is the initial state. 2490 2491Within a state, define transitions (jumps) to other states. Each 2492jump has the form: 2493 2494 <character-list> <target-state-name> [<option>s] 2495 2496There are three ways to specify <character-list\>s, either __\*__ for any 2497character not otherwise specified, __%__ or __&__ to match the character in 2498the delimiter match buffer (__%__ matches the saved character exactly, while 2499__&__ matches the opposite character, for example \( will match \) when 2500__&__ is used) or a literal list of characters within quotes (ranges and 2501escape sequences allowed: see [Escape Sequences](#escapes)). When the next 2502character matches any in the list, a jump to the target-state is taken and 2503the character is eaten (we advance to the next character of the file to be 2504colored). 2505 2506The * transition should be the first transition specified in the state. 2507 2508There are several options: 2509 2510* __noeat__ - Do not eat the character, instead feed it to the next state 2511 (this tends to make the states smaller, but be careful: you 2512 can make infinite loops). 'noeat' implies 'recolor=-1'. 2513 2514* __recolor=-N__ - Recolor the past N characters with the color of the 2515 target-state. For example once /\* is recognized as the 2516 start of C comment, you want to color the /\* with the C 2517 comment color with recolor=-2. 2518 2519* __mark__ - Mark beginning of a region with current position. 2520 2521* __markend__ - Mark end of region. 2522 2523* __recolormark__ - Recolor all of the characters in the marked region with 2524 the color of the target-state. If markend is not given, 2525 all of the characters up to the current position are recolored. 2526 Note that the marked region can not cross line boundaries and 2527 must be on the same line as recolormark. 2528 2529* __buffer__ - Start copying characters to a string buffer, beginning with this 2530 one (it's OK to not terminate buffering with a matching 2531 'strings', 'istrings' or 'hold' option- the buffer is limited 2532 to leading 23 characters). 2533 2534* __save_c__ - Save character in delimiter match buffer. 2535 2536* __save_s__ - Copy string buffer to delimiter match buffer. 2537 2538* __strings__ - A list of strings follows. If the buffer matches any of the 2539 given strings, a jump to the target-state in the string list 2540 is taken instead of the normal jump. 2541 2542* __istrings__ - Same as strings, but case is ignored. 2543 Note: strings and istrings should be the last option on the 2544 line. They cause any options which follow them to be ignored. 2545 2546* __hold__ - Stop buffering string- a future 'strings' or 'istrings' will 2547 look at contents of buffer at this point. Useful for distinguishing 2548 commands and function calls in some languages 'write 7' is a command 2549 'write (' is a function call- hold lets us stop at the space and delay 2550 the string lookup until the ( or 7. 2551 2552The format of the string list is: 2553 2554 "string" <target-state> [<options>s] 2555 "string" <target-state> [<options>s] 2556 "&" <target-state> [<options>s] # matches contents of delimiter match buffer 2557 done 2558 2559(all of the options above are allowed except "strings", "istrings" and "noeat". noeat is 2560always implied after a matched string). 2561 2562Weirdness: only states have colors, not transitions. This means that you 2563sometimes have to make dummy states with 2564 2565 * <next-state> noeat 2566 2567just to get a color specification. 2568 2569Delimiter match buffer is for perl and shell: a regex in perl can be s<..>(...) 2570and in shell you can say: <<EOS ....... EOS. The idea is that you capture 2571the first delimiter into the match buffer (the < or first "EOS") and then 2572match it to the second one with "&" in a string or character list. 2573 2574### Subroutines 2575 2576Highlighter state machines can now make subroutine calls. This works by 2577template instantiation: the called state machine is included in your 2578current state machine, but is modified so that the return address points 2579to the called. There is still no run-time stack (the state is represented 2580as a single integer plus the saved delimiter string). 2581 2582Recursion is allowed, but is self limited to 5 levels. 2583 2584__Note:__ this recursion limit is obsolete. Subroutines now do use a stack 2585so the call-depth is limitless. 2586 2587To call a subroutine, use the 'call' option: 2588 2589 "\"" fred call=string(dquote) 2590 2591The subroutine called 'string' is called and the jump to 'fred' is 2592ignored. The 'dquote' option is passed to the subroutine. 2593 2594If you use recolor along with call, the color used is that of the first 2595state of the subroutine. 2596 2597The subroutine itself returns to the caller like this: 2598 2599 "\"" whatever return 2600 2601If we're in a subroutine, it returns to the target state of the call ("fred" 2602in the above example). If we're not in a subroutine, it jumps to 2603"whatever". 2604 2605If you use recolor along with return, the color used is from the returned 2606state ("fred" in the example above). 2607 2608There are several ways of delimiting subroutines which show up in how it 2609is called. Here are the options: 2610 2611* __call=string()__ - A file called string.jsf is the subroutine. 2612 The entire file is the subroutine. The starting 2613 point is the first state in the file. 2614 2615* __call=library.string()__ - A file called library.jsf has the subroutine. 2616 The subroutine within the file is called string. 2617 2618* __call=.string()__ - There is a subroutine called string in the current file. 2619 2620When a subroutine is within a file, but is not the whole file, it is delimited 2621as follows: 2622 2623 .subr string 2624 2625 . . . states for string subroutine . . . 2626 2627 .end 2628 2629Option flags can be passed to subroutines which control preprocessor-like 2630directives. For example: 2631 2632 .ifdef dquote 2633 "\"" idle return 2634 .endif 2635 .ifdef squote 2636 "'" idle return 2637 .endif 2638 2639.else is also available. .ifdefs can be nested. 2640 2641<a name="joerc"></a> 2642 2643### Color schemes 2644 2645Color *classes* are declared at the top of each syntax file, and referenced 2646from each state. Previously, colors would be specified alongside each class 2647in the syntax files, but they are now globally specified by color schemes. 2648The syntax files will pull in all colors relevant to their languages by 2649declaring them, optionally referencing other classes in case a class isn't 2650specified by a color scheme. For example, this is typical: 2651 2652 =Constant 2653 =String +Constant 2654 =Number +Constant 2655 2656Both the `String` and `Number` classes can be defined by the color scheme. 2657If they aren't, each will fall back to `Constant`, which is logically a 2658superset of strings and numbers. More than one class can be referenced in a 2659class declaration; JOE will pick the first one that is defined. 2660 2661In this manner schemes can define a broad and generic set of color classes 2662and syntax files can filter those into the color classes applicable to their 2663languages. This assumes that syntaxes and color schemes follow a particular 2664convention, which is laid out in __syntax/CLASSES.md__. 2665 2666### Color scheme files 2667 2668Color scheme files are divided into sections based on the number of colors 2669available to the terminal to support e.g. 256-color terminals vs 88-color 2670terminals vs terminals with [24-bit color support](https://gist.github.com/XVilka/8346728). 2671Each section starts with the `.colors` directive: 2672 2673 .colors 256 2674 # 256-color terminal section 2675 .colors * 2676 # Truecolor terminal section 2677 2678The above scheme would fail to load on a 16-color terminal. JOE will check 2679if the `COLORTERM` environment variable is set to `24bit` or `truecolor` to 2680determine if a terminal supports 24 bit color, due to the fact that terminfo 2681currently lacks this support. In Windows, JOE automatically supports 24 bit 2682color. 2683 2684Environment colors are specified as such: 2685 2686 -text <fg>/<bg> <attributes> 2687 2688Where `<fg>` and `<bg>` are both optional, and can be any of: 2689 2690* Color names: white, cyan, magenta, blue, yellow, green, red, or black, WHITE, 2691CYAN, MAGENTA, BLUE, YELLOW, GREEN, RED or BLACK (where upper-case colors 2692are the high intensity versions from 16 color terminals). 2693 2694* `default` for the terminal's default foreground or background color. 2695 2696* Color numbers: 0-255 xterm colors 2697 2698* RGB specifications in the standard `$RRGGBB` form (only in the 24-bit 2699section). 2700 2701Attributes can be `bold`, `inverse`, `blink`, `dim`, `underline`, `italic`, 2702`stricken` and `dunderline`. 2703 2704A number of environment colors can be changed: 2705 2706* `-text` specifies the default environment text. 2707* `-status` specifies the status line's color. 2708* `-selection` specifies the color used for selection. 2709* `-help` specifies the help text background color. 2710* `-menu` specifies the inactive menu item color. 2711* `-menusel` specifies the active menu item color. 2712* `-prompt` specifies prompt color. 2713* `-message` specifies message color. 2714* `-linum` specifies the color in the line number gutter. 2715* `-curlin` specifies the current line color (if `hiline` is on). 2716* `-curlinum` specifies the current line number color (if `hiline` is on). 2717 2718These do not all need to be specified. `-text` defaults to the terminal's 2719default foreground/background colors. Each other will pick up the value of 2720`-text` (plus `inverse` in a few cases) if it is not specified. 2721 2722When using pop-up terminals, JOE will remap colors 0-15 based on colors 2723found in the scheme specified by `-term <n> __color spec__`. 2724 2725The rest of the file is color classes that map into syntax colors. Color 2726classes can be set by either: 2727 2728 =ClassName <color spec> 2729 =syntaxname.ClassName <color spec> 2730 2731In the second case, the color will only apply to the specified syntax. 2732 2733Lastly, macros can be defined in color scheme files to simplify their 2734maintenance. For example: 2735 2736 .set dark_blue 66 2737 # ... 2738 =Define [dark_blue] 2739 2740References to `dark_blue` must be in brackets, and their values will be 2741substituted by a simple string replacement before parsing the line (which 2742means macros can contain any text, not just color values). 2743 2744## The joerc file 2745 2746__^T__ options, the help screens and the key-sequence to editor command 2747bindings are all defined in JOE's initialization file. If you make a copy 2748of this file (which normally resides in __/etc/joe/joerc__) to 2749__$HOME/.joerc__, you can customize these setting to your liking. The 2750syntax of the initialization file should be fairly obvious and there are 2751further instructions in it. 2752 2753The __joerc__ file has a directive to include another file (:include). This 2754facility is used to include a file called __ftyperc__ (usually located in 2755__/etc/joe/ftyperc__). __ftyperc__ has the file type table which determines 2756which local options (including syntax for the highlighter) are applied to 2757each file type. 2758 2759### Initialization file loading sequence 2760 2761If the path for an initialization file begins with '/' (you can specify this 2762with the include directive), JOE only tries to load it from the absolute 2763path. Otherwise, JOE tries to load initialization files (the joerc file and 2764any files included in it, typically ftyperc) from three places: 2765 2766* "$HOME/.joerc" - The user's personalized joerc file. 2767 2768* "/etc/joe/joerc" - The system's joerc file. 2769The exact path is fixed during the build, and is determined by the 2770--sysconfdir configure script option. 2771 2772* "*joerc" - Built-in file 2773This means JOE searches for the file in a table of files linked in with the 2774JOE binary (they are in the builtins.c file). A built-in joerc file is 2775provided so that the editor will run in cases where system's joerc is 2776inaccessible. 2777 2778If the system's joerc file is newer than the user's joerc file, JOE will 2779print a warning in the startup log. Previous versions of JOE would prompt 2780the user for this case- the idea was that JOE may be unusable with an out of 2781date initialization file. 2782 2783### joerc file sections 2784 2785The __joerc__ file is broken up into a number of sections: 2786 2787* Global options 2788 Options which are not file specific, like __noxon__. 2789 2790* File name and content dependent options 2791 Options which depend on the file type, such as __autoindent__. The 2792 __ftyperc__ file is included in this section. 2793 2794* __^T__ menu system definition 2795 Use :defmenu to define a named menu of macros. The __menu__ command 2796brings up a specific named menu. __^T__ is a macro which brings up the root 2797menu: __menu,"root",rtn__. 2798 2799* Help screen contents 2800 Each help screen is named. The name is used to implement context 2801 dependent help. 2802 2803* Key bindings 2804 Key binding tables are defined. You can define as many as you like (you 2805can switch to a specific one with the __keymap__ command), but 2806the following must be provided: 2807 2808 * __main__ Editing windows 2809 * __prompt__ Prompt windows 2810 * __query__ Single-character query prompts 2811 * __querya__ Single-character query for quote 2812 * __querysr__ Single-character query for search and replace 2813 * __shell__ Shell windows 2814 * __vtshell__ Terminal emulator shell windows 2815 2816Key binding tables can inherit bindings from already defined tables. This 2817allows you to group common key bindings into a single table which is 2818inherited by the others. 2819 2820### Mode command 2821 2822Many options can be controlled with the __^T__ menu. This menu is defined 2823in the joerc file. Each option in the __^T__ menu just executes a macro. 2824Usually the macro is the mode command. You can execute the mode command 2825directly with: 2826 2827 Esc X mode <enter> 2828 2829Hit __Tab__ __Tab__ for a completion list of all options. 2830 2831### Menu command 2832 2833This command calls up a named menu of macros which was defined in the 2834__joerc__ file. 2835 2836 Esc X menu <enter> 2837 2838As usual, hit __Tab__ __Tab__ at the prompt for a completion list of the 2839menus which exist. 2840 2841__^T__ is bound to the simple macro __menu,"root",rtn__- it brings up the 2842root of the options menu system. 2843 2844## Xterm Mouse support 2845 2846There are two levels of mouse support. The -mouse option enables the 2847first level, which will work with any stock Xterm. If -joexterm is also 2848set, mouse support is enhanced, but you need a recent version of XTerm, 2849and it needs to be ./configured with the --enable-paste64 option. 2850 2851When -mouse is set, you can: 2852 2853* Left-click in a text window to set the cursor position. Left-click in a 2854 different window to move the cursor to a different window. 2855 2856* Select text with the mouse. Left-click and drag to select some text- it 2857will be as if you had used __^K B__ and __^K K__ to mark it. Left-click (but don't 2858drag) to position the cursor somewhere else. Middle click to copy the 2859selected text to the cursor- it will be as if you had hit __^K C__. If you drag 2860past the edge of the text window, the window will auto-scroll to select more 2861text. Unfortunately, Xterm does not send any codes when the cursor is 2862outside of the Xterm frame itself, so this only works if the mouse is still 2863contained within the Xterm frame. I've sent a patch to the Xterm maintainer 2864to improve this, but he has not taken it yet. 2865 2866* Resize windows with the mouse: click and hold on a status line 2867dividing two windows to move it. 2868 2869* Select menu entries (such as any completion menu or the __^T__ options 2870menu): click on the menu item to position the cursor on it. Double-click on 2871a menu item to select it (same as hitting return with cursor on it).</li> 2872 2873* If your mouse has a wheel, turning the wheel will scroll the window with 2874the cursor. 2875 2876Unfortunately, when -mouse is selected, cut and paste between X windows 2877does not work as it normally does in a shell window (left-click and drag to 2878select, middle click to paste). Instead, you have to hold the shift key 2879down to do this: shift-left-click and drag to select, and shift-middle click 2880to paste. Note that pasting text into JOE this way has problems: any \` 2881characters will get messed up because \` means quote the following control 2882character. Also if auto-indent is enabled, pasted text will not be indented 2883properly. 2884 2885__Note:__ these problems with pasting have been resolved in recent versions 2886of JOE. 2887 2888* JOE enables "bracketed paste" mode in Xterm so that pasted text is 2889bracketed with an escape sequence. This sequence causes JOE to disable 2890the autoindent, wordwrap and spaces modes for the paste, and restores them 2891when the paste is complete. 2892 2893* Even if the terminal emulator does not have this bracketed paste mode, 2894JOE detects pasted text by timing: If text arrives all at once (all in the 2895same buffer), the text is assumed to be pasted text and autoindent and 2896wordwrap are temporarily disabled. 2897 2898When -joexterm is set (and you have ./configured Xterm with 2899--enable-paste64): 2900 2901* Cut & paste are properly integrated with X. Text selected with 2902left-click-drag is available for pasting into other X windows (even if the 2903selected text is larger than the text window). Text selected in other X 2904windows can be pasted into JOE with middle-click. There are no problems 2905pasting text containing ` or with auto-indent. 2906 2907--enable-paste64 allows an application program to communicate Base-64 2908encoded selection data to and from the Xterm. The program has full control 2909over what is in the selection data and when it is received or sent. 2910 2911## Color Xterm support 2912 2913JOE can make use of monochrome Xterm, 8-color Xterm, 16-color Xterm, 291488-color Xterm and 256-color Xterm. The number of colors which Xterm 2915supports is determined by which "configure" script options are set before 2916the Xterm source code is compiled. The termcap or terminfo entry must 2917support how your Xterm is configured. On my Slackware Linux distribution, 2918you have to set the TERM environment variable to one of these: 2919 2920* xterm 2921* xterm-color 2922* xterm-16color 2923* xterm-88color 2924* xterm-256color 2925 2926If the termcap/terminfo entry is missing, you can add the "-assume_256color" 2927option to the joerc file. Note that this was broken for terminfo in 2928versions of JOE below 3.4. 2929 2930When it is working, the command: "joe -assume_256color -text_color bg_222" 2931should have a gray background. 2932 2933## Hex edit mode 2934 2935When this mode is selected (either put -hex on the command line, or look for 2936"Hex edit mode" after hitting __^T__), the buffer is displayed as a hex dump, 2937but all of the editing commands operate the same way. It is most useful to 2938select overtype mode in conjunction with hex dump (hit __^T T__). Then typing 2939will not insert. 2940 2941- To enter the hex byte 0xF8 type __^Q x F 8__ 2942 2943- You can use __^K C__ to copy a block as usual. If overtype mode is selected, 2944 the block will overwrite the destination data without changing the size of 2945 the file. Otherwise it inserts. 2946 2947- Hit __Esc X byte <Enter>__, to jump to a particular byte offset. Hex values 2948 can be entered into this prompt like this: 0x2000. 2949 2950- Search, incremental search, and search & replace all operate as usual. 2951 2952<a name="evariables"></a> 2953## Environment variables 2954 2955For JOE to operate correctly, a number of other environment settings must be 2956correct. The throughput (baud rate) of the connection between the computer 2957and your terminal must be set correctly for JOE to update the screen 2958smoothly and allow typeahead to defer the screen update. Use the __stty nnn__ 2959command to set this. You want to set it as close as possible to 2960actual throughput of the connection. For example, if you are connected via 2961a 1200 baud modem, you want to use this value for __stty__. If you are 2962connected via 14.4k modem, but the terminal server you are connected to 2963connects to the computer a 9600 baud, you want to set your speed as 9600 2964baud. The special baud rate of 38400 or __extb__ is used to indicate that 2965you have a very-high speed connection, such as a memory mapped console or an 2966X-window terminal emulator. If you can't use __stty__ to set the actual 2967throughput (perhaps because of a modem communicating with the computer at a 2968different rate than it's communicating over the phone line), you can put a 2969numeric value in the __BAUD__ environment variable instead (use __setenv 2970BAUD 9600__ for csh or __BAUD=9600; export BAUD__ for sh). 2971 2972The __TERM__ environment variable must be set to the type of terminal 2973you're using. If the size (number of lines/columns) of your terminal is 2974different from what is reported in the TERMCAP or TERMINFO entry, you can 2975set this with the __stty rows nn cols nn__ command, or by setting the 2976__LINES__ and __COLUMNS__ environment variables. The terminal size is 2977variable on modern systems and is determined by an ioctl, so these 2978parameters often have no effect. 2979 2980JOE normally expects that flow control between the computer and your 2981terminal to use __^S__/__^Q__ handshaking (i.e., if the computer is sending 2982characters too fast for your terminal, your terminal sends __^S__ to stop the 2983output and __^Q__ to restart it). If the flow control uses out-of-band or 2984hardware handshaking or if your terminal is fast enough to always keep up 2985with the computer output and you wish to map __^S__/__^Q__ to edit commands, you can 2986set the environment variable __NOXON__ to have JOE attempt to turn off 2987__^S__/__^Q__ handshaking. If the connection between the computer and your terminal 2988uses no handshaking and your terminal is not fast enough to keep up with the 2989output of the computer, you can set the environment variable __DOPADDING__ 2990to have __JOE__ slow down the output by interspersing PAD characters 2991between the terminal screen update sequences. 2992 2993Here is a complete list of the environment variables: 2994 2995* BAUD<br> 2996Tell JOE the baud rate of the terminal (overrides value reported by stty). 2997<br> 2998 2999* COLORTERM<br> 3000If set to `truecolor` or `24bit`, [24-bit color support](https://gist.github.com/XVilka/8346728) 3001will be assumed and JOE will be able to load those sections from color 3002schemes. 3003<br> 3004 3005* COLUMNS<br> 3006Set number of columns in terminal emulator (in case 3007termcap entry is wrong). This is only useful on old system which don't have 3008the "get window size" ioctl. 3009<br> 3010 3011* DOPADDING<br> 3012Enable JOE to send padding NULs to the terminal 3013when set (for very old terminals). 3014<br> 3015 3016* HOME<br> 3017Used to get path to home directory for ~ 3018expansion and also to find ~/.joerc file ~/.joe directory. 3019<br> 3020 3021* HOSTNAME<br> 3022Used to get hostname to put in EMACS compatible locks. 3023<br> 3024 3025* JOETERM<br> 3026Gives terminal type: JOE will use this instead of TERM if it's set. 3027<br> 3028 3029* LANG<br> 3030Sets locale (like en_US.utf-8). JOE uses 3031the first of these which is set: LC_ALL, LC_CTYPE, LANG. 3032<br> 3033 3034* LC_ALL<br> 3035Sets locale (like en_US.utf-8). JOE 3036uses the first of these which is set: LC_ALL, LC_CTYPE, LANG. 3037<br> 3038 3039* LC_CTYPE<br> 3040Sets locale (like en_US.utf-8). JOE 3041uses the first of these which is set: LC_ALL, LC_CTYPE, LANG. 3042<br> 3043 3044* LINES<br> 3045Set number of lines in terminal emulator (in case 3046termcap entry is wrong). This is only useful on old system which don't have 3047the "get window size" ioctl. 3048<br> 3049 3050* NOXON<br> 3051Disable __^S__ and __^Q__ flow control, possibly 3052allowing __^S__ and __^Q__ to be used as editor keys. 3053<br> 3054 3055* SHELL<br> 3056Path to shell (like /bin/sh). This is 3057used in several places: If you are on a system with no job control, this 3058shell is invoked when you hit __^K Z__. Also this is the shell which is run in shell 3059windows. If SHELL is not set (Cygwin) or if it's set to /bin/sh, JOE 3060invokes the first of these which exists: /bin/bash, /usr/bin/bash, /bin/sh. 3061<br> 3062 3063* SIMPLE_BACKUP_SUFFIX<br> 3064If this is set, it is 3065appended to the file name instead of ~ to create the backup file name. 3066<br> 3067 3068* TAGS<br> 3069If set to a path to a file, JOE tries to 3070use this as the "tags" file if there is no "tags" file in the current 3071directory. 3072<br> 3073 3074* TEMP<br> 3075If set, gives path to directory to open 3076swapfile instead of /tmp 3077<br> 3078 3079* TERMCAP<br> 3080Used by JOE's built-in termcap file 3081parser (not used for terminfo). A termcap entry can be placed directly in 3082this variable (which will be used if it matches TERM), or if it begins with 3083/, it gives a list of paths to termcap files to search. 3084<br> 3085 3086* TERMPATH<br> 3087Gives list of paths to termcap files to search when TERMCAP has a 3088termcap entry (otherwise it's ignored). The default list of paths to 3089termcap files (when TERMCAP and TERMPATH do not have it) is: "~/.termcap 3090/etc/joe/termcap /etc/termcap" 3091<br> 3092 3093* TERM<br> 3094Gives terminal type, like "vt100" or "xterm". 3095<br> 3096 3097* USER<br> 3098Used to get user name for EMACS compatible file locks. 3099<br> 3100 3101<a name="list"></a> 3102## JOE commands grouped by function 3103 3104These commands can be entered at the __Esc X__ prompt. 3105 3106### Background programs 3107 3108* bknd<br> 3109Run a shell in a window 3110<br> 3111 3112* vtbknd<br> 3113Run a shell in a terminal emulator window 3114<br> 3115 3116* killproc<br> 3117Kill program in current window 3118<br> 3119 3120* run<br> 3121Run a UNIX command in a window 3122<br> 3123 3124* sys<br> 3125Run a UNIX command and return to editor when done (I/O does not go through editor, but we get the command's return status). 3126 3127### Blocks 3128 3129* blkcpy<br> 3130Copy marked block to cursor 3131<br> 3132 3133* blkdel<br> 3134Delete marked block 3135<br> 3136 3137* blkmove<br> 3138Move marked block to cursor 3139<br> 3140 3141* blksave<br> 3142Save marked block into a file 3143<br> 3144 3145* copy<br> 3146Copy block to kill-ring 3147<br> 3148 3149* drop<br> 3150Set markb. If it was already set, eliminate Ait. 3151<br> 3152 3153* dropon<br> 3154Set markb. If it was already set, eliminate it. Turn on marking mode. 3155<br> 3156 3157* toggle_marking<br> 3158If we're in a block: clear markb and markk. If marking is off: set markb and turn on marking. If marking is on: set markk (swap if necessary with markb) and turn marking off. 3159<br> 3160 3161* begin_marking<br> 3162If we're on an edge of a block: set markb to other edge and turn on marking mode. Otherwise set markb to cursor and turn on marking mode. 3163<br> 3164 3165* select<br> 3166Set markb. If it was already set, do nothing. 3167<br> 3168 3169* filt<br> 3170Filter block or file through a UNIX command 3171<br> 3172 3173* markb<br> 3174Set beginning of block mark 3175<br> 3176 3177* markk<br> 3178Set end of block mark 3179<br> 3180 3181* markl<br> 3182Mark current line 3183<br> 3184 3185* nmark<br> 3186Eliminate markb and markk 3187<br> 3188 3189* picokill<br> 3190Delete line or block 3191<br> 3192 3193* pop<br> 3194Restore markb and markk values from stack 3195<br> 3196 3197* psh<br> 3198Push markb and markk values onto a stack 3199<br> 3200 3201* swap<br> 3202Switch cursor with markb 3203<br> 3204 3205* tomarkb<br> 3206Move cursor to markb 3207<br> 3208 3209* tomarkbk<br> 3210Move cursor to markb or markk 3211<br> 3212 3213* tomarkk<br> 3214Move cursor to markk 3215<br> 3216 3217* yank<br> 3218Insert top of kill ring 3219<br> 3220 3221* yankpop<br> 3222Scroll through kill ring 3223<br> 3224 3225* yapp<br> 3226Append next kill to top of kill ring 3227<br> 3228 3229* upper<br> 3230Convert everything in block to uppercase 3231<br> 3232 3233* lower<br> 3234Convert everything in block to lowercase 3235 3236 3237### Buffers 3238 3239* bufed<br> 3240Buffer menu 3241<br> 3242 3243* edit<br> 3244Load file into window: asks to reload if buffer exists 3245<br> 3246 3247* switch<br> 3248Load file into window: always uses buffer if it exists 3249<br> 3250 3251* scratch<br> 3252Push a scratch buffer into current window 3253<br> 3254 3255* popabort<br> 3256Abort and pop window from stack (do nothing if stack empty) 3257<br> 3258 3259* nbuf<br> 3260Load next buffer into current window 3261<br> 3262 3263* pbuf<br> 3264Load previous buffer into current window 3265<br> 3266 3267* reload<br> 3268Re-read file into buffer (revert) 3269<br> 3270 3271* reloadall<br> 3272Re-read all unmodified buffers 3273 3274 3275### Cursor Motion 3276 3277* bof<br> 3278Move cursor to beginning of file 3279<br> 3280 3281* bol<br> 3282Move cursor to beginning of line (always) 3283<br> 3284 3285* bop<br> 3286Move to beginning of a paragraph 3287<br> 3288 3289* bos<br> 3290Move to beginning of screen 3291<br> 3292 3293* bkwdc<br> 3294Search backwards for a character 3295<br> 3296 3297* byte<br> 3298Move cursor to specific byte offset into the file. 3299<br> 3300 3301* col<br> 3302Move cursor to specific column number. 3303<br> 3304 3305* dnarw<br> 3306Move cursor down one line 3307<br> 3308 3309* eof<br> 3310Move cursor to end of file 3311<br> 3312 3313* eol<br> 3314Move cursor to end of line 3315<br> 3316 3317* eop<br> 3318Move cursor to end of paragraph 3319<br> 3320 3321* fwrdc<br> 3322Search forward for matching character 3323<br> 3324 3325* gomark<br> 3326Move cursor to a bookmark 3327<br> 3328 3329* home<br> 3330Move cursor to beginning of line 3331<br> 3332 3333* line<br> 3334Move cursor to specified line 3335<br> 3336 3337* ltarw<br> 3338Move cursor left 3339<br> 3340 3341* nedge<br> 3342Move cursor to next edge 3343<br> 3344 3345* nextpos<br> 3346Move cursor to next position in cursor position history 3347<br> 3348 3349* nextword<br> 3350Move cursor to end of next word 3351<br> 3352 3353* pedge<br> 3354Move cursor to previous edge 3355<br> 3356 3357* prevpos<br> 3358Move cursor to previous position in cursor position history 3359<br> 3360 3361* prevword<br> 3362Move cursor to beginning of previous word 3363<br> 3364 3365* rtarw<br> 3366Move cursor right 3367<br> 3368 3369* setmark<br> 3370Set a bookmark 3371<br> 3372 3373* tomatch<br> 3374Move cursor to matching delimiter 3375<br> 3376 3377* tos<br> 3378Move cursor to top of screen 3379<br> 3380 3381* uparw<br> 3382Move cursor up 3383 3384### Deletion 3385 3386* backs<br> 3387Backspace 3388<br> 3389 3390* backw<br> 3391Backspace a word 3392<br> 3393 3394* delbol<br> 3395Delete to beginning of line 3396<br> 3397 3398* delch<br> 3399Delete character under cursor 3400<br> 3401 3402* deleol<br> 3403Delete to end of line 3404<br> 3405 3406* dellin<br> 3407Delete entire line 3408<br> 3409 3410* delw<br> 3411Delete word to right 3412 3413### Error parsing 3414 3415* nxterr<br> 3416Goto next parsed error 3417<br> 3418 3419* parserr<br> 3420Parse errors in current file 3421<br> 3422 3423* gparse<br> 3424Parse grep list in current file 3425<br> 3426 3427* jump<br> 3428Parse current line and jump to it 3429<br> 3430 3431* prverr<br> 3432Go to previous parsed error 3433<br> 3434 3435* showerr<br> 3436Show current message 3437<br> 3438 3439* grep<br> 3440Execute grep command, parse when done 3441<br> 3442 3443* build<br> 3444Execute build command, parse when done 3445<br> 3446 3447* release<br> 3448Release error/grep records 3449 3450### Exit 3451 3452* cancel<br> 3453Like abort, but doesn't return failure: useful in macros to escape out of a prompt. 3454<br> 3455 3456* abort<br> 3457Abort current buffer/window. Prompt if it is changed. 3458<br> 3459 3460* abortbuf<br> 3461Like above, but just fail if it would have to prompt because it's the last window on a modified buffer. 3462<br> 3463 3464* ask<br> 3465Prompt to save current file: user says yes return, user says no: run 'abort'. Use in a macro: "ask,query,exsave" 3466<br> 3467 3468* exsave<br> 3469Save file and exit 3470<br> 3471 3472* lose<br> 3473EMACS kill buffer. The buffer is deleted- any windows with it get a replacement scratch buffer. 3474<br> 3475 3476* querysave<br> 3477Prompt to save each modified buffer. Use in a macro: "querysave,query,killjoe" 3478<br> 3479 3480* killjoe<br> 3481Exit JOE immediately without checking for modified buffers 3482 3483### Files 3484 3485* cd<br> 3486Set directory prefix 3487<br> 3488 3489* save<br> 3490Save file 3491<br> 3492 3493* savenow<br> 3494Save immediately, unless file name is not known 3495<br> 3496 3497* insf<br> 3498Insert a file 3499 3500### Formatting 3501 3502* center<br> 3503Center line 3504<br> 3505 3506* fmtblk<br> 3507Format all paragraphs in a block 3508<br> 3509 3510* format<br> 3511Format current paragraph 3512<br> 3513 3514* lindent<br> 3515Indent to the left 3516<br> 3517 3518* rindent<br> 3519Indent to the right 3520 3521### Help 3522 3523* help<br> 3524Turn help on or off 3525<br> 3526 3527* hnext<br> 3528Switch to next help screen 3529<br> 3530 3531* hprev<br> 3532Switch to previous help screen 3533 3534### Inserting 3535 3536* ctrl<br> 3537Type next key 3538<br> 3539 3540* finish<br> 3541Complete word in text window 3542<br> 3543 3544* insc<br> 3545Insert a space 3546<br> 3547 3548* open<br> 3549Insert newline 3550<br> 3551 3552* quote<br> 3553Insert a control character 3554<br> 3555 3556* quote8<br> 3557Insert a meta character 3558<br> 3559 3560* rtn<br> 3561__Return__ / __Enter__ key 3562<br> 3563 3564* type<br> 3565Insert typed character 3566<br> 3567 3568* secure_type<br> 3569Insert typed character, but only allowed in prompt windows (not allowed in shell windows) 3570 3571### Macros 3572 3573* macros<br> 3574Insert keyboard macros into current file 3575<br> 3576 3577* play<br> 3578Execute a macro 3579<br> 3580 3581* query<br> 3582Suspend macro recording for user query 3583<br> 3584 3585* record<br> 3586Record a macro 3587<br> 3588 3589* stop<br> 3590Stop recording macro 3591 3592### Menu 3593 3594* backsmenu<br> 3595Undo in file completion menu 3596<br> 3597 3598* bofmenu<br> 3599Move to beginning of menu 3600<br> 3601 3602* bolmenu<br> 3603Move to beginning of line in a menu 3604<br> 3605 3606* dnarwmenu<br> 3607Move down one line in a menu 3608<br> 3609 3610* eolmenu<br> 3611Move cursor to end of line in a menu 3612<br> 3613 3614* eofmenu<br> 3615Move cursor to end of menu 3616<br> 3617 3618* ltarwmenu<br> 3619Move cursor left in a menu 3620<br> 3621 3622* rtarwmenu<br> 3623Move cursor right in menu 3624<br> 3625 3626* uparwmenu<br> 3627Move cursor up in menu 3628<br> 3629 3630* dnslidemenu<br> 3631Scroll menu down one line 3632<br> 3633 3634* upslidemenu<br> 3635Scroll menu up one line 3636<br> 3637 3638* pgupmenu<br> 3639Scroll menu up 3640<br> 3641 3642* pgdnmenu<br> 3643Scroll menu down 3644<br> 3645 3646* tabmenu<br> 3647Tab through menu 3648 3649### Misc 3650 3651* beep<br> 3652Beep 3653<br> 3654 3655* execmd<br> 3656Execute a JOE command 3657<br> 3658 3659* debug_joe<br> 3660Insert debug information into buffer 3661<br> 3662 3663* math<br> 3664Calculator 3665<br> 3666 3667* maths<br> 3668Secure Calculator (no way to run joe() macros) 3669<br> 3670 3671* mode<br> 3672Mode prompt 3673<br> 3674 3675* menu<br> 3676Menu prompt 3677<br> 3678 3679* msg<br> 3680Display a message 3681<br> 3682 3683* notmod<br> 3684Clear the modified flag 3685<br> 3686 3687* retype<br> 3688Refresh screen 3689<br> 3690 3691* shell<br> 3692Suspend process or execute a sub-shell 3693<br> 3694 3695* stat<br> 3696Display cursor position 3697<br> 3698 3699* tag<br> 3700Tags file search 3701<br> 3702 3703* tagjump<br> 3704Jump to next tags file search match (only if notagsmenu is set) 3705<br> 3706 3707* timer<br> 3708Execute a macro periodically 3709<br> 3710 3711* txt<br> 3712Insert text. If first character is \`, then text is assumed to be a format string (that is, the string used to define the status line for the rmsg and lmsg options) and is formatted before the insertion. 3713<br> 3714 3715* name<br> 3716Insert current file name 3717<br> 3718 3719* language<br> 3720Insert current language 3721<br> 3722 3723* charset<br> 3724Insert current character set 3725<br> 3726 3727* keymap<br> 3728Switch to another keymap 3729 3730### Prompts 3731 3732* complete<br> 3733Complete a file-name in a prompt 3734<br> 3735 3736* if<br> 3737Only run following cmds if expr is true (non-zero) 3738<br> 3739 3740* then<br> 3741Same as rtn but only works in prompt windows 3742<br> 3743 3744* elsif<br> 3745Try a new condition 3746<br> 3747 3748* else<br> 3749Toggle truth flag 3750<br> 3751 3752* endif<br> 3753Start running cmds again 3754<br> 3755 3756<p>Here is an example 'if' macro:</p> 3757 3758<p>if,"char==65",then,"it's an A",else,"it's not an A",endif __^[ q__</p> 3759 3760<p>When you hit __^[ q__, if the character under the cursor is an 'A': "it's a A" 3761is inserted into the buffer, otherwise "it's not an A" is inserted.</p> 3762 3763<p>"if" creates a math prompt (like __Esc M__). "then" is like "rtn"- it hits the 3764return key for this prompt.</p> 3765 3766<p>Within the math prompt, the following variables are available:</p> 3767 3768* char<br> 3769ASCII value of character under cursor 3770<br> 3771 3772* width<br> 3773Width of screen 3774<br> 3775 3776* height<br> 3777Height of screen 3778<br> 3779 3780* byte<br> 3781byte number 3782<br> 3783 3784* col<br> 3785column number 3786<br> 3787 3788* line<br> 3789line number 3790<br> 3791 3792* lines<br> 3793no. lines in file 3794<br> 3795 3796* top<br> 3797line number of top line of window 3798 3799### Repeat 3800 3801* arg<br> 3802Prompt for repeat argument 3803<br> 3804 3805* uarg<br> 3806Universal argument 3807 3808### Scrolling 3809 3810* crawll<br> 3811Pan screen left 3812<br> 3813 3814* crawlr<br> 3815Pan screen right 3816<br> 3817 3818* dnslide<br> 3819Scroll screen down 1 line 3820<br> 3821 3822* pgdn<br> 3823Scroll screen down 3824<br> 3825 3826* pgup<br> 3827Scroll screen up 3828<br> 3829 3830* upslide<br> 3831Scroll up one line 3832 3833### Search and replace 3834 3835* ffirst<br> 3836Find text 3837<br> 3838 3839* fnext<br> 3840Repeat previous search 3841<br> 3842 3843* isrch<br> 3844Incremental search forward 3845<br> 3846 3847* qrepl<br> 3848Search and replace 3849<br> 3850 3851* rfirst<br> 3852Search backwards for text 3853<br> 3854 3855* rsrch<br> 3856Reverse incremental search 3857 3858### Windows 3859 3860* explode<br> 3861Display one window or display all windows 3862<br> 3863 3864* dupw<br> 3865Duplicate current window 3866<br> 3867 3868* groww<br> 3869Increase size of window 3870<br> 3871 3872* nextw<br> 3873Move cursor to next window 3874<br> 3875 3876* prevw<br> 3877Go to previous window 3878<br> 3879 3880* shrinkw<br> 3881Shrink window 3882<br> 3883 3884* splitw<br> 3885Split window into two 3886<br> 3887 3888* tw0<br> 3889Eliminate this window 3890<br> 3891 3892* tw1<br> 3893Show only one window 3894<br> 3895 3896* mwind<br> 3897Get error messages window on the screen and put cursor in it. 3898<br> 3899 3900* showlog<br> 3901Get startup log scratch buffer into window. 3902<br> 3903 3904* mfit<br> 3905Fit two windows on the screen: make current window 6 lines, and give rest of space to window above. The window above is either the existing previous window, a newly created one if there wasn't one. 3906 3907### Undo 3908 3909* redo<br> 3910Re-execute the latest undone change 3911<br> 3912 3913* undo<br> 3914Undo last change 3915 3916### Mouse 3917 3918* tomouse<br> 3919Move the cursor to where the mouse was clicked/dragged 3920<br> 3921 3922* defmdown<br> 3923Default single-click handler, usually bound to MDOWN. Positions cursor to 3924mouse and begins a region. 3925<br> 3926 3927* defmup<br> 3928Default single-click release handler, usually bound to MUP. Completes 3929selection of a region. 3930<br> 3931 3932* defmdrag<br> 3933Default single-click drag handler, usually bound to MDRAG. Selects a region 3934of text a character at a time. 3935<br> 3936 3937* defm2down<br> 3938Default double-click handler, usually bound to M2DOWN. 3939<br> 3940 3941* defm2up<br> 3942Default double-click release handler, usually bound to M2UP. 3943<br> 3944 3945* defm2drag<br> 3946Default double-click drag handler, usually bound to M2DRAG. Selects a 3947region of text a word at a time. 3948<br> 3949 3950* defm3down<br> 3951Default triple-click handler, usually bound to M3DOWN. 3952<br> 3953 3954* defm3up<br> 3955Default triple-click release handler, usually bound to M3UP. 3956<br> 3957 3958* defm3drag<br> 3959Default triple-click drag handler, usually bound to M3DRAG. Selects a 3960region of text a line at a time. 3961<br> 3962 3963* defmiddledown<br> 3964Default middle click handler, usually bound to MIDDLEDOWN. This inserts 3965text. 3966<br> 3967 3968* defmiddleup<br> 3969Default middle button release handler, usually bound to MIDDLEUP. 3970<br> 3971 3972* xtmouse<br> 3973Handle xterm mouse events, usually bound to Esc \[ M. It parses the rest of 3974the sequence and generates fake "keys" that can be bound to macros in the 3975joerc file. It uses a timer to detect double-click and triple-click. The 3976keys are: MUP, MDOWN, MDRAG, M2UP, M2DOWN, M2DRAG, M3UP, M3DOWN, M3DRAG, 3977MWUP and MWDOWN. 3978<br> 3979 3980* extmouse<br> 3981Handle extended xterm mouse events, usually bound to Esc \[ \<. 3982<br> 3983 3984* paste<br> 3985Insert base64 encoded text (for XTerm --enable-base64 option). 3986<br> 3987 3988* brpaste<br> 3989Disable autoindent, wordwrap and spaces. The idea is to bind this to __Esc [ 2 0 0 ~__ so that when the terminal emulator sends a mouse paste, the text is inserted as-is. 3990<br> 3991 3992* brpaste_done<br> 3993Restore autoindent, wordwrap and spaces modes to their original values before brpaste. The idea is to bind this to __Esc [ 2 0 1 ~__ so that these modes are restored after a mouse paste. 3994<br> 3995