SUMMARY: Mapping Function keys in TextEdit

From: Himanshu Gohel (gohel@csee.usf.edu)
Date: Thu Jul 08 1993 - 20:10:41 CDT


A few weeks ago, I asked if the function keys could be mapped to
provide functions in TextEdit such as load, save, empty etc.

I was not aware of the difference between "Key bindings" and "Filters,"
which was pointed out to me by David Frenkiel II (dfl@math.tau.ac.il).

He says:

"First, there is a difference between filters (which r calls to
 external programs) and internal textedit functions (supplied by the
 textsw object). For the latter, you need to load X resources called
 OpenWindow.KeyboardCommand.*, where * may be Store, includeFile,
 Translate and dozens of other commands. check out the xview reference
 manual."

So here's what I came up with:

Key Bindings:
------------

I looked up the XView Reference Manual, and found a whole
bunch of valuable key bindings that can be activated with the
addition of one line in your .Xdefaults file:

 OpenWindows.KeyboardCommands: Full

That will allow you to use all the keyboard commands as listed
in Chapter 6, pages 216-234. For those who don't have access
to the book, I'll list a few here:

Meta-s Store (this maps to "Store as new file" - anyone know
        how to map it to "Save current file" ?)

Meta-i Include file (This works like the SunView version - you
        have to type the filename, select it, and then press
        Meta-i)

Meta-e Empty file

Alt-space Menu

There are many more, but these are the one most useful to me.

Filters:
-------

These are external functions, which can be activated by pressing chosen
keys. You can store these in $HOME/.textswrc. Here are some examples
that were in the Florida Sunflash sometime earlier this year (or was it
last year?)

Note that this is used by not only the text editor, but all text
windows, such as the cmdtool - thus the filters F7-F9!

# Add today's date
F2 FILTER
echo -n `date '+%a, %h %d 19%y'`

# Shift Selected lines left.
F3 FILTER
shift_lines -1

# Shift selected lines right.
F4 FILTER
shift_lines -t 1

# Spell Check Text And Display Misspelled Words In The Console.
F5 FILTER
cat|tee $HOME/.extraz;echo ' '>>$HOME/.extraz;\
echo ''>/dev/console;\
echo '*** START SPELL-CHECK ***'>/dev/console;\
spell $HOME/.extraz|fmt -46 > /dev/console;\
echo '**** END SPELL-CHECK ****'>/dev/console

# Send Highlighted Text To The Printer.
F6 FILTER
cat|tee $HOME/.extraz;\
echo '' >> $HOME/.extraz;\
sed 's/ /(+L=)/g' $HOME/.extraz|fmt -81 -s|sed 's/(+L=)/ /g'|lpr;\
echo '' > /dev/console;\
echo '**** SELECTED TEXT ****'>/dev/console;\
echo '**** SENT TO PRINTER ****'>/dev/console

# pwd
F7 FILTER
echo "pwd"

# ls -F
F8 FILTER
echo "ls -F"

# ls -Fa
F9 FILTER
echo "ls -Fa"

----------------------------------------------------------------------

Hope this summary helps you.

---
Himanshu Gohel, Gohel@csee.usf.edu
U of South Florida, Tampa, FL 33620-3140



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:00 CDT