The gedit application is a simple text editor. You can use gedit to create and edit text files. You can use gedit plugins to perform a variety of tasks related to text-editing from within the gedit window.
You can start gedit in the following ways:
- Applications menu
Choose Accessories->Text Editor.
- Command line
Type gedit, then press Return.
When you start gedit, the following window is displayed:
The gedit window contains the following elements:
- Menubar
The menus on the menubar contain all of the commands you need to work with files in gedit.
- Toolbar
The toolbar contains a subset of the commands that you can access from the menubar.
- Display area
The display area contains the text of the file that you are editing.
- Statusbar
The statusbar displays information about current gedit activity and contextual information about the menu items.
When you right-click in the gedit window, the application displays a popup menu. The popup menu contains the most common text editing commands.
To open a file, choose File->Open to display the Open File dialog. Select the file that you want to open, then click OK. The file is displayed in the gedit window.
You can open multiple files in gedit. The application displays one file at a time in the application window. The application adds a tab for each open file to the window. To display another open file, click on the tab that corresponds to the file. To create a new gedit window for each file that is open, drag the tab corresponding to each file to the desktop. You can also use the Documents menu to move between the open files.
The application records the paths and filenames of the last four files that you edited and displays the files as menu items on the File->Recent Files menu.
You can run gedit from a command line and open a single file or multiple files. To open multiple files from a command line, type the following command, then press Return:
gedit file1.txt file2.txt file3.txt
When the application starts, the files that you specified are displayed in the gedit window.
To create a new file, choose File->New. The application displays a new file in the gedit window.
You can save files in the following ways:
To save changes to the current file, choose File->Save or click Save on the toolbar. If the file does not have a filename, gedit displays the Save As dialog. Enter a name for the file in the Save As dialog, then click OK.
To save a new file or to save an existing file under a new filename, choose File->Save As. Enter a name for the file in the Save As dialog box, then click OK.
To save all of the files that are currently open in gedit, choose File->Save All.
You can edit the text of a file in the following ways:
Type new text from the keyboard.
Use the Delete key to delete text.
Use the Cut, Copy, Paste, and Delete menu items to edit text.
When you select text with the mouse, gedit automatically copies the selected text to a buffer. You can perform any of the following actions on the selected text:
To delete the selected text from the file and move the selected text to a buffer, choose Edit->Cut.
To permanently delete the selected text from the file, choose Edit->Delete.
To insert the contents of the buffer at the cursor position, middle-click or choose Edit->Paste. You must cut or copy text before you can paste text into the file.
To select all of the text in a file, choose Edit->Select All.
To undo an edit, choose Edit->Undo. To redo an edit, choose Edit->Redo. The number of previous edits that you can undo is determined by the Set limit on undo levels to setting in the the section called “Undo” tabbed section of the Preferences dialog. By default, the number of actions that you can undo is 25.
To search a file for a string, perform the following steps:
Choose Search->Find to display the Find dialog.
Type the string that you want to find in the Search for field.
Select one of the following options:
Search from the beginning of the document
Search from the cursor position
Select the Case sensitive option to only find occurrences of the string that match the case of the text that you type.
Click Find to search the file for the first occurrence of the string. If gedit finds the string, the application moves the cursor to the string, and selects the string.
To find the next occurrence of the string, click Find Next.
To finish the search, click Close.
To search a file for a string, and replace the string with an alternative string, perform the following steps:
Choose Search->Replace to display the Replace dialog.
Type the string that you want to find in the Search for field.
Type the string that you want to use to replace the string that you find in the Replace with field.
Select one of the following options:
Search from the beginning of the document
Search from the cursor position
Select the Case sensitive option to only find occurrences of the string that match the case of the text that you enter.
Click Find to search the file for the first occurrence of the string. If gedit finds the string, the application moves the cursor to the string, and selects the string.
Click on Replace to replace the occurrence of the string with the text that you typed in the Replace with field. Click on Replace All to replace all occurrences of the string.
To find the next occurrence of the string, click Find Next.
To finish the search, click Close.
To open a file from a Uniform Resource Identifier (URI), perform one of the following steps:
Choose File->Open Location to display the Open from URI dialog. Enter the URI of the file that you want to open, then click Open.
Type gedit http://... at a command line, where http://... is the URI of the file that you want to open, then press Return.
The application opens the file located at the URI in readonly mode.
You can use gedit to pipe the output of a command to a text file. For example, to pipe the output of an ls command to a text file, type the following command, then press Return:
ls | gedit
The output of the ls command is displayed in a new text file in the gedit window.
Alternatively, you can use the Shell Output plugin to pipe command output to the current file. To use the Shell Output plugin, perform the following steps:
Load the Shell Output plugin. See the section called “To Load gedit Plugins” for information about how to load a plugin.
Choose Edit->Insert Shell Output to display the Shell output dialog.
Type the shell command that you want to execute in the Shell command field.
Edit the Working directory field if necessary. By default, the Shell Output plugin executes the command you specify in the current directory.
Click Run. The Shell Output plugin executes the command and inserts the text output into the current file.
To go to a specific line in the current file, perform the following steps:
Choose Search->Goto Line to display the Goto line dialog.
Type the number of the line that you want to move the cursor to in the Line number field.
Click Goto line. The application moves the cursor to the line number that you specify.
To change the input mode, right-click in the text window, then select Input Methods. The Insert Unicode control character menu item provides character layout options that are useful for working with non-Latin character sets.
You can use gedit to perform the following print operations:
Print a file to a printer.
Print the output of the print command to a file.
If you print to a file, gedit sends the output of the file to a pre-press format file. The most common pre-press formats are PostScript and Portable Document Format (PDF).
To preview the pages that you want to print, choose File->Print Preview to display the gedit - Print Preview dialog.
To print the current file to a printer or a file, choose File->Print to display the Print dialog.
The Print dialog allows you to specify the following print options:
- Print range
Select one of the following options to determine how many pages to print:
All
Select this option to print all of the pages in the file.
Selection
Select this option to print the selected text only. This option is only available if you selected text.
Default: All.
- Copies
Use this spin box to specify the number of copies of the file that you want to print.
Default: 1.
- Collate
If you are printing multiple copies of the file, select this option to collate the printed copies.
Default: unselected.
- Printer
Use this drop-down list box to select the printer to which you want to print the file.
Default: Gnome default printer.
- Settings
Use this drop-down list box to select the printer settings. To configure the printer, click Configure.
Default: Default.
- Location
Use this drop-down list box to select the print destination. To print the file to a printer, choose lpr. To print the file to a print file, choose File. If you select File, type the name of the output file in the text box provided.
Default: lpr.
- Paper size
Use this drop-down list box to select the size of the paper to which you want to print the file.
Default: A4.
- Width
Use this spin box to specify the width of the paper. Use the Centimeters drop-down list box to change the measurement unit for specifying the paper size.
Default: 21.00 centimeters.
- Height
Use this spin box to specify the height of the paper.
Default: 29.70 centimeters.
- Page orientation
Use this drop-down list box to select the page orientation.
Default: Portrait.
- Layout
Use this drop-down list box to select the page layout. A preview of each layout that you select is displayed in the Preview area.
Default: Plain.
A plugin is a supplementary program that enhances the functionality of an application. The gedit plugins enable you to perform a variety of functions related to text editing from within the gedit window. The following table lists the plugins that are available.
Plugin Name | Purpose |
---|---|
ASCII table | Displays a dialog that contains an ASCII table. You can use the ASCII table to insert characters into a file. |
Compare files | Compares two files and displays the differences between the files in a new gedit window. This plugin uses the diff program to compare the files. |
CVS ChangeLog | Opens the log messages associated with CVS commit commands. |
Insert Date/Time | Inserts the current date and time into a file. |
Shell Output | Inserts the text output of a shell command into a file. |
Tag list | Displays a dialog that contains a list of common tags. You can use the dialog to insert a tag into a file. |
User name | Inserts the username of the current user into the file. |
Word count | Counts the number of lines, words, characters with spaces, characters without spaces, and bytes in the current file. The plugin displays the results in a Word count window. |
To load gedit plugins, choose Edit->Plugin Manager. The Plugin Manager dialog displays the following information:
A list of the plugins that are available.
A Configure plugin button. You can use this button to open a configuration dialog for the plugins that you can configure.
A brief description of each plugin. To display a description, select the plugin from the list of plugins.
Details about the author of the plugin and the name of the module.
To load a plugin, select the check box next to the name of the plugin. The gedit application adds the plugin to the appropriate gedit menu, as described in the following table.
Plugin Name | Added to Menu |
---|---|
ASCII table | View->ASCII Table |
Compare files | File->Compare files |
CVS ChangeLog | File->Open CVS ChangeLogs |
Word count | Search->Word Count |
Shell Output | Edit->Insert Shell Output |
Tag list | Edit->Tag List |
Insert Date/Time | Edit->Insert Date/Time |
User name | Edit->Insert User Name |
To remove a plugin, deselect the check box next to the name of the plugin.
To close the Plugin Manager dialog, click Close.
To display or hide the toolbar, choose View->Toolbar. To customize how gedit displays the toolbar, choose View->Customize Toolbar, then select one of the following menu items:
Desktop Default: display the default toolbar.
Icon: display icons only.
Icon and Text: display icons and text.
To display or hide the statusbar, choose View->Statusbar. To customize how gedit displays the statusbar, choose View->Customize Statusbar, then select one of the following menu items:
Show Cursor Position: display the line number and column number where the cursor is located.
Default: selected.
Show Overwrite Mode: display the editing mode. If the editor is in insert mode, the statusbar contains the word INS. If the editor is in overwrite mode, the statusbar contains the word OVR.
Default: selected.
To configure gedit, choose Edit->Preferences.
The Preferences dialog contains the following categories:
The Editor category is subdivided into the following subcategories:
- Use default theme font
Select this option to use the default system font for the text in the gedit text window.
Default: unselected.
- Font used by the editor
This field displays the font that gedit uses to display text. Click on the button to specify the font type, style, and size to use for text.
Default: Courier Medium 12 point.
- Use default theme colors
Select this option to use the default theme colors in the gedit text window.
Default: selected.
- Text color
Click on the Text color button to display the color selector dialog. Select a color to use to display text in the gedit text window.
Default: black.
- Background color
Click on the Background color button to display the color selector dialog. Select a background color for the gedit text window.
Default: white.
- Selected text color
Click on the Selected text color button to display the color selector dialog. Select a color to use to display selected text.
Default: white.
- Selection color
Click on the Selection color button to display the color selector dialog. Select a background color to use to highlight a text selection.
Default: blue.
- Set tabs width equivalent to
Use this spin box to specify the width of the space that gedit inserts when you press the Tab key.
Default: 8 characters.
- Wrap mode
Select one of the following options to determine how gedit wraps text in the gedit window:
Never wrap lines
Select this option to never wrap lines. The text that you type is displayed in one line until you press Return.
Wrap lines at word boundaries
Select this option to wrap text onto the next line, at a word level, when you reach the text window boundary.
Wrap lines at character boundaries
Select this option to wrap text onto the next line, at a character level, when you reach the text window boundary.
Default: Wrap lines at character boundaries.
- Display line numbers
Select this option to display lines numbers on the left side of the gedit window.
Default: unselected.
- Create a backup copy of files before saving
Select this option create a backup copy of a file each time you save the file. The backup copy of the file has a .bak extension.
Default: unselected.
- Autosave current file every
Select this option to automatically save the current file at regular intervals. Use the spin box to specify the interval at which you want to save the file.
Default: unselected, 10 minutes.
- When saving
Select one of the following save options:
Always use UTF-8 encoding (faster)
Select this option to save files using UTF-8 bit encoding.
Use current locale when possible
Select this option to save files using the current locale. You can set up locales for different input methods.
Use current locale only if the file already uses it
Select this option to save a file using the current locale if the file was already saved in the current locale.
Default: Always use UTF-8 encoding (faster)
The Print category is subdivided into the following subcategories:
- Print page headers
Select this option to include a header on each page that you print. You can not configure the header.
Default: selected.
- Wrap lines (at character boundaries)
Select this option to automatically wrap text at a character level when you print a file. The application counts wrapped lines as one line for line numbering purposes.
Default: selected.
- Print line numbers every
Select this option to include line numbers when you print a file. Use the spin box to specify how often to print the line numbers, for example every 5 lines, every 10 lines, and so on.
Default: unselected, 1 line.
- Font used to print the body
Click on this button to select the font to use to print the body text of a file.
Default: Courier 9.0.
- Font used to print headers
Click on this button to select the font to use to print the headers in a file.
Default: Helvetica 11.0.
- Font used to print line numbers
Click on this button to select a font to use to print line numbers.
Default: Helvetica 8.0.
To reset the fonts to the default fonts for printing a file from gedit click on the Restore default fonts button.