![]() |
||||||||||||
|
WordStar
Commands
|
Emulating WordStar for DOS Commands in NEditMethod for emulating WordStar commands in the Unix editor NEdit. First posted to the Nedit discussion list on Thu Nov 02 2000 by James W. Haefner. "If you can't say it with WordStar, say it with "ed".
Below is a lengthy addition to .Xdefaults that will emulate most of the WordStar keystrokes. Since this uses multiple control (or alt, etc) characters, emac, etc., users might also find it of use. It is rather long... First a few issues and things I learned. 0. Because of its length, I store this addition in a file called: .nedit.Xdefaults in my home directory. Then include it in the .Xdefaults file with: # include /myhome/.nedit.Xdefaults. Notice the white space and lowercase for "include". The # is required. 1. The keystroke translations cannot conflict with menu accelerators. Since I am a "Ctrl" freak (after correcting the ridiculous position of the CapsLock key on PC keyboards), I basically changed all the accelerator defaults from Ctrl to Alt. 2. Multiple keystrokes do work in nedit, as the docs briefly suggest. However, the second (or third, fourth, etc) character in the sequence must be a modified character. i.e., If you write: "Ctrl<Key>k,<Key>d: ", then this will work, but you will not be able to insert the plain letter 'd' into your document. So you must say "Ctrl<Key>k,Ctrl<Key>d: ". (Of course you can use all of the modifiers: Alt, Shift). Also, if the complete (2 keystroke) sequence does not have a definition, but the second of the 2 characters is defined as a single keystroke action, then when you mistakenly type the 2 letter sequence, the single keystroke action will be executed. (e.g., if ^K^D was not defined but ^D means move right, then typing ^K^D will move the cursor right, as if you had typed ^D alone.) (I *think*; this has happened, but needs to be examined.) 3. Multiple actions also work: just string them together on the same line as in Ctrl<Key>e: mark(x)process_up() \n\ This is a method for writing "mini-macros". See .nedit.Xdefaults below. I use this extensively to prepend a long move (eg, page_up) with a mark(x). Then I can use the wordstar ^Q^P to return to the point of departure if necessary using: Ctrl<Key>q,Ctrl<Key>p: goto_mark(x) \n\ 4. To implement the keyboard definition of selected blocks of text (^K^B/^K^K:
not available as a standard nedit command), I wrote a macro 5. A very important WordStar command is scroll_up and scroll_down, which keeps the cursor in a fixed position (text line and column), but moves the screen up and down. When the cursor would be scrolled out of the viewable window, the cursor sticks on the top or bottom line of the current window. After much search of the docs, I could find no way to do this in nedit (scroll_down(1) loses the cursor when it goes out of the window). My imperfect solution was to follow the scroll command with a grab_focus() command to tie the cursor to the mouse position, which is always in the window. DEVELOPERS: To fix this, we desperately need a method of jumping to the top and bottom of the current pane of the current window. 6. the BEEP macro just beeps when I type an undefined keystroke sequence.
Hope this is of some interest.
!!++++Begin .nedit.Xdefaults +++++++++++++
!!nedit WordStar-like keyboard emulation
nedit*geometry: +30+10
nedit*background: AntiqueWhite3
nedit*text.background: ivory
nedit*text.selectForeground: black
nedit*text.selectBackground: grey
nedit*text.highlightForeground: black
nedit*text.highlightBackground: blue
nedit*text.cursorForeground: red
nedit*text.heavyCursor: True
!!nedit*statsLine.background: blue
nedit*statsLine.foreground: red
! file menu
nedit*fileMenu.new.accelerator: Alt<Key>n
nedit*fileMenu.new.acceleratorText: Alt+n
nedit*fileMenu.open.accelerator: Alt<Key>o
nedit*fileMenu.open.acceleratorText: Alt+O
nedit*fileMenu.openSelected.accelerator:
nedit*fileMenu.openSelected.acceleratorText: !^Y
nedit*fileMenu.close.accelerator: <Key>F12
nedit*fileMenu.close.acceleratorText: F12
nedit*fileMenu.exit.accelerator: Alt<Key>q
nedit*fileMenu.exit.acceleratorText: Alt+Q
!nedit*fileMenu.save.accelerator: Shift Alt<Key>s
nedit*fileMenu.save.accelerator: <Key>F2
nedit*fileMenu.save.acceleratorText: F2
nedit*fileMenu.saveAs.accelerator: Alt<Key>a
nedit*fileMenu.saveAs.acceleratorText: Alt+a
nedit*fileMenu.print.accelerator: Shift Alt<Key>p
nedit*fileMenu.print.acceleratorText: Shift+Alt+p
! edit menu
nedit*editMenu.undo.accelerator: Ctrl<Key>/
nedit*editMenu.undo.acceleratorText: Ctrl+/
nedit*editMenu.fillParagraph.accelerator: Ctrl<Key>.
nedit*editMenu.fillParagraph.acceleratorText: Ctrl+.
nedit*editMenu.cut.accelerator: Alt<Key>x
nedit*editMenu.cut.acceleratorText: Alt+X
nedit*editMenu.copy.accelerator: Alt<Key>c
nedit*editMenu.copy.acceleratorText: Alt+C
nedit*editMenu.paste.accelerator: Alt<Key>v
nedit*editMenu.paste.acceleratorText: Alt+V
nedit*editMenu.pasteColumn.accelerator: Shift Alt<Key>v
nedit*editMenu.pasteColumn.acceleratorText: Shift Alt+V
nedit*editMenu.selectAll.accelerator:
nedit*editMenu.selectAll.acceleratorText: ^K^A
nedit*editMenu.shiftLeft.accelerator: Alt<Key>9
nedit*editMenu.shiftLeft.acceleratorText: [Shift]Alt+9
nedit*editMenu.shiftLeftShift.accelerator: Shift Alt<Key>9
nedit*editMenu.shiftRight.accelerator: Alt<Key>0
nedit*editMenu.shiftRight.acceleratorText: [Shift]Alt+0
nedit*editMenu.shiftRightShift.accelerator: Shift Alt<Key>0
nedit*editMenu.shiftRightShift.acceleratorText:
nedit*editMenu.lowerCase.accelerator: Shift Alt<Key>6
nedit*editMenu.lowerCase.acceleratorText: Shift+Alt+6
nedit*editMenu.upperCase.accelerator: Alt<Key>6
nedit*editMenu.upperCase.acceleratorText: Alt+6
! search menu
nedit*searchMenu.find.accelerator: <Key>F3
nedit*searchMenu.find.acceleratorText: [Shift]F3
nedit*searchMenu.findShift.accelerator: Shift<Key>F3
nedit*searchMenu.findAgain.accelerator: Ctrl<Key>l
nedit*searchMenu.findAgain.acceleratorText: [Shift]Ctrl+L
nedit*searchMenu.findAgainShift.accelerator: Shift Ctrl<Key>l
nedit*searchMenu.findAgainShift.acceleratorText:
nedit*searchMenu.findSelection.accelerator: <Key>F4
nedit*searchMenu.findSelection.acceleratorText: [Shift]F4
nedit*searchMenu.findSelectionShift.accelerator: Shift <Key>F4
nedit*searchMenu.findSelectionShift.acceleratorText:
nedit*searchMenu.findIncremental.accelerator: <Key>F5
nedit*searchMenu.findIncremental.acceleratorText: [Shift]F5
nedit*searchMenu.findIncrementalShift.accelerator: Shift <Key>F5
nedit*searchMenu.findIncrementalShift.acceleratorText:
nedit*searchMenu.replace.accelerator: <Key>F6
nedit*searchMenu.replace.acceleratorText: [Shift]F6
nedit*searchMenu.replaceShift.accelerator: Shift <Key>F6
nedit*searchMenu.replaceShift.acceleratorText:
nedit*searchMenu.replaceAgain.accelerator: Alt<Key>l
nedit*searchMenu.replaceAgain.acceleratorText: [Shift]Alt+L
nedit*searchMenu.replaceAgainShift.accelerator: Shift Alt<Key>l
nedit*searchMenu.replaceAgainShift.acceleratorText:
nedit*searchMenu.gotoLineNumber.accelerator: Ctrl<Key>j
nedit*searchMenu.gotoLineNumber.acceleratorText: Ctrl+J
nedit*searchMenu.gotoSelected.accelerator:
nedit*searchMenu.gotoSelected.acceleratorText: ^K^.
nedit*searchMenu.gotoMatching.accelerator: Ctrl<Key>=
nedit*searchMenu.gotoMatching.acceleratorText: Ctrl+=
nedit*searchMenu.selectToMatching.accelerator: Alt<Key>=
nedit*searchMenu.selectToMatching.acceleratorText: Alt+=
nedit*searchMenu.findDefinition.accelerator: Shift Ctrl<Key>d
nedit*searchMenu.findDefinition.acceleratorText: Shift Ctrl d
! preference menu
nedit*preferencesMenu.overtype.accelerator: <Key>Insert
nedit*preferencesMenu.overtype.acceleratorText: Insert
nedit*preferencesMenu.statisticsLine.accelerator:
nedit*preferencesMenu.statisticsLine.acceleratorText:
! shell menu
nedit*shellMenu.cancelShellCommand.accelerator: <Key>Escape
nedit*shellMenu.cancelShellCommand.acceleratorText: Escape
! macro menu
nedit*macroMenu.replayKeystrokes.accelerator:
nedit*macroMenu.replayKeystrokes.acceleratorText:
nedit*macroMenu.cancelLearn.accelerator: <Key>Escape
nedit*macroMenu.cancelLearn.acceleratorText: Escape
! windows menu
nedit*windowsMenu.splitWindow.accelerator: Alt<Key>2
nedit*windowsMenu.splitWindow.acceleratorText: Alt+2
nedit*windowsMenu.closePane.accelerator: Alt<Key>1
nedit*windowsMenu.closePane.acceleratorText: Alt+1
! keyboard
! Mark x => last cursor location before leaving. ^Q^P returns to x
! Mark y => beginning of selection block from keyboard
! Mark z => end of selection block from keyboard
! Define_Block() => macro needed to implement keyboard block select
! {
! goto_mark("y")
! start=$cursor
! goto_mark("z")
! end=$cursor
! select(start,end)
! }
!
! Write_Select() => Nico Morskieft's macro to write a selection
nedit*text.Translations: #override \n\
Ctrl<Key>k,Ctrl<Key>a: select_all() \n\
Ctrl<Key>k,Ctrl<Key>b: mark(y)\n\
Ctrl<Key>k,Ctrl<Key>c: copy_clipboard() \n\
Ctrl<Key>k,Ctrl<Key>d: save() \n\
Ctrl<Key>k,Ctrl<Key>e: open_dialog() \n\
Ctrl<Key>k,Ctrl<Key>f: forward_word("extend") \n\
Ctrl<Key>k,Ctrl<Key>g: macro_menu_command("BEEP") \n\
Ctrl<Key>k,Ctrl<Key>h: macro_menu_command("BEEP") \n\
Ctrl<Key>k,Ctrl<Key>i: paste_clipboard() \n\
Ctrl<Key>k,Ctrl<Key>j: macro_menu_command("BEEP") \n\
Ctrl<Key>k,Ctrl<Key>k: mark(z)macro_menu_command("Define Block") \n\
Ctrl<Key>k,Ctrl<Key>l: lowercase() \n\
Ctrl<Key>k,Ctrl<Key>m: macro_menu_command("BEEP")\n\
Ctrl<Key>k,Ctrl<Key>n: new()\n\
Ctrl<Key>k,Ctrl<Key>o: macro_menu_command("BEEP") \n\
Ctrl<Key>k,Ctrl<Key>p: macro_menu_command("BEEP") \n\
Ctrl<Key>k,Ctrl<Key>q: close()\n\
Ctrl<Key>k,Ctrl<Key>r: include_file_dialog() \n\
Ctrl<Key>k,Ctrl<Key>s: save() \n\
Ctrl<Key>k,Ctrl<Key>t: delete_selection() \n\
Ctrl<Key>k,Ctrl<Key>u: uppercase() \n\
Ctrl<Key>k,Ctrl<Key>v: cut_clipboard() \n\
Ctrl<Key>k,Ctrl<Key>w: macro_menu_command("Write Select") \n\
Ctrl<Key>k,Ctrl<Key>x: exit() \n\
Ctrl<Key>k,Ctrl<Key>y: delete_selection() \n\
Ctrl<Key>k,Ctrl<Key>.: goto_selected() \n\
Ctrl<Key>k,Ctrl<Key>0: mark(a) \n\
Ctrl<Key>k,Ctrl<Key>1: mark(b) \n\
Ctrl<Key>k,Ctrl<Key>2: mark(c) \n\
Ctrl<Key>k,Ctrl<Key>3: mark(d) \n\
Ctrl<Key>k,Ctrl<Key>4: mark(d) \n\
Ctrl<Key>k,Ctrl<Key>5: mark(e) \n\
Ctrl<Key>k,Ctrl<Key>6: mark(f) \n\
Ctrl<Key>k,Ctrl<Key>7: mark(g) \n\
Ctrl<Key>k,Ctrl<Key>8: mark(h) \n\
Ctrl<Key>k,Ctrl<Key>9: mark(i) \n\
Ctrl<Key>q,Ctrl<Key>a: replace_dialog("forward") \n\
Ctrl<Key>q,Ctrl<Key>b: beginning_of_selection() \n\
Ctrl<Key>q,Ctrl<Key>d: end_of_line() \n\
Ctrl<Key>q,Ctrl<Key>e: mark(x)backward_paragraph() \n\
Ctrl<Key>q,Ctrl<Key>f: find_dialog("forward") \n\
Ctrl<Key>q,Ctrl<Key>k: end_of_selection() \n\
Ctrl<Key>q,Ctrl<Key>p: goto_mark(x) \n\
Ctrl<Key>q,Ctrl<Key>r: mark(x)beginning_of_file() \n\
Ctrl<Key>q,Ctrl<Key>s: beginning_of_line() \n\
Ctrl<Key>q,Ctrl<Key>t: macro_menu_command("BEEP") \n\
Ctrl<Key>q,Ctrl<Key>u: macro_menu_command("BEEP") \n\
Ctrl<Key>q,Ctrl<Key>v: macro_menu_command("BEEP") \n\
Ctrl<Key>q,Ctrl<Key>w: macro_menu_command("BEEP") \n\
Ctrl<Key>q,Ctrl<Key>x: mark(x)forward_paragraph() \n\
Ctrl<Key>q,Ctrl<Key>y: delete_to_end_of_line() \n\
Ctrl<Key>q,Ctrl<Key>z: macro_menu_command("BEEP") \n\
Ctrl<Key>q,Ctrl<Key>0: mark(x)goto_mark(a) \n\
Ctrl<Key>q,Ctrl<Key>1: mark(x)goto_mark(b) \n\
Ctrl<Key>q,Ctrl<Key>2: mark(x)goto_mark(c) \n\
Ctrl<Key>q,Ctrl<Key>3: mark(x)goto_mark(d) \n\
Ctrl<Key>q,Ctrl<Key>4: mark(x)goto_mark(d) \n\
Ctrl<Key>q,Ctrl<Key>5: mark(x)goto_mark(e) \n\
Ctrl<Key>q,Ctrl<Key>6: mark(x)goto_mark(f) \n\
Ctrl<Key>q,Ctrl<Key>7: mark(x)goto_mark(g) \n\
Ctrl<Key>q,Ctrl<Key>8: mark(x)goto_mark(h) \n\
Ctrl<Key>q,Ctrl<Key>9: mark(x)goto_mark(i) \n\
Ctrl<Key>-: undo() \n\
Ctrl<Key>=: goto_matching() \n\
Ctrl<Key>2: goto_matching() \n\
Alt<Key> : macro_menu_command("Complete Word") \n\
Ctrl<Key>.: fill_paragraph() \n\
Ctrl<Key>;: delete_to_end_of_line() delete_to_start_of_line() \n\
Ctrl<Key>a: backward_word() \n\
Ctrl<Key>b: end_of_file() \n\
Ctrl<Key>c: mark(x)next_page() \n\
Ctrl<Key>d: forward_character() \n\
Ctrl<Key>e: mark(x)process_up() \n\
Ctrl<Key>f: forward_word() \n\
Ctrl<Key>g: delete_next_character() \n\
Ctrl<Key>h: delete_previous_character() \n\
Ctrl<Key>j: mark(x)goto_line_number_dialog() \n\
Ctrl<Key>n: newline()backward_character() \n\
Ctrl<Key>o: beginning_of_line() \n\
Ctrl<Key>p: end_of_line() \n\
Ctrl<Key>r: mark(x)previous_page() \n\
Ctrl<Key>s: backward_character() \n\
Ctrl<Key>t: delete_next_word() \n\
Ctrl<Key>u: mark(x)beginning_of_file() \n\
Ctrl<Key>v: mark(x)scroll_to_line(1000000) \n\
Ctrl<Key>w: scroll_up(1)grab_focus() \n\
Ctrl<Key>x: mark(x)process_down() \n\
Ctrl<Key>y: mark(x)scroll_to_line(1) \n\
Ctrl<Key>z: scroll_down(1)grab_focus()\n\
!! end of .nedit.Xdefaults
Top
|
|||||||||||