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.

The editor supports binary editing in an unusual text-ish format. This is primarily meant to edit text files making changes that are very difficult to do in text mode. Switching between binary and text mode in the same file is easily done. Note that any file can be edited in binary mode, not just text files.

Documentation from ed -h

Editor  V6.86  (c) 2001-2022  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 

                      CTRL-KEY SUMMARY

    ctrl-a  add a line under current line, same as F6
    ctrl-b  go to the bottom of file, same as ctrl-end
    ctrl-c  copy lines thru marked line      from ctrl-k same as F7
    ctrl-d  delete lines thru marked line    from ctrl-k same as F5
    ctrl-e  erase from cursor to the end of the line
    ctrl-f  go to the next file, same as F11
    ctrl-g  go to the next word, same as ctrl-right arrow
 *  ctrl-h  ascii backspace char    F1 = help
 *  ctrl-i  ascii tab char          F9 rl = reload file
    ctrl-j  join the cursor line with the succeeding line
               a CR in insert-mode will split a line at the cursor
    ctrl-k  mark first or last line of a block for copy or delete
               cursor line is other mark: use with ctrl-c, ctrl-d, F9-i,s,w 
    ctrl-l  enter draw-lines mode
 *  ctrl-m  ascii carridge return char
    ctrl-n  note mode toggle: go to end of file, next ctrl-n returns to line
    ctrl-o  go to the beginning of the line, same as Home
    ctrl-p  put the line copy buffer after the current line, same as F8
    ctrl-q  quit the editor without writing the file
    ctrl-r  redraw the screen
    ctrl-s  enter set up mode
    ctrl-t  go to the top of the file, same as ctrl-home
    ctrl-u  undo the changes to the current line, not recursive
    ctrl-v  put the string buffer after current character, same as F4
    ctrl-w  write the current file without exiting the editor
    ctrl-x  toggle hex input mode character input
    ctrl-y  enter an operating system command shell ( 'exit' to return )
    ctrl-z  go to the end of the line, same as End

    ctrl-BS go to the previous word, same as ctrl-left arrow
    ctrl-Del delete the current space delimited word, same as F3


                    SETUP MODE FEATURES

    ctrl-s:  enter setup mode
    cmds:  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

    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


                    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                also Esc = F9 from edit 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 number of lines 
    copy lines      c number of lines 
    delete lines    d number of lines 
    go forward      f number of lines 
    go to line      g line number 
    help            h
    indent line     i number of spaces       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    rl            reload current file or another file 
    read in file    rt            toggle text/binary edit mode for one file
    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/ number of lines     from cursor for lines
    detab file      t  [tabsize]  default tabsize = 8 
    entab file      te [tabsize]  e option means entab the file 
    write file      wk            bakup current file as .bak, then write it
    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  number of lines     from cursor line for lines
    delete chars    x number of characters 
    system command  y: operating system command

    alt-i:  was initialize for editing a new file - now F9 rl
    alt-k:  was back up the current file as .bak  - now F9 wk

  ---------------------------------------------------------------------------
                       Binary mode editor keys 
  ---------------------------------------------------------------------------

       Function Keys           Alt-Key or ctrl-key      F9 Commands   
  ---------------------------------------------------------------------------

    F1  = Help                 Help              
    F2  = Write file & quit    Copy characters   
                               Delete characters 
                               Initialize        
                                                     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 ctrl-q 

    Toggle hex mode = ctrl-x 
    Hex entry mode: 
        enter 2 hex digits like 2a to make the cursor character be * 

    Text mode backslash entry chars like in C: \ \n \r \t \0 

   Download


Home

Copyright © 2001-2021 SLK Systems