Presentation is loading. Please wait.

Presentation is loading. Please wait.

Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 6 Text Editors.

Similar presentations


Presentation on theme: "Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 6 Text Editors."— Presentation transcript:

1 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 6 Text Editors

2 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux2 Objectives Understand the functions of common text editors Work with individual files and multiple files in text editors Work with lines of text in files using cut, copy, and paste commands Search for character strings in documents

3 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux3 Objectives (continued) Search and replace character strings in documents Describe the menu options of common text editors

4 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux4 Text Editors Text editors are used to create and revise text files Three text editors will be presented –DOS Edit –Windows XP TextPad –Fedora Core 4 Vim Some skills to acquire –Working with multiple files –Searching for character strings –Replacing character strings –Utilizing regular expressions

5 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux5 Overview of Common Text Editors Three text editors will be introduced Rationale for studying features of DOS Edit –If PC crashes, DOS Edit may be only available tool –Skills will simplify transition to Vim editor

6 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux6 Overview of Common Text Editors Three text editors will be introduced Rationale for studying features of DOS Edit –If PC crashes, DOS Edit may be only available tool –Skills will simplify transition to Vim editor

7 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux7 Overview of DOS Edit Operations: create, edit, save, and print ASCII files –Examples: edit programs for compilers or script files Menu options: File, Edit, Search, View, Options, Help Navigate through menu using keyboard arrow keys Two ways to select menu items –Press the spacebar –Use keyboard shortcut (Alt + second key) Two tools used to interact with interface –Keyboard –Mouse

8 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux8 Overview of DOS Edit (continued)

9 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux9 Overview of TextPad TextPad: text editor modeled on XP user-interface Some operations that may be performed –Cutting-and-pasting text –Correcting common typing errors –Changing the case of words –Indenting blocks of lines –Splitting or joining lines –Inserting whole files –Undoing or redoing any changes –Inserting visible bookmarks on lines

10 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux10 Overview of TextPad (continued)

11 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux11 Overview of Vim Vim (Visual editor Improved) Three editing modes –Insert Used to enter text; type i to begin typing –Command/Edit Default mode of editor, used to modify text Entire document is not exposed to changes –Visual Used to highlight text and perform copy-and-paste Toggle between the modes using the Esc key

12 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux12 Overview of Vim (continued)

13 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux13 Working with Files Basic techniques –Saving files –Creating new documents –Opening and manipulating multiple documents Three editors used in text are line editors –Create or edit one line at a time –Press Enter to end the line and proceed to the next line –Proper tool for creating a script or source program

14 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux14 Working with Files in DOS Edit Type edit at the command prompt to start DOS Edit Creating a new file: start typing in document window First way to open an existing file –Press Alt+F and then press O –When Open dialog box opens, type file name Second way to open an existing file –Press Alt+F to switch to Files list –Use arrow keys to highlight desired file –Press Enter Press Alt+D to switch to the Directories List

15 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux15 Working with Files in DOS Edit (continued)

16 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux16 Working with Files in DOS Edit (continued) Opening a second window: press Alt+V and then S –Press F6 to move between windows Accessing another file –Open a second window, press F6 to move to it –Open another file using instructions on previous slide Save a file with same name: press Alt+F and then S Saving a file with a new name –Press Alt+F and then A –Enter new name in Save As dialog box Switch directories, if needed, by pressing Alt+D

17 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux17 Working with Files in DOS Edit (continued)

18 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux18 Working with Files in TextPad Two choices when creating a file from File menu –Create an unnamed document Click File -> New (use Save As dialog to name file) –Create a named document Click File -> Open (opens the File Open dialog box) Multiple documents can be tiled in various ways –Example: click Window -> Tile Horizontally Periodically save file to avoid losing work –Save from File menu, press Ctrl+S or click Save button Workspace: stores a set of files (go to File menu)

19 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux19 Working with Files in TextPad (continued)

20 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux20 Working with Files in Vim Type vim at command prompt to open the Vim editor –Specify filename(s) to open application in Edit mode Accessing open files behind first open file –Place Vim in Edit mode (press Esc to change modes) –Type :next to see the next file in the list –Type :previous to go to prior file You can cut, copy, and paste with multiple open files –Type :args to place brackets around the active file Use :split to create a file while another is open –Example: :split mycanoe

21 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux21 Working with Files in Vim (continued)

22 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux22 Working with Lines of Text Typical commands used: cut, copy, paste Analogy to cut, copy, and paste operations –Cutting and pasting paper with scissors and tape Editing is enhanced with cut, copy, and paste

