Search                        Top                                  Index
HELP VEDXTERMKEYS                         Revised Aaron Sloman July 2003
Updated 21 Dec 2011

Using Ved/XVed with the function keys available on a standard PC or
Xterminal.

This file can also be found at

    http://www.cs.bham.ac.uk/research/projects/poplog/help/vedxtermkeys

There are also two associated files with diagrams showing how function
keys on a standard PC are associated with Ved/XVed commands:

    http://www.cs.bham.ac.uk/research/projects/poplog/help/vedkeys.jpg
    http://www.cs.bham.ac.uk/research/projects/poplog/help/vedkeys.pdf

There is also a file explaining how to use Ved/XVed when there are no function-keys
available, so that everything is done with normal alphanumeric keys, with punctuation
keys and The CTRL key and ESC keys.
    TEACH essentialkeys

Online here:

    http://www.cs.bham.ac.uk/research/projects/poplog/teach/essentialkeys

That is also the subject of a Youtube video tutorial.

Note: the keybindings for both Ved in an Xterm window and XVed were
rationalised and made to be similar on 27 Jul 2003. The new bindings are
documented in this file and in HELP * XVEDKEYS. For Ved in an Xterm window to
work as described here, please note the required alterations to .Xdefaults
included below.

The code libraries for the keybindings are here:

    LIB * vedxtermkeys
    LIB * vedxvedkeys

CONTENTS (Use ENTER g, to access desired section.)

 -- Introduction
 -- Settings for .Xdefaults
 -- Layout of keyboard
 -- Keyboard actions
 -- -- Function Keys on the top row
 -- -- Named and Arrow Keys to right of alphabetic keys
 -- -- Numeric Keypad Keys
 -- Additional functions
 -- Using the Mouse to Move the Cursor (LIB * VEDXGOTOMOUSE)

To read further: Use the "Page Down" key or CTRL V (Screen down)

-- Introduction -------------------------------------------------------

This file depicts how VED running in an Xterm window, and XVED running
in its own windows, map keyboard actions onto editor events. This should
also work if you are running linux on a PC in "console" mode, i.e.
without the graphical X window server running. It is assumed that if you
are running in an Xterm window, the Unix/Linux environment variable
$TERM is set to 'xterm'. If you are working at a linux console $TERM
should be set to 'linux' (the normal default) or 'xterm'.

If you have logged in remotely form some other machine using something
like telnet, rlogin or ssh, some of the following may or may not work,
depending on the character codes transmitted when you press keys on your
keyboard, which varies from one networking tool to another. In all such
cases you should be able to use the key sequences which do not depend on
function keys, as described in
    HELP VEDKEYS

-- Settings for .Xdefaults --------------------------------------------
The following should go into the user's .Xdefaults file or a system-wide
defaults file, such as /usr/X11R6/lib/X11/app-defaults/XTerm
to make Ved (and some other things) work as expected.

    ! xterm translations to make VED work
    XTerm*VT100*Translations: #override \
        <Key>KP_0: string(0x1b) string("Op") \n\
        <Key>KP_Insert: string(0x1b) string("Op") \n\
        <Key>KP_Decimal: string(0x1b) string("On") \n\
        <Key>KP_Delete: string(0x1b) string("On") \n\
        <Key>KP_Home: string(0x1b) string("Ow") \n\
        <Key>KP_7: string(0x1b) string("Ow") \n\
        <Key>KP_Prior: string(0x1b) string("Oy") \n\
        <Key>KP_9: string(0x1b) string("Oy") \n\
        <Key>KP_Next: string(0x1b) string("Os") \n\
        <Key>KP_1: string(0x1b) string("Oq") \n\
        <Key>KP_End: string(0x1b) string("Oq") \n\
        <Key>KP_3: string(0x1b) string("Os")
    XTerm*deleteIsDEL: true

You can also put things in your .Xdefaults to determine default
font size in an Xterm window, and the number of columns and rows: e.g.

    XTerm*BodyFont: 10x20
    XTerm*VT100.geometry: 90x36



-- Layout of keyboard -------------------------------------------------

In what follows it is assumed that you are using a keyboard with the
standard configuration, now found on most PC keyboards, and many others
(e.g. NCD Xterminals), containing:

    1. On the top row, function keys labelled F1, F2, ... F12

    2. A standard alphanumeric collection of keys, with space bar below,
       shift keys, ESC, Tab, Control and CapsLock keys (usually on left,
       some possibly duplicated on the right), and on the right BackSpace
       and RETURN.

    3. An "arrow" keypad with four arrow keys, and above it six keys
       arranged in two rose,

    4. A numeric keypad on the right with "-" on top right, "+" below
       it, ENTER below that, and at the bottom "0/Ins" and "./Del" keys.

    5. If you are using a Sun workstation there may be an additional
       keypad on the left, in two columns of 5 keys.


        ----------------------------------------  ----------
        |    1. Function keys                  |  |not used|
        ----------------------------------------  ----------

        ----------------------------------------  --------- -----------
        |                                      |  | keypad| |         |
        |    2. Main key board                 |  --------- |4.numeric|
        |                                      |     3.     |  keypad |
        |                                      |  --------- |         |
        |                                      |  | arrows| |         |
        ----------------------------------------  --------- -----------


The four sets of keys shown work the same in VED, on NCD X terminals, on
PCs used as Xterminals or PCs running linux, on Digital Alpha
workstations, and on Suns with "type-5" keyboards.

The numeric keypad should be configured to transmit function codes not
the numeric and arithmetic symbols printed on the keys. This should
happen automatically.

The ENTER key on the numeric keypad should in that case transmit
different codes from the RETURN key on the main keyboard, as Ved and
XVed use them for different purposes. If for some reason the ENTER key
is not working, use ^G (CTRL G) as ENTER.

If you have three keys to the left of the Space bar, they may be
labelled Ctrl, Window (with a picture), and Alt (or Meta). In that case
you may find that the Window key also works as an ENTER key.

(You may find that you have additional keys that are not used. If you
wish to use them you may find it useful to get the free software package
xkeycaps to configure them. However that is beyond the scope of this
file.)

Besides using special function keys to drive the VED editor, you can
also use "key sequences" described in HELP VEDKEYS. Those should work no
matter which keyboard you are using.


-- Keyboard actions ---------------------------------------------------

-- -- Function Keys on the top row

The lower line gives the functions associated with each key on its
own. The upper line gives the functions associated with ESC followed by
the key.

     (Note: "linepart" means most recently deleted part line segment.)

        F1       F2       F3       F4       F5        F6       F7
     +--------+--------+--------+--------+--------+--------+--------+
 Esc | mk top | mk end | yank   | yank   | yank   | yank   | yank   |
+Key | file   | file   |linepart| line   |linepart|linepart|linepart|
-----+--------+--------+--------+--------+--------+--------+--------+
 KEY | MARK   | MARK   | DELETE | DELETE | DELETE | DELETE | DELETE |
     | BEGIN  | END    | LINE <-| LINE   | LINE-> | WORD <-| WORD-> |
     +--------+--------+--------+--------+--------+--------+--------+

         F8       F9      F10      F11      F12
     +--------+--------+--------+--------+--------+
 Esc | move   | copy   | move   | POP    |Clear   |   The last two
+Key | in     | in     | out    |        | Mark   |   may be different
-----+--------+--------+--------+--------+--------+   on some
 KEY | MOVE   | COPY   |XREFRESH| PUSH   | XCHANGE|   keyboards.
     | RANGE  | RANGE  |(file?) |        | POSN.  |
     +--------+--------+--------+--------+--------+
NOTE: In XVED F10 will set up "File" options, so it cannot be used.


-- -- Named and Arrow Keys to right of alphabetic keys

       KEY                                 Esc+Key

    +--------+--------+--------+       +--------+--------+--------+
    |TOGGLE  | TOP OF | LAST   |       | line   |go start| xup    |
    | STATIC | FILE   | WINDOW |       | above  |of range|        |
    +--------+--------+--------+       +--------+--------+--------+
    | DELETE | END OF | NEXT   |       |        |goto end| xdn    |
    | CHAR < | FILE   | WINDOW |       |        |of range|        |
    +--------+--------+--------+       +--------+--------+--------+


             +--------+                         +--------+
             | CHAR   |                         | Up     |
             | UP     |                         | lots   |
    +--------+--------+--------+       +--------+--------+--------+
    | CHAR   | CHAR   | CHAR   |       | Left   | Down   | Right  |
    | LEFT   | DOWN   | RIGHT  |       | Lots   | Lots   | Lots   |
    +--------+--------+--------+       +--------+--------+--------+

Sometimes ESC followed by arrow may have a different effect, depending on the
keyboard: try it out.


-- -- Numeric Keypad Keys

Note "<" means "left" and ">" means "right"

       KEY                                     Preceded by ESC
                                             (first three columns only)
    +--------+--------+--------+--------+   +--------+--------+--------+
    |        | HELP   | LOAD   | REDO   |   |        | help   | load   |
    |        |XTRMKEYS| LINE   |        |   |        | on key | range  |
    +--------+--------+--------+--------+   +--------+--------+--------+
    | CHAR   | CHAR   | CHAR   |        |   | up     | up     | up     |
    | UP <   | UP     | UP >   | SWITCH |   | < lots | lots   | > lots |
    +--------+--------+--------+ STATUS |   +--------+--------+--------+
    | CHAR   | 5      | CHAR   |        |   | left   | 5      | right  |
    | LEFT   |        | RIGHT  |        |   | lots   |        | lots   |
    +--------+--------+--------+--------+   +--------+--------+--------+
    | CHAR   | CHAR   | CHAR   |        |   | down   | down   | down   |
    | DOWN < | DOWN   | DOWN > |        |   | < lots | lots   | > lots |
    +--------+--------+--------| ENTER  |   +--------+--------+--------+
    | WORD LEFT       | WORD   |        |
    |                 | RIGHT  |        |  (NB. lots = a third of window)
    +-----------------+--------+--------+

The 5 key may be given a function in some keyboard configurations and not in
others. Try it. It should normally default to vedmidwindow, which moves
the current line (where the ved cursor is) to the middle of the window,
showing context above and below.

-- Additional functions -----------------------------------------------

Some additional functions are provided in LIB * VEDXTERMKEYS

These two make it easy to move or copy the marked range in the current
file (the mnemonic should be obvious);

    ESC -
        keep one copy of marked range and move it here

    ESC =
        make two copies, by copying to here

    CTRL L
        Invokes vedxrefresh. Before refreshing the screen this procedure
        finds out if the xterm window has been re-sized and if so
        re-sets linewidth and window length accordingly.

    ESC Delete
    ESC BS
        This will invoke vedjoinline, which joins the current line to the
        previous line, no matter where the cursor is, and no matter whether
        this violates vedlinemax. Often useful when re-formatting.

    The variable vedexpand now defaults to the character `^` instead of
    to false. See HELP * vedexpand

See also HELP * VEDKEYS

-- Using the Mouse to Move the Cursor (LIB * VEDXGOTOMOUSE) -----------

The library program LIB * VEDXGOTOMOUSE makes the mouse available to
VED: for example, you can move the cursor and create marked ranges using
the mouse. See HELP * VEDXGOTOMOUSE for details.


-----------------------------------------------------------------------
This was originally a Birmingham Local Help file
    $poplocal/local/help/vedncdxtermkeys

--- $usepop/pop/help/vedxtermkeys
--- Copyright University of Sussex 2011. All rights reserved. ------