Console Text Editor

History of this editor

This editor was originally written in the 1980s on an IBM PC as a replacement for the unix vi editor. The presentation and commands are similar but many of the terminal oriented characteristics of vi were not needed because of the memory mapped video of the PC. For example, moving around the file using the arrow keys will automatically pad with spaces up to the cursor on a line.

The editor was first ported from DOS to OS/2, then windows, then linux. The current version should work on any unix variant, more or less. The memory model progressed up to 32 bit where it is now. The code is not 32 bit specific, so it compiles and works on 64 bit as well. The watcom compiler works well for all except unix where gcc can be used.

Documentation from ed -h

Editor  V6.76  (c) 2001-2021  DMR 
Usage:  ed  [-options]  filenames 

  -b   edit a binary file 
  -f F9_passthru_cmd  - do F9 passthru cmd
  -h   help
  -l line number to begin editing
  -m maximum line length
  -s   split long lines 

                    FUNCTION KEY SUMMARY

    F1: help 
    F2: write the current file and exit the editor
    F3: delete the space delimited word at the cursor
    F4: put back the deleted string from F3, alt-E, or F9 X-DEL 
    F5: delete the current line
    F6: add a blank line after the cursor line
    F7: copy the current line
    F8: put the current lines copy/delete buffer after the cursor line
    F9: enter command mode
    F10: repeat the last F9 command
    F11: (shift F1) edit next file
    F12: (shift F2) edit previous file

                    F9 COMMAND LINE SUMMARY

    go back lines   b 
    copy lines      c 
    delete lines    d 
    go forward lines   f 
    go to line      g 
    indent line     i       starts at left column 
                    i <-number of spaces>     unindent = delete spaces 
                    i                   marked block = cursor to mark 
    look for        l/pattern/   look down file, 'L' looks up file 
                    L pattern    use any character as a delimiter 
    marginate       m[right margin]
                    single spaced text paragraph ending with a blank line
                    left margin = 9, default right margin = 72 
    open new file   o filename    edit an additional file, wildcards ok 
    quit all files  qq            quits if files are not changed 
    read in file    r filename    read in a file after the cursor line 
    Substitute      S/script_file_name  do s commands from a list in a file
    substitute      s/old/new/    substitute a string without wildcards 
    substitute      s/old/new/    if a block is marked then cursor to mark 
    substitute      s/old/new/a   substitute all occurences in all lines 
    substitute      s/old/new/e   substitute all occurences cursor to EOF 
    substitute      s/old/new/    from cursor for lines
    detab file      t  [tabsize]  default tabsize = 8 
    entab file      te [tabsize]  e option means entab the file 
    write file      w filename 
    write file      w filename    if a block is marked then cursor to mark 
    write file      w filename e  from cursor line to EOF 
    write file      w filename     from cursor line for lines
    delete chars    x 
    system command  y: operating system command

                    ALT-KEY or ESC KEY SUMMARY

    alt-a:  add a line under current line
    alt-b:  go to the bottom of file
    alt-c:  copy lines thru marked line      from alt-m 
    alt-d:  delete lines thru marked line    from alt-m 
    alt-e:  erase from cursor to the end of the line
    alt-f:  go to previous file, same as F11
    alt-g:  put string buffer after current character, same as F4
    alt-h:  help, same as F1
    alt-i:  initialize for editing a new file
    alt-j:  join the cursor line with the succeeding line
               a CR in insert-mode will split a line at the cursor
    alt-k:  back up the current file as .bak and write the new file
    alt-l:  enter draw-lines mode
    alt-m:  mark first or last line of a block for copy or delete
               cursor line is other mark: use with alt-c, alt-d, F9-i,s,w 
    alt-n:  note mode toggle: go to end of file, next alt-n returns to line
    alt-o:  switch to command mode, same as F9
    alt-=:  (alt equals) repeat previous F9 command, same as F10
    alt-p:  put the line copy buffer after the current line, same as F8
    alt-q:  quit the editor without writing the file
    alt-r:  redraw the screen
    alt-s:  enter set up mode
    alt-t:  go to the top of file
    alt-u:  undo the changes to the current line, not recursive
    alt-v:  go to the previous word
    alt-w:  write the current file without exiting the editor
    alt-x:  go to the next word
    alt-y:  enter an operating system command shell ( 'exit' to return )
    alt-z:  delete the current space delimited word, same as F3

    Note: Most newer compilers do not support alt-key codes. 
          Hit esc key and release then letter key sequence always works. 

                    SETUP MODE FEATURES

    alt-s:  enter setup mode
            toggle the autoindent feature
            change the display color
            change the message color
            set tabsize desired from 1 to 40 
            toggle automatic entab lines for current tab size 
            if entab lines is off then spaces are saved instead of tab chars 

                    SPECIAL KEYS

    Tab:        tab forward
    Backtab:    tab back
    Home:       go to beginning of the line
    End:        go to the end of the current line
    PgUp:       display previous page
    PgDn:       display next page
    Ins:        toggle character insert mode
    Del:        delete cursor character
    Backspace:  backspace the cursor, deleting the previous character
    Arrows:     cursor movement

                    ACTIVE CONTROL KEYS

    ctrl-home:          go to top of file
    ctrl-end:           go to end of file
    ctrl-left arrow:    go to previous word
    ctrl-right arrow:   go to next word

    ctrl-i  tab forward
    ctrl-h  backspace the cursor, deleting the previous character
    ctrl-m  carrige return

    Home = ctrl-o    End = ctrl-e    PgUp = ctrl-u    PgDn = ctrl-d or f 
    Ins  = ctrl-g    Del = ctrl-x 
    right word  = ctrl-r             left word   = ctrl-l 
    top of file = ctrl-t             bottom of file = ctrl-b 
    F3    Delete word         = ctrl-w 
    F4    Put string buffer   = ctrl-v 
    F9    Command mode        = ctrl-k 
    F10   Repeat command      = ctrl-s 
    F11   Next file           = ctrl-n 
    F12   Previous file       = ctrl-p 
          Toggle hex mode     = ctrl-z 

                       Binary mode editor keys 

       Function Keys           Alt-Key or esc key      F9 Commands   

    F1  = Help                 Help              
    F2  = Write file & quit    Copy characters   
                               Delete characters 
                                                     Look for string  
                               Refresh screen    
                               Mark character    
    F8  = Put copy buffer      Put copy buffer   
    F9  = Command mode         Quit file             QQuit all files   
    F10 = Repeat command                             Open file  
    F11 = Next file                              
    F12 = Previous file                              Substitute  
                               Write file            Write file   
                               Y (shell escape)      Y:system call   

    Use the first letter:  quit = alt-q or esc q 

    Hex entry mode:  enter 2 hex digits like 0b to make the cursor  
    character be the decimal number 11. 



Copyright © 2001-2021 SLK Systems