23 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux23 Working with Lines of Text in DOS Edit Cut, copy, and paste operations use an edit buffer –Edit buffer: temporary holding area Highlighting text to cut or copy –Position cursor at first character of text block –Press arrow or cursor movement key with Shift Consequences of cutting highlighted text –Text removed from document and placed in edit buffer Consequences of copying highlighted text –Text placed in buffer, but still remains in document Paste cut or copied text at the cursor location

24 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux24 Working with Lines of Text in DOS Edit (continued)

25 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux25 Working with Lines of Text in TextPad Windows Clipboard provides functionality of buffer Highlight text before using Cut or Copy command Two of four options for cutting highlighted text –Click the Edit menu and then click Cut –Press Ctrl+X Two of four options for copying highlighted text –Click the Edit menu and then click Copy –Press Ctrl+C Two of four options for pasting highlighted text –Click the Edit menu and then click Paste –Press Ctrl+V

26 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux26 Working with Lines of Text in Vim Cutting a line from a document –Place cursor anywhere on target line using arrow keys –Type the dd command to cut one line –Enter a number before dd to cut multiple lines; e.g., 20dd Pasting lines that were cut –Type P to paste text before cursor, p to paste text after Copying text –Position cursor to appropriate starting location –Enter Visual mode by pressing Esc, then typing v –Highlight text with arrow keys, enter y Enter u to undo an action

27 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux27 Searching For Text Strings Search or Find command: used to locate text strings String: a series of characters in a document Repeat search to find multiple occurrences of string

28 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux28 Searching for Text Strings in DOS Edit Search procedure –Press Alt+S and then press the F key –Type search string in Find What field –Press Alt+W, if you want to match a whole word –Press Alt+C, if you want to match the case –Press Enter to start to search –Press F3 to repeat

29 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux29 Searching for Text Strings in DOS Edit (continued)

30 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux30 Searching for Text Strings in TextPad Search procedure –Open the Find dialog box –Type the text string in the Find what box Click the Find what list arrow to retrieve a prior string Some of the options for tailoring your search –Hex: specify a search string in hexadecimal –Match whole words: find whole word occurrences –Regular expression: specify regular expression Repeat search: click Find Next or press Ctrl+F Backward: click Find Previous or press Ctr+Shift+F

31 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux31 Searching for Text Strings in TextPad (continued)

32 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux32 Searching for Text Strings in Vim Quick search options when exact spelling is known –Type :/ followed by the word you want to find If the word exists in the file, all instances are highlighted –Place the cursor on a word and then press the * key All matching words will be highlighted Remove all highlighting using :noh or :nohl –Sticky highlighting is carried over to future sessions Use regular expressions for advanced searches –Substitute characters for other characters –Locate the beginning and end of a line –Find special characters in programming documents

33 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux33 Searching for Text Strings in Vim (continued)

34 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux34 Searching for Text Strings in Vim (continued)

35 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux35 Searching And Replacing Text Strings Find and Replace: search-and-replace operation –Replace a text string in document with another string –Example: replace a wrong name used repeatedly Two search-and-replace modes in most editors –Automatically find and replace all instances –Find and replace instances if approved by user

36 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux36 Searching and Replacing Text Strings in DOS Edit Search and replace procedure –Press Alt+S and then press R to open Replace dialog –Type the search string in the Find What field –Type replacement text string in Replace With –Press Alt+W to match a whole word –Press Alt+C to match the case of the text string –Press Enter to start the search –If match is found, press Enter to accept change Press right arrow key and then Enter to reject –To replace all matches, highlight Replace All and enter

37 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux37 Searching and Replacing Text Strings in DOS Edit (continued)

38 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux38 Searching and Replacing Text Strings in TextPad Search and replace procedure –Open the Replace dialog box –Type the search string in the Find what text box Click the Find what list arrow to retrieve a prior string –Type replacement text string in Replace box Click the Replace with list arrow to retrieve a prior string Four additional options –Find Next: used to find next occurrence of text string –Replace: used to replace the current text selection –Replace Next: replace current selection, find next –Replace All: replace all occurrences of search text

39 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux39 Searching and Replacing Text Strings Using Regular Expressions in TextPad Examples using regular expressions –Find what: [A-Z][a-z]+ Find any alphabetic word starting with uppercase letter –Replace with: \U& Replace word with same word, all in uppercase Tagged expression is a type of regular expression –Starts with character pair “\(” and ends with pair “\)” –Replacement expression is \x; x is a number from 1-9 –Example: “\([a-z]+\) \([a-z]+\)” matches “way wrong” “\2 \1” would replace it with “wrong way”

