1 / 51

Introduction to the gedit editor

Introduction to the gedit editor. gedit: the Gnome editor . Gnome: . Gnome is a freely available (i.e., no cost) desktop environment for the UNIX system The Gnome project website: http://www.gnome.org/ The computers in the MathCS lab are using Gnome. gedit: the Gnome editor (cont.).

alban
Télécharger la présentation

Introduction to the gedit editor

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to the gedit editor

  2. gedit: the Gnome editor • Gnome: • Gnome is a freely available (i.e., no cost)desktop environment for the UNIX system • The Gnome project website: http://www.gnome.org/ The computers in the MathCS lab are using Gnome

  3. gedit: the Gnome editor (cont.) • gedit: • gedit = the official text editor of the GNOME desktop environment. • (Editor = a computer application that let users edit computer files)

  4. Before we start.... • This webnote is not a full training in using gnome It is mean to get you started. You will learn additional features through word-of-mouth from lab assistants and fellow students in the MathCS lab • The best way to learn how to use a program is ask someone that knows it So: when you work in the MathCS lab and don't know how to do something, go ask the lab assistant !

  5. What you will be learning to do with gnome • Run the gedit application • Create a new file • Insert text into the file • Delete text from the file • Go to a certain line in the file • Search for a pattern in the file • Search and replace for a pattern with another pattern in the file • Undo a change • Save your work • Quitwithout saving (because you made a mess)... • Things you need to learn to get started with gedit:

  6. Running the gedit application • Run gedit by entering this command in a shell window (terminal): The UNIX prompt can be different for different users (it's user settable) UNIX prompt >> gedit

  7. Applications that are attached and detached from the terminal • Attached and detached: • An application be attached or detached from the terminal • When an application is attached to the terminal, you can interact with that application through the keyboard • In other words: the attached application will receive the keystrokes you enter through the keyboard • When an application is detached to the terminal, you cannot interact with that application through the keyboard • In other words: the attached application will not receive the keystrokes you enter through the keyboard

  8. Applications that are attached and detached from the terminal (cont.) Example (demo): • Run gedit from a terminal window • When you see the gedit window, click on the terminal window (to get the input focus) • Type control-C (hold the control-key and press C) This will kill the running application (in most cases)

  9. Applications that are attached and detached from the terminal (cont.) • We can kill the gedit application because the application was attached • In other words, the gedit applicationreceives the control-C through the keyboard (and got killed)

  10. Running applications in the detached manner • You can run any applications in UNIX in the detached manner by appending the "&" character at the end of the command Example: running gedit in detached manner You will see the gedit window UNIX prompt >> gedit &

  11. Running applications in the detached manner (cont.) • Difference: • You can enter more commands in the terminal window • The keystrokes that you enter in the terminal window will be executed by the shell application • Type control-C (hold the control-key and press C) in the terminal window • This will not affect the gedit application • (Because the gedit application is not receiving input from the keyboard in the detached state)

  12. Computer Science jargon: background process • Terminology: • An application running in the detached manner is said to run in the background • A background process is an program (application) that is running in the detached mode

  13. Creating a new file (document) with gedit • How to get a new (blank) file in gedit: • Click on the File tab • Then click on the New tab

  14. Creating a new file (document) with gedit (cont.) • You will see a new tab corresponding to a file named Untitled 1:

  15. Keyboard shortcuts • Keyboard shortcuts are operations that are entered through key stroke (on the keyboard)

  16. Keyboard shortcuts (cont.) • The keyboard shortcut for new file is control-N See: • Example:

  17. Keyboard shortcuts (cont.) When you type control-N in the gedit window, you will also get a new (black) document)

  18. Inserting text in the file • How to insert text in the document • Click at the location where the text is to be insert • Type in the text

  19. Insert text by copy and paste • You can insert text from another window into the document in gedit by using the copy and paste facility: • Highlight any text in a window (e.g., from a webpage) by: • Left click on the first character of the text • Hold the mouse button and drag the mouse to the last character of the text • Release the mouse button • The highlighted text is automatically copied in UNIX • (On a Windows-based PC, you need to type control-C to copy) • Now click in the gedit window at the position where you want to insert the highlighted text • Type control-V (for paste)

  20. Deleting text from a file • How to delete text from a file: • Highlight the text in gedit that you want to delete • Press the delete key

  21. Replacing some text • How to replace text: • Delete the text • Insert new text

  22. Goto a certain line in the file • A feature that is very useful when you write computer programs is: • That is because compilers (an application that translates a program written in a high level language into machine code) always report an error along with the location (as a line number) in the file. • Goto a certain line in a file

  23. Goto a certain line in the file (cont.) • How to go to line number n in a file: 1. Left click on the Search tab 2. Then left click on the Go to Line tab

  24. Goto a certain line in the file (cont.) Example: After this, a window will pop up and you can enter the desired line number

  25. Goto a certain line in the file (cont.) • Keyboard shortcut: • The keyboard shortcut for the Go to Line function is control-I

  26. Search for a text pattern • Finding the first occurrence of a pattern in a file: 1. Left click on the Search tab 2. Then left click on the Find tab

  27. Search for a text pattern (cont.) • Example After this, a window will pop up and you can enter the search text pattern

  28. Search for a text pattern (cont.) • Keyboard shortcut: • The keyboard shortcut for the Find First function is control-F

  29. Search for a text pattern - continued • Finding the next occurrence of a pattern in a file: 1. Left click on the Search tab 2. Then left click on the Find Next tab

  30. Search for a text pattern – continued (cont.) Example:

  31. Search for a text pattern – continued (cont.) • Keyboard shortcut: • The keyboard shortcut for the Find Next function is control-G

  32. Search and Replace • Finding the next occurrence of a text pattern in a file and replace it with some other pattern: 1. Left click on the Search tab 2. Then left click on the Replace tab

  33. Search and Replace (cont.) Example:

  34. Search and Replace (cont.) 3. You will see the following pop up window: Enter in the Search for area, the text you want to replace Enter in the Replace with area, the new text 4. Then press the Find button

  35. Search and Replace (cont.) • If the "Search for" text was found, gedit will stop and let you replace the found text. Press the Replace button to replace the text:

  36. Search and Replace (cont.) If you do not want to replace a particular occurrence of the matched pattern, then press the Find button (located to the right of the Replace button) Gedit will then move to the next matching pattern.

  37. Search and Replace (cont.) After the replace operation, gedit will find the next occurrence and ask you if you want to replace Press Close to stop the Search and Replace operation

  38. Search and Replace (cont.) • Keyboard shortcut: • The keyboard shortcut for the Find Next function is control-R

  39. Undo a change • When you make a edit mistake, you can undo the last change with the undo-command: • Undo earlier changes: • control-Z • You can undo earlier changes by pressing control-Z multiple time • The maximum number of changes can be undo is 25

  40. Undo a change (cont.) • Changing the maximum number of undo's: • Click on the Edit tab • Then click on Preferences tab.

  41. Undo a change (cont.) • A window will pop up Change the value in the Limit to field: Click Close when you're done.

  42. Undo an "undo" • Suppose you have undone a change that was in fact correct • You can undo an undo operation using: • shift-control-Z (this is called a Redo operation)

  43. Saving your work • Left click on the File button • Then Left click on the Save button • If your file does nothave a file name, you will be prompted to enter a name • Saving your document:

  44. Saving your work (cont.) • Saving your document under a new filename: • Left click on the File button • Then Left click on the Save As button

  45. Saving your work (cont.) • A new window will pop up: Enter a new filename and press Save

  46. Quit the edit session without saving any changes made • If you made a severe error that cannot be easily undone --- (and you have not save the changes yet) --- you can quit the gedit application without saving as follows:

  47. Quit the edit session without saving any changes made (cont.) • Left click on the File button • Then Left click on the Quit button:

  48. Quit the edit session without saving any changes made (cont.) • A new window will pop up: • Press the Don't Save button to discard the changes made • Do not press the Save button (or else, your file will be updated with the mistakes !!!)

  49. Make backups of your files • Advice: • Make copies of your projects regularly • Especially, when you have reach a milestone in your project

  50. Make backups of your files (cont.) • Suggestion on how to organize your backup files: • Each student has a project directory for this course named cs170 The cs170 project directory is located inside your home directory • Make a directory named backup inside your cs170 project directory • Put backup copies of your project files inside this backup directory

More Related