[comp.emacs] Wordstar-like editor for Unix

litauer@infko.UUCP (Christoph Litauer) (09/18/90)

Hello, 
I would like to use a Wordstar-like editor on a Unix-System, because I 
worked much with Turbo-Pasacal and Turbo-C on my PC. So, is there anyone, who
ever made a wordstar-configuration for the Emacs-editor, or who is able to
simulate this kind of editor by using vi ???

Greetings, Christoph


Chrsitoph Litauer                                  litauer@infko.UUCP      
Uni Koblenz,                                       (..!unido!infko!litauer)
Inst. f. Informatik                             
Rheinau 3-4, D-5400 Koblenz, Germany            

shri@ncst.ernet.in (H.Shrikumar) (09/25/90)

In article <1299@infko.UUCP> litauer@infko.UUCP (Christoph Litauer) writes:
>ever made a wordstar-configuration for the Emacs-editor, or who is able to
>simulate this kind of editor by using vi ???

   I have absolutely no idea why I did it :-), but a while ago
I did make a "ws" emulator all within vi! 

   This is for cshell users, bourne and korn shell users need to make
some mods. Such as a ws.sh file instead of ws.alias ...


   shar follows below ...

-- shrikumar ( shri@ncst.in )

--------:<--------
#!/bin/sh
# "ws" emulation for vi.
# A (very inadequate) old-CP/M-WS emulator for vi/UNIX.
# Comments welcome, bug fixes welcome, but bug reports to /dev/null
# flames to /dev/null
# use at own risk. Enjoy!
echo Extracting ws.alias ... | tr -d '\012'
sed 's/^X//' << 'xxEOFxx' > ws.alias
Xalias ws 'vi "+source ~shri/src/sh/wsovly.ovl" ~shri/src/sh/wsmsgs.ovr'
xxEOFxx
echo done.
echo Extracting ws.exrc ... | tr -d '\012'
sed 's/^X//' << 'xxEOFxx' > ws.exrc
Xset notimeout autoindent report=1 nomagic ignorecase nomesg redraw 
Xset remap noterse nowrapscan warn errorbells
Xmap g 1G
Xmap! ^? ^[xi
X" <<< OPENING MENU >>>=======================================================
Xmap L :L - not implemented^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Xmap F :F - not implemented^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Xmap H :H - not implemented^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Xmap D :set wm=15 beautify^M:e! <filename>^H^H^H^H^H^H^H^H^H^H
Xmap N :set showmatch lisp^M:e! <filename>^H^H^H^H^H^H^H^H^H^H
Xmap P :!lpr <filename>^H^H^H^H^H^H^H^H^H^H
Xmap E :!mv -i <oldname> <newname>^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Xmap O :!cp -i <oldname> <newname>^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Xmap Y :!rm -i <filename>^H^H^H^H^H^H^H^H^H^H
Xmap R :! <command>^H^H^H^H^H^H^H^H^H
Xmap X :q!^M
Xmap S :!spell <filename>^H^H^H^H^H^H^H^H^H^H
Xmap M :M - not implemented^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
X" Based on "WORDSTAR IN ACTION", Randall McMullan, NCST lib 2056
X" Cursor moves leave in insert mode =======================================
X" Any session must begin with a down cursor movement for sanity .... :-)
Xmap ^[OD ha
Xmap ^[OB ja
Xmap ^[OA ka
Xmap ^[OC la
X" Cursor moves while in insert mode=========================================
Xmap! ^[OD ^[ha
Xmap! ^[OB ^[j^Ga
Xmap! ^[OA ^[k^Ga
Xmap! ^[OC ^[la
Xmap! ^R ^[^L^Ga
X" QUIT, SAVE, DONE and EXIT from file edit =================================
Xmap! ^Kq ^[:rew!^M:source ~shri/src/sh/wsovly.ovl^M
Xmap! ^Ks ^[:!mv % `basename % '\..*'`.bak^M:w^Ma
Xmap! ^Kd ^[:!mv % `basename % '\..*'`.bak^M:w^M^[:rew!^M:source ~shri/src/sh/wsovly.ovl^M
Xmap! ^Kx ^[:!mv % `basename % '\..*'`.bak^M:wq^M
Xmap! ^Kr ^[:r <filename>^H^H^H^H^H^H^H^H^H^H 
Xmap! ^Kp ^[:!lpr %^Ma
X" Chapter: Changing Layout =================================================
Xmap! ^B ^[!}fmt^M}^Ga
Xmap! ^Qq^B ^[:!Gfmt^M^Ga
X" Centre text line =========================================================
Xmap! ^Oc ^[ko.ce^V^[!jnroff^M^Ga
X" Insert mode toggle ... implementing a toggle involves messy remaps. Avoid.
X"map! ^V^V ^[:^V - not implemented^U^Ha
Xmap! ^U ^[U^Ga
Xmap! ^Y ^[dd^Ga
Xmap! ^T ^[dw^Ga
X" Chapter: Block Moves =====================================================
Xmap! ^Kb ^[:mark b^M^Ga
Xmap! ^Kk ^[:mark k^M^Ga
Xmap! ^Kv ^[:'b,'kmove .^M^Ga
Xmap! ^Kc ^[:'b,'kcopy .^M^Ga
Xmap! ^Ky ^[:'b,'kdelete^M^Ga
X" Movement commands .... ===================================================
Xmap! ^Qc ^[G^Ga
Xmap! ^Qr ^[1G^Ga
Xmap! ^E ^[k^Ga
Xmap! ^X ^[j^Ga
X" You must start up vi with stty old to be able to use this.
Xmap! ^Z ^[^F^Ga
Xmap! ^W ^[^B^Ga
X" Idiosyncrazies of vi .. just can't escape ^D. behaves like a line terminator.
X"map! ^V^D ^[la
X" Little use ... ^S is often trapped by terminal emulators. as is ^Q ..hurts ws.
Xmap! ^S ^[ha
Xmap! ^A ^[ba
Xmap! ^F ^[wa
X" Find and Find+replace  ===================================================
Xmap! ^Qf ^[/<find_pattern>^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Xmap! ^Qa ^[:1,$s/<find_pattern>/<replace_by>/gc^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Xmap! ^L ^[/^M^Ga
X" Chapter: Quick Tricks ====================================================
Xmap! ^Kf ^[:!ls -sglC^M
Xmap! ^Kj ^[:!rm -i <filename>^H^H^H^H^H^H^H^H^H^H 
X" Chapter: Styles and Habits ===============================================
Xmap! ^Qe ^[H^Ga
Xmap! ^Qs ^[^^Ga
Xmap! ^Qd ^[$^Ga
Xmap! ^Qy ^[d$^Ga
xxEOFxx
echo done.
echo 'The above file has been piped thru cat -v for transmission.'
echo 'Replace any occurance of Caret-X by the control character.'
echo Extracting wsmsgs.ovr | tr -d '\012'
sed 's/^X//' << 'xxEOFxx' > wsmsgs.ovr
X           not editing
X                 < < <  O P E N I N G    M E N U  > > >
X   ----Preliminary Commands-----  | --File Commands-- | -- System Commands--
X L  Change logged directory       |                   |   R  Run a Program
X F  File Directory (always ON)    |  P PRINT a file   |   X  Exit to system
X H  Set Help Level (always max)   |                   |
X   ----Commands to open a file--- |  E RENAME a file  | --WordStar Options---
X    D Open a document file        |  O COPY a file    |   M  Run Mailmerge
X    N Open a non-document file    |  Y DELETE a file  |   S  Run Spellstar
X 
X [ DONT hit any cursor key in menu screen. (antidote: hit ESCAPE)          ]
X [ For SANITY during File Edit - hit CURSOR KEYS often.                    ]
X [ This crime committed by (c)shri@ncst.in H.Shrikumar on Tue Aug 21 12:33 ]
X 
X Currently Logged directory:
X   Finding out, just a sec ......
xxEOFxx
echo done.
cat << xxEOFxx > READ.ME
1. Put the contents of ws.alias in your .cshrc file.
2. mv ws.exrc YourWSDirectory/.exrc
3. Patch .exrc using an editor to replace all Caret-X by control-X,
   and also set the path for wsmsgs.ovr file according to your convention.
   (Chicken and egg problem here, eh ? :-)
4. put wsmsgs.ovr in some suitable directory. Edit .exrc to reflect this.
5. Enjoy! (If at all possible with ws :-)

-- shrikumar ( shri@ncst.in )
No bug reports, no suggestions, no support.
Extensions, bug-fixes comments welcome.
xxEOFxx
echo Extracting ws.sh | tr -d '\012'
sed 's/^X//' << 'xxEOFxx' > ws.sh
X#!/bin/csh
X
Xalias ws 'vi "+source ~shri/src/sh/wsovly.ovl" ~shri/src/sh/wsmsgs.ovr'
Xexec ws !*
xxEOFxx
echo done.
echo 'Enjoy!'
exit 0


----:<------