40 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux40 Searching and Replacing Text Strings in Vim Substitution: term used for search and replace Versions of command syntax for a basic search –:substitute /pattern/string –:sub /pattern/string –:s /pattern/string Place % before :substitute to search entire document –Example: :% sub /bug/wasp replaces “bug” with “wasp” Full syntax: :[range]sub /{pattern}/{string} [&] [c] [g] –[range]: specifies which lines you want to search

41 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux41 Searching and Replacing Text Strings in Vim (continued)

42 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux42 Searching and Replacing Text Strings in Vim (continued) A few flags to improve search-and-replace operations –[&]: use the previous search pattern –[c]: confirms each substitution –'n': skips this match and goes to the next match –Esc: quits substituting –^E: scrolls the screen up (same as Ctrl+E) Regular expressions improve search-and-replace Magic characters: used as wildcards in patterns Example: :s/a\|b/xxx\0xxx/g –Modifies “a b” to “xxxaxxx xxxbxxx”

43 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux43 Searching and Replacing Text Strings in Vim (continued)

44 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux44 Editor Reference Provides information about menus and options Three topics to cover –DOS Edit Reference –TextPad Reference –Vim Reference

45 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux45 The File Menu in DOS Edit Hold down Alt to “turn on” the menus Press the F key to open the File menu Select a menu option –Use arrow keys and press Enter, or use shortcut Some commands on the File menu –New: open a new window to edit a new text file –Open: open the Open dialog box for existing text files –Save As: open the Save As dialog box to store a file –Print: print to the local printer on port LPT1

46 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux46 The File Menu in DOS Edit (continued)

47 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux47 The Edit Menu in DOS Edit Opening Edit menu: highlight text and press Alt+E Edit Menu options –Cut: remove highlighted text from screen (Ctrl+X) –Copy: place highlighted text into edit buffer (Ctrl+C) –Paste: insert buffer contents at cursor location (Ctrl+V) –Clear: remove highlighted text from screen (Delete) Highlight text before using Copy, Cut, and Clear –Use Shift key plus cursor movement key –Use Shift key and continually press right arrow Use Paste only if characters are in the edit buffer

48 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux48 The Edit Menu in DOS Edit (continued)

49 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux49 The Search Menu in DOS Edit Use the Search menu to locate text in a document Press Alt+S to open the Search menu Search menu options –Find: find first occurrence of search string –Repeat Last Find: repeat last search (Press F3) –Replace: find search string and replace with new text Press Alt+R to replace all occurrences of search string Press Alt+A for one string occurrence, Alt+R confirms Press Alt+S to skip the replacement Press Esc to exit without replacing text Other options: Match Whole Word Only, Match Case

50 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux50 The Search Menu in DOS Edit (continued)

51 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux51 The View Menu in DOS Edit Allows you to open or close a second window –Press F6 key to move between windows Press Alt+V to open the View menu View menu options –Split Window: open a second editing window (Ctrl+F6) –Size Window: resize active window using Up and Down arrow keys Press Enter to accept new size, or press Esc to cancel Shortcut key is Ctrl+F8 –Close Window: closes the active window (Ctrl+F4)

52 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux52 The View Menu in DOS Edit (continued)

53 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux53 The Options Menu in DOS Edit Tasks performed with the Options menu –Change the tab settings in DOS Edit –Change the default printer port from LPT1 –Change color scheme of text and highlighted text Press Alt+O to open the Options menu Choices in Options menu –Settings: change tabs and default local printer port –Colors: change the color scheme in DOS Edit

54 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux54 The Help Menu in DOS Edit Press Alt+H to open the Help menu Help menu options –Commands: lists the shortcut keys in DOS Edit –About: see version number and copyright date

55 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux55 The TextPad File Menu Provides a wide range of file-oriented options To select the File menu, click it Some of the File menu options –New: open a new window to edit new text file (Ctrl+N) –Close: close all views of the active document –Save As: open Save As dialog box to store a file (F12) –Save All: save all modified documents (Ctrl+Shift+S) –Workspace: open a recently used workspace –Send: e-mail the active document to another person –Exit: end your session in TextPad

56 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux56 The TextPad Edit Menu To select the Edit menu, click it Some menu options –Redo: cancel the last Undo command (Ctrl+Y) –Cut Other: cut text, append to text already on Clipboard –Change Case: change the case of the selected text. –Transpose: swap adjacent characters, words, or lines –Reduce Indent: reduce indent of selection (Ctrl+Shift+I) –Reformat: adjust lengths of selected lines to the margin Windows Clipboard used for cut, copy, paste –Windows Clipboard: temporary holding area for text

57 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux57 The TextPad Search Menu From the Search menu, you can locate text in files Some menu options –Find: specify text to search for and search criteria (F5) –Find Next: find next occurrence of search text (Ctrl+F) –Find Previous: find prior search result (Ctrl+Shift+F) –Replace: specify search text and replacement text –Jump Next: jump to next item in Search Results (F4) –Next Bookmark: go to next line with a bookmark (F2) –Match Bracket: match closing bracket to opening Text bookmarks: save your place in a file

58 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux58 The TextPad View Menu Control information surrounding text-editing window Menu options –Status Bar: display or hide status bar at window bottom –Clip Library: display or hide the Clip Library –Document Tabs: display/hide tabs for document switching –Toolbars: display dialog for customizing toolbar buttons –Line Numbers: display/hide line numbers in active view –In Web Browser: display an active HTML document –Document Properties: show active document properties

59 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux59 The TextPad Tools Menu Provides a number of items –Links to Java compiler and runtime environment –Tools to compare files, check spelling, and sort Some menu options –Compare Files: look for differences between text files –Spelling: check spelling of active document (F7) –Convert to DOS: convert characters from ANSI to DOS –Explorer: open Windows Explorer (Alt+F3) –Run: start another application –User Tool: start an application added to Tools menu

60 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux60 The TextPad Macros Menu Macro: sequence of keystrokes or mouse actions Record macros to perform repetitive tasks –Create 1 unnamed macro and 64 named ones Play macro by selecting it from Macro menu Options in the Macros menu –Record (Ctrl+Shift+R) –Pause –Playback (Ctrl+R) –Multi-play (Ctrl+F7) –Save –User Macro

61 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux61 The TextPad Configure Menu TextPad may be configured to support your needs Menu options –Block Select Mode: set block (column) mode –Word Wrap: set word-wrapping mode (Ctrl+Q,W) –Read Only: make document read-only or editable –Synchronize Scrolling: set synchronized scrolling mode –Enable Undo: enable or disable ability to undo edits –New Document Class: create a document class –Preferences: open Preferences dialog (Ctrl+Q,P)

62 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux62 The TextPad Window Menu Multiple-document interface (MDI) –Edit multiple files at the same time –Copy and paste text among files Menu options –Split: split the active window into two or four panes –Tile Horizontally: arrange windows horizontally –Tile Vertically: arrange windows vertically –Cascade: overlap multiple windows –Arrange Icons: arrange icons for minimized windows –Search Results: switch to results of the last search –Command Results: capture output from Run

63 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux63 The TextPad Help Menu Obtain information about a task Menu options –Help Topics: display the opening screen of Help –Technical Support: submit a problem report –Frequently Asked Questions: list of FAQs –TextPad on the Web: open page at www.textpad.com –Enter License Code: enter your registration code –Ordering Information: read purchase information –Tip of the Day: display a TextPad tip –About TextPad: display license details and resources

64 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux64 Vim File Options Save and Save As options are similar –Execute both with the :w command –Provide a filename with the Save As option Some menu options used in Edit mode –:e filename: creates a file –:print: displays the text at the cursor –:q: closes a file –:exi or :xit: exits only when changes have been made

65 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux65 Vim Edit Options Many similarities to commands in DOS Edit One difference with DOS Edit –No explicit command for copying text You can copy in both Edit mode and Visual mode Some Vim editing commands used in Edit mode –#x: used to cut one or more letters –P or p: paste cut or copied text

66 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux66 Vim Search Options Practice using unfamiliar search commands Some Vim search commands used in the Edit mode –??pattern: searches backward in file for the pattern –//pattern: searches forward in the file for the pattern –r or R: type “r” or “R” to type over text

67 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux67 Vim View Options View two programs by splitting the screen –Useful when programming with multiple files

68 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux68 Vim Editor Options Not as easy to access as those in other editors Background option often used to darken background Viewing available editor options –Type :set at command line in Edit mode –Use help system to learn more about commands

69 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux69 Vim Help Options Accessing the main help screen –Press Esc to go to Edit mode –Type :help Access short pages of help information –Position cursor between a pair of subject bars (|) –Pressing Ctrl+] Accessing help directly (bypassing the main menu) –Type :help and then a command –Type :help plus the name of a topic; e.g., “tutor”

70 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux70 Vim Help Options (continued)

71 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux71 Summary Three functionally similar text editors: DOS Edit, Vim, Textpad Basic editor capabilities: creating, editing, saving files Three text editors allow manipulation of multiple files Cut and copy operations place text in an edit buffer Paste operation removes text from edit buffer, places text in document

72 Guide to Parallel Operating Systems with Microsoft Windows XP and Linux72 Summary (continued) TextPad uses Windows Clipboard as edit buffer Use search features to locate information quickly Find text in an entire document or particular line Regular expressions enhance search-and-replace operations Use wildcards and magic characters in incomplete search strings


Download ppt "Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 6 Text Editors."

Similar presentations


Ads by Google