TEACH ESSENTIALKEYS Aaron Sloman Nov 2011 Based on TEACH TELNETKEYS Revised 16 Dec 2011 How to use Ved in 'Dumb terminal' mode without using mouse or function keys. Available online here: http://www.cs.bham.ac.uk/research/projects/poplog/teach/essentialkeys CONTENTS -- Introduction: Ways of using the Poplog editor Ved/Xved -- Using Ved in "dumb terminal" mode -- Working without function keys -- Table of key combinations -- Handling multiple buffers -- More information -- Introduction: Ways of using the Poplog editor Ved/Xved -------------------- Ved is the Poplog editor. It can be used in multi-window mode if Poplog is running in an environment with 2-D graphical capabilities (e.g. on a linux machine with the X window system, or accessed via XMing on a windows machine). In multi-window mode the editor is referred to as XVed, and invoked by the command 'xved'. When used in single window mode it is called Ved. Both versions are implemented in Pop11 and both have deep connections with the Poplog compilers, so that they can be used with Pop11, or Poplog Prolog, Poplog ML, or Poplog Common Lisp. Because Pop11 is the implementation language it is easy for Pop11 users to expand the functionality of Ved/XVed by specifying new commands, as will be illustrated in a future tutorial. (This is analogous to the role of Lisp in the Emacs editor.) This teach file focuses only on text manipulation and interactions with the pop11 compiler. Although Ved (unlike XVed) uses a single window on the screen it can split that window into two halves, the upper and lower halves, which can then be used to view two files at once, e.g. a Pop11 command file along with a teach file, or the program output file, usually called 'output.p'. (There is a version that splits a big window into more than two windows stacked vertically. See HELP WINDOWS) Many people prefer to use Xved so that they have two or more windows open in different parts of the screen, possibly overlapping. But some prefer not to have to use the mouse to manipulate windows and prefer to use Ved in a single window. Moreover, you may be unable to use XVed either because you are not using a machine that supports X window facilities, or because you are logged in to a remote machine and the connection is too slow or for some other reason, or because you are logged in from a machine running windows using PuTTy or SSH, and your machine does not have XMing or equivlent. -- Using Ved in "dumb terminal" mode ---------------------------------- If you use telnet or SSH to log through to a machine running Ved you may be on a terminal where the function keys do not work as you expect them to, e.g. because the machine does not distinguish the "ENTER" key and the "RETURN" key, and the arrow keys may not work as expected. If you are using a laptop you may not have the top row of function keys: F1, F2, ... F12. Or some of them may be 'grabbed' by your operating system or window manager so that they cannot be used by Ved. The key combinations described below do not require any special function keys or arrow keys: you can get by using only the Contrl and Esc keys, along with normal typewriter keys (alphabetic, numeric and symbol keys). In that situation you may find it useful to use VED in its "dumb terminal" mode where there is always only one window in which everything is visible, though VED allows you to have that window divided horizontally in two, so that you can see two files at a time. You can have more than two files in the editor, e.g. a teach file, some help files, your program file, and the output file, but only two of them visible at any time. You can then switch to looking at one of the non-visible files using the techniques described below. The file TEACH TELNETKEYS provides a comprehensive list of things you can do in Ved using only combinations of standard keyboard keys. A smaller subset, the essential combinations, are introduced below, for people starting to use Ved for learning to program in Pop11. -- Working without function keys -------------------------------------- You can use the following key combinations to perform functions that are normally performed using special function keys. Here the symbol "^" before a capital letter means: "hold down the Control key while you click on the key shown. e.g. "^G" means hold down Control and then tap the G key. The control key should go down first, and should remain down until after you have pressed the other key. That is read out as 'Control G'. Similarly "^F" is 'Control F'. Both are defined below. The symbol "ESC" means Press and then release the key marked "Esc" or "Escape" In the former case the Ctrl key REMAINS held down while the second is pressed, whereas in the second case you RELEASE the first key before pressing the second key. ^E -- hold Ctrl down and keep it down by typing E ESC e -- Tap (press and release) the ESC key, then tap the E key. NOTE: there is no difference between ^E and ^e: the effect of Ctrl is the same whether the caps lock is on or not, and whether Shift is pressed or not. However after 'ESC' there is a difference between typing a lower or upper case letter. E.g. ESC f moves the Ved text cursor forward to the start of the next word. (Try it now, several times. Compare ESC b, which moves back/left.) Note Ved has its own rules for what counts as an item boundary. That can be changed for different programming languages. The default setting is for Pop11 so 'cat95' is one item, '95cat' two. ESC F is used for 'filename completion' If you type part of a file name then 'ESC F' will get a list of files in the same directory that could complete that name. (ESC 3, which is easier to type, can also be used.) -- Table of key combinations ------------------------------------------ Here are some of the most useful combinations of Control and Escape keys with other keys. Some of the most important actions, essential for programming in Ved, are labelled "NB" on the right. KEY COMBINATION FUNCTION VED LOGICAL NAME ^G Enter a command ENTER NB ESC ^G Switch to/from command line SWITCHSTATUS ESC RETURN Redo command on command line REDOCOMMAND ^P Move up one line CHARUP uP NB ^N Move down one line CHARDOWN dowN NB ^B Move left one character CHARLEFT Back NB ^F Move right one character CHARRIGHT Forward NB ESC ^P Move up several lines CHARUPLOTS ESC ^N Move down several lines CHARDOWNLOTS ESC ^B Move left several characters CHARLEFTLOTS ESC ^F Move right several characters CHARRIGHTLOTS ESC b Move left one word WORDLEFT NB ESC f Move right one word WORD RIGHT NB ESC v Screen up SCREENUP ^V Screen down SCREENDOWN ^A Move to left edge of screen SCREENLEFT NB ESC ^E Move to right edge of screen SCREENRIGHT ESC ^A Move to start of text in the line TEXTLEFT ^E Move to end of text in the line TEXTRIGHT NB ^J Move to start of next line NEXTLINE NB (That's 'LF' on some old terminals) ESC m Mark start of range MARKLO NB ESC M Mark end of range MARKHI NB ESC C Mark the current procedure ENTER mcp NB ESC g Go to start of marked range MARKFIND ESC G Go to end of marked range ENDRANGE ^R Delete character under cursor DOTDELETE DEL Delete character to left of cursor CHARDELETE NB (Some people set this to delete character under cursor) ^W Delete word to left of cursor WORDLEFTDELETE ^U Delete line to left of cursor CLEARHEAD NB ^K introduces 'Kill = Delete' commands: ^K ^B Delete word to left of cursor WORDLEFTDELETE ^K ^F Delete word to right of cursor WORDRIGHTDELETE ^K ^A Delete line to left of cursor CLEARHEAD ^K ^E Delete line to right of cursor CLEARTAIL NB ^K ^K Delete current line LINEDELETE NB ^K ^D Delete marked range ENTER d NB ESC w Toggle half/full-screen window SETWINDOW NB ESC x Switch to other window SWAPFILES NB ESC e Enter file selection menu FILESELECT NB for selecting a ved buffer ESC 3 Enter disk file selection menu FILECOMPLETE (Also ESC F) ESC q Quit the current file ENTER q NB ESC c Compile the current procedure ENTER lcp NB ESC d Compile the current line LOADLINE NB ^D Compile the marked range ENTER lmr NB ESC h Get help for word to right of cursor VEDGETSYSFILE (equivalent to ENTER help ) If preceded by one of the words TEACH, REF, LIB it may get a TEACH or REF or LIB file. See HELP VEDGETSYSFILE ESC n Searches forward for the next '*', often placed between a documentation type and a file name. E.g. TEACH * VED HELP * VED REF * VED LIB * RIVER -- Handling multiple buffers ------------------------------------------ The following file gives useful information on how to cope with multiple buffers in VED when you cannot see all of the files at once. TEACH * BUFFERS -- More information --------------------------------------------------- If your function keys do work, e.g. F1 to start mark range and F2 to end mark range, and you wish to reminded of what the most useful ones do, try HELP * VEDXTERMKEYS TEACH * MINIVED For a more complete list of Ved key sequences and available functions, see HELP * VEDKEYS TEACH * MATCHES HELP * MATCHES Ved has various mechanisms for searching forwards and backwards in a file, and also supports "search and replace" either globally or interactively. You can learn more about that in TEACH * VEDSEARCH Useful for revision purposes: TEACH * QUICKVED --- $usepop/pop/teach/essentialkeys --- Copyright University of Birmingham 2011. All rights reserved. ------