TEACH MARK A. Sloman Sept 1987 MARKING A RANGE IN THE EDITOR ============================= -- Introduction ------------------------------------------------------- This file introduces a means of operating on large chunks of text, composed of several complete lines. This sort of chunk is called a 'range'. VED allows you to indicate that you want to work on a range by 'marking' it, as described below. You can then perform various operations on the range you have marked, e.g. deleting it, moving it to another place in the same file or to another file, transcribing (copying) it to another place in the same file or another file, or loading it (e.g. getting POP-11, or Prolog or Lisp to compile, or obey it). There are commands to re-format a range either by inserting indentation if it is a programming file or making left or right margins line up if it is a text file. This file does not include these formatting commands, though cross-references are given at the end. CONTENTS: Use g to access required sections. Or use SCREENDOWN. -- Introduction -- Marking a range -- Moving a marked range -- Clear Range Mark crm -- Deleting a marked range d -- Yanking back deleted text y -- Transcribing a marked range t -- Moving and copying text between files: mi mo ti to -- Tidying up a paragraph j -- Revision questions -- Other relevant documentation -- Marking a range ---------------------------------------------------- VED provides two commands for marking a "range" in the current file, MARKLO - used to set the start of a range, and MARKHI - used to set the end of a range. MARKLO sets the lowest line number to be marked. MARKHI sets the highest line number. You will need to use your keyboard map to find out which keys (or key sequences) are used for these two commands. They may be indicated as "Mark Start" and "Mark End", since the terms "MARKLO" and "MARKHI" can be confusing. This is because the line with the LOwest number will be the HIghest on the screen! When you have found the MARKLO and MARKHI keys you can see what they do by moving the cursor around and pressing them. E.g. put the cursor on THIS line and press the MARKLO key. A vertical mark should appear on the left of the screen against the line. Now move the cursor to THIS line and press the MARKHI key. All the lines between the two lines you indicated should now have the mark on the left. If you now move the cursor to THIS line and press the MARKHI key, you will extend the marked range. If you then move the cursor up two lines and press the MARKLO key, the marked range will be shortened. Try to get the whole of this paragraph marked, and nothing else. Now try to get just THIS line marked. To mark a single line you put the cursor on the line and then press MARKLO then MARKHI. (Either order will do.) -- Moving a marked range ---------------------------------------------- There are various things you can do with a marked range. E.g. you can MOVE it. For this you will have to use your keyboard map to find the MOVERANGE key (also known as the VED_M) key. It moves the marked range to after the current line. For instance, mark the two lines of the preceding paragraph, then put the cursor on THIS line. Then press the MOVERANGE key. The moved portion of the file will remain marked. So you can move it again if you wish. Try moving it back to where it was. Try moving various bits of this file to other places by marking them with MARKLO and MARKHI then using the MOVERANGE key. If your terminal map does not have a MOVERANGE key for your terminal, you can get the same effect with the m command. E.g. mark a range, then move the cursor and do m to make the range move to the line below the cursor. -- Clear Range Mark crm --------------------------------------- Sometimes after you have marked a range and done something with it you want to get rid of the mark: e.g. to prevent accidental operations on the wrong bit of text. You can get rid of the marks by giving the command: crm i.e. 'clear range mark'. Try marking a range and then using that command to clear the mark. It leaves the text in the file unaltered. -- Deleting a marked range d ---------------------------------- You can delete the text in a marked range with the d command. Try using MARKLO And MARKHI to mark this paragraph, then use the d command to delete it. The lines marked are removed from the file. -- Yanking back deleted text y -------------------------------- If you decided that deleting the text was a mistake you can get it back. The last range deleted is saved and can be restored by giving the y command to "yank" it back from the store. It will be re-inserted immediately after the line on which the cursor is. So it will not necessarily go back to the same place. Thus pressing the MOVERANGE key is equivalent to giving two commands, d y You can use y even after switching to another file. So the sequence d, change files, y will move text from one file to another. -- Transcribing a marked range t ------------------------------ If you have some text which you wish to transcribe (copy) to another part of the file, you can put the cursor at the line after which you want the text to appear, then give the command t E.g. mark the above paragraph, then give the t command, with the cursor on THIS line. A new copy of the marked range appears below: Some keyboards (e.g. the Visual 55) have a COPY RANGE key that is the equivalent of t. -- Moving and copying text between files: mi mo ti to ----------------- There are four VED commands for Moving or Transcribing a marked range from one file to another. (Transcribing is the same as copying.) The range can be moved or transcribed Out from the current file to another file, or In from another file to the current file. Hence there are four commands: Moving marked range: mo - move marked range out to the other file mi - move marked range in from another file Transcribing (copying) marked range to - transcribe marked range out to the other file ti - transcribe marked range in from another file You can try these commands out as follows. Mark a few lines above using the MARKLO and MARKHI keys. Then read in some teach file you are no longer interested in, e.g. teach teach If you then, with the cursor in the other file, do ti The range you have marked in this file will be transcribed in to the file the cursor is in. You can repeat the command and make another copy. If you do mi the range will be copied over again, and REMOVED from this file. Try all that then see if you can use the 'to' and 'mo' commands to copy or move a marked portion of this file to the other file. For the 'o' commands the cursor has to be in the same file as the range to be copied or moved. For the 'i' commands the cursor has to be in the file the text is to be copied Into. -- Tidying up a paragraph j ----------------------------------- When you come to type in a lot of text, you will eventually find that some paragraphs become untidy due to text having been inserted or deleted, like this paragraph. Whilst it is possible to tidy such paragraphs explicitly by inserting new 'newlines' in appropriate places, and joining up lines by pressing the CHARDELETE key at the beginnings of lines it is easier to have the computer do it. Mark this untidy paragraph and then press and give the 'j' command (followed by RETURN). This command takes a minute or two to do its stuff. ("j" comes from the idea that the text is "justified" to the right. In a program file the "j" command will behave differently.) -- Revision questions ------------------------------------------------- Write answers to the following in a file that you can refer to in future for information about VED. e.g. you could call it 'vednotes'. How do you do the following in VED: -- mark a range -- move a marked range to another part of a file -- get rid of the range mark without deleting the marked text? -- delete a marked range -- get back the text when you have deleted a range -- copy a marked range to another part of the same file -- justify (tidy up) a marked range -- explain what the following commands do: mi mo ti to -- Other relevant documentation --------------------------------------- This file has introduced only the basic information about marked ranges required for normal use. If you are going to use VED to develop programs you will need to learn about the 'load marked range' command, explained in the file: TEACH * LMR - how to 'load' a marked range There are additional relevant documentation files you can read with TEACH or HELP commands, but they are best ignored for now unless you are an experienced user of computing systems. HELP * LMR - summary and more information HELP * MARK - a more complete summary of 'marked range' commands HELP * FORMAT - for formatting commands HELP * INOROUT - more on moving or copying text between files. HELP * YANK - On various means of yanking back deleted text See also the HELP entries for the following commands. * ved_wcmr * ved_smr * ved_mi * ved_mo * ved_ti * ved_to * ved_tidy * ved_fill * ved_j * ved_jp * ved_jjp * ved_lcp * ved_mcp * ved_gsr --- C.all/teach/mark --------------------------------------------------- --- Copyright University of Sussex 1989. All rights reserved. ----------