# Gedit Manual

2002
2003
2004
Sun Microsystems
2000
Eric Baudais
GNOME ドキュメンテーション プロジェクト
Sun Java Desktop System Documentation Team
Sun Microsystems

    gdocteam@sun.com

Eric
Baudais
GNOME ドキュメンテーション プロジェクト

     baudais@okstate.edu

Baris
Cicek 氏より、旧リビジョンの gedit アプリケーションについて情報を提供していただきました。
謝辞
Ajit
George 氏よりプラグインについて情報を提供していただきました。
謝辞
gedit V1.0
2000

Eric Baudais baudais@okstate.edu

GNOME ドキュメンテーション プロジェクト

gedit マニュアル V2.0
2002 年 3 月

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit マニュアル V2.1
2002 年 6 月

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit マニュアル V2.2
2002 年 8 月

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit マニュアル V2.3
2002 年 9 月

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit マニュアル V2.4
2003 年 1 月

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit マニュアル V2.5
2003 年 3 月

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit Manual V2.6
September 2003

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit Manual V2.7
March 2004

Sun GNOME ドキュメンテーションチーム

GNOME ドキュメンテーション プロジェクト

gedit Manual V2.8
July 2006

Sun Java Desktop System Documentation Team

GNOME ドキュメンテーション プロジェクト

gedit Manual V2.9
July 2006

GNOME Documentation Team

GNOME ドキュメンテーション プロジェクト

This manual describes version 2.14.3 of gedit.

## フィードバック

geditアプリケーションまたはこのマニュアルに関してバグやご意見をご報告いただく場合は、『GNOME フィードバックページ』を参照してください。

gedit is the GNOME text editor.

## 概要

The gedit application enables you to create and edit text files.

The aim of gedit is to be a simple and easy to use text editor. More powerful features can be enabled with different plugins, allowing a variety of tasks related to text-editing.

## 基本的な使用方法

### Starting gedit

以下の方法でgeditを起動してください。

Applications menu

  Choose Accessories Text Editor.

コマンドライン

  次のコマンドを実行します。 `gedit`

By default, when you open a text document in the file manager, gedit will start, and display the document.

### The gedit Window

gedit の起動時には、次のウィンドウが表示されます。

#### gedit ウィンドウ

gedit のメインウィンドウを表示。

gedit ウィンドウの構成要素は次のとおりです。

メニューバー

  メニューバー上のメニューには、gedit でファイルを操作するために必要なコマンドがすべて含まれています。

ツールバー

  ツールバーには、メニューバーからアクセスできるコマンドのサブセットが含まれています。

表示領域

  表示領域には、編集中のファイルのテキストが表示されます。

ステータスバー

  The statusbar displays information about current gedit activity and contextual information about the menu items. The statusbar also displays the following information:

  - Cursor position: the line number and column number where the cursor is located.

  - Edit mode: If the editor is in insert mode, the statusbar contains the text INS. If the editor is in overwrite mode, the statusbar contains the text OVR. Press the Insert key to change edit mode.

Side Pane

  The side pane displays a list of open documents, and other information depending on which plugins are enabled.

  By default the side pane is not shown. To show it, choose View Side Pane.

Bottom Pane

  The bottom pane is used by programming tools such as the Python Console plugin to display output. It is not shown by default.

gedit ウィンドウ内を右クリックすると、ポップアップメニューが表示されます。 ポップアップメニューから、使用頻度の高いテキスト編集コマンドにアクセスできます。

Like other GNOME applications, actions in gedit can be performed in several ways: with the menu, with the toolbar, or with shortcut keys. Shortcuts keys common to all applications are listed in the User Guide.

### Running gedit from a Command Line

コマンドラインから gedit を起動し、単一のファイル、または複数のファイルを開くことができます。 コマンドラインから複数のファイルを開くには、次のコマンドを入力して Return キーを押します。

`gedit file1.txt file2.txt file3.txt`

アプリケーションが起動し、gedit ウィンドウ内に指定のファイルが表示されます。

For more information on how to run gedit from a command line, see the unix manual page for gedit, gedit 1.

## Working with Files

### Creating a New Document

To create a new document, choose File New. The application displays a new blank document in the gedit window.

### Opening a File

To open a file, choose File Open to display the Open File dialog. Select the file that you want to open, then click Open. The file is displayed in the gedit window.

The application records the paths and filenames of the five most recent files that you edited and displays the files as menu items on the File menu. You can also click on the Shows Recent Files menu icon. icon on the toolbar to display the list of recent files.

You can open multiple files in gedit. The application adds a tab for each open file to the window. For more on this see .

### Saving a File

ファイルの保存方法は次のとおりです。

- To save changes to an existing file, choose File Save.

- 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, then click Save.

- gedit で現在開いている全ファイルを保存するには、「ドキュメント」「すべてを保存」を選択します。

To close all of the files that are currently open in gedit, choose Documents Close All .

### Opening a File from a URI

To open a file from a Uniform Resource Identifier (URI), perform the following steps:

1. Choose File Open Location to display the Open Location dialog.

2. Enter the URI of the file that you want to open.

3. Use the Character coding drop-down list to select the appropriate character coding.

4. Click Open.

Alternatively, type `gedit URI` at a command line, where URI is the URI of the file that you want to open, then press Return. Valid types of URI include `http:`, `ftp:`, `file:`, and all of the methods supported by `gnome-vfs`.

指定の URI のファイルが読み取り専用モードで開きます。

### Working With Tabs

When more than one file is open, gedit shows a tab for each document above the display area. To switch to another document, click on its tab.

To move a document to another gedit window, drag the tab corresponding to the file to the window you want to move it to.

To move a document to a new gedit window, either drag its tab to the desktop, or choose Documents Move to New Window .

## Working with Text

### Editing Text

ファイルのテキストを編集する方法は次のとおりです。

- Type new text from the keyboard. The blinking insertion cursor marks the point where new text appears. To change this, use the arrow keys on the keyboard or click with the mouse.

- To copy the selected text to the clipboard, choose Edit Copy .

- To delete the selected text from the file and move the selected text to the clipboard, choose Edit Cut .

- 選択したテキストをファイルから永久に削除するには、「編集」「削除」を選択します。

- To insert the contents of the clipboard at the cursor position, choose Edit Paste . You must cut or copy text before you can paste text into the file, either from gedit or another application.

- ファイル内のすべてのテキストを選択するには、「編集」「すべて選択」を選択します。

### Undoing and Redoing Changes

To undo a change you have made, choose Edit Undo . To reverse this action, choose Edit Redo . The number of previous edits that you can undo is determined by the Undo limit setting in the Editor tabbed section of the Preferences dialog: see .

### Positioning the Cursor on a Specific Line

カーソルを現在のファイルの指定行へ移動するには、次の手順を実行します。

1. 「検索」「指定行へ移動」を選択して「指定行へ移動」ダイアログを表示します。

2. 「行番号」フィールドにカーソルの移動先の行番号を入力します。

3. 「指定行へ移動」をクリックします。 指定の行にカーソルが移動します。

4. 「指定行へ移動」ダイアログを閉じるには、「閉じる」をクリックします。

## Finding and Replacing

In gedit, there are two ways of searching for text. You can use the Find dialog to search for a specific piece of text, or Incremental Search to highlight matching text as you type it.

### Finding Text

To search a file for a string of text, perform the following steps:

1. 「検索」「検索」を選択して「検索」 ダイアログを表示します。

2. Type the string that you want to find in the Search for field. You can include special characters such as a new line or tab: see .

3. Click Find to search the file for the first occurrence of the string after your current curosr position. If gedit finds the string, the application selects first occurrence of the string. Other occurrences of the string are highlighted.

4. To find the next occurrence of the string, click Find or choose Search Find Next . To find the previous occurrence of the text, choose Search Find Previous .

After you have closed the Find dialog, you can still move the selection to other occurrences of the text by choosing Search Find Next and Search Find Previous .

To remove the highlighting from the text, choose Search Clear Highlight .

### Incremental Search

Incremental search highlights matching text in the document as you type it letter by letter. (This is similar to the search feature in several web browsers.)

To start an incremental search, choose Search Incremental Search . The search box appears at the top of the display area.

Begin typing, and text that matches will be highlighted in the document. The first instance after the cursor position is also selected. To advance the selection to the next match while keeping the incremental search box open, press CtrlG.

### Replacing Text

ファイル内の特定の文字列を別の文字列に置換するには、次のようにします。

1. 「検索」「置換」を選択して「置換」 ダイアログを表示します。

2. Type the string that you want to find, in the Search for field. You can include special characters such as a new line or tab: see .

3. 「置換」フィールドに置換後の文字列を入力します。

To examine each occurrence of the string before replacing it, click Find. If gedit finds the string, the application selects the string. Click Replace to replace the selected occurrence of the string. To find the next occurrence of the string, click Find again.

To replace all occurrences of the string throughout the document, click Replace All.

### Find and Replace Options

The Find dialog and the Replace dialog both have the following options:

- Select the Match case option to only find occurrences of the string that match the case of the text that you type. For example, with Match case selected, "TEXT" will not match "text".

- Select the Match entire word only option to only find occurrences of the string that match the entire words of the text that you type. For example, with Match entire word only selected, "text" will not match "texture".

- Select the Search backwards option to search backwards towards the beginning of the document.

- Select the Wrap around option to search to one end of the document and then continue the search from the other end of the file.

### Special Characters

You can include the following escape sequences in the text to find or replace to represent special characters:

`\n`

  Specifies a new line.

`\t`

  Specifies a tab character.

`\r`

  Specifies a carriage return.

## Printing

### Setting the Page Options

To set the page options, choose File Page Setup to display the Page Setup dialog.

The Page Setup dialog enables you to specify the following print options:

#### General Tabbed Section

Print syntax highlighting

  Select this option to print syntax highlighting. For more information about syntax highlighting, see .

「ページヘッダーを印刷」

  印刷するページごとにヘッダーを追加したい場合に選択します。 ヘッダーを設定することはできません。

「行番号」

  Select the Print line numbers option to include line numbers when you print a file.

  Use the Number every ... lines spin box to specify how often to print the line numbers, for example every 5 lines, every 10 lines, and so on.

Text Wrapping

  Select the Enable text wrapping option to wrap text onto the next line, at a character level, when you print a file. The application counts wrapped lines as one line for line numbering purposes.

  Select the Do not split words over two lines option to wrap text onto the next line, at a word level, when you print a file.

#### フォント

「Body」

  このボタンをクリックして、ファイルの本体テキストの印刷に使用するフォントを選択します。

「行番号」

  Click on this button to select the font to use to print line numbers.

Headers and footers

  Click on this button to select the font to use to print the headers and footers in a file.

To reset the fonts to the default fonts for printing a file from gedit, click Restore Default Fonts.

### Printing a Document

gedit を使って、次の印刷操作を実行できます。

- Print a document to a printer.

- 印刷コマンドの実行結果をファイルに出力

ファイルに出力する場合、その内容は印刷用のフォーマットで送信されます。最も一般的なフォーマットは、PostScript と PDF (Portable Docum ent Format) です。

出力するページをプレビューするには、 「ファイル」「印刷プレビュー」を選択します。

現在のファイルをプリンタまたはファイルに出力するには、「ファイル」「印刷」を選択して、「印刷」ダイアログを表示します。

「印刷」ダイアログでは、次の印刷オプションを指定できます。

#### Job Tabbed Section

「印刷範囲」

  次のいずれかのオプションを選択して、出力するページ数を指定します。

  - 「全て」

    ファイルの全ページを出力します。

  - Lines

    Select this option to print the specified lines only. Use the From and To spin boxes to specify the line range.

  - 「選択」

    選択したテキストだけを出力します。 このオプションは、テキストを選択している場合にのみ有効です。

Copies

  Use the Number of copies spin box to specify the number of copies of the file that you want to print.

  If you print multiple copies of the file, select the Collate option to collate the printed copies.

#### 「プリンタ」タブ付きセクション

Printer

  Use this drop-down list to select the printer to which you want to print the file.

Settings

  Use this drop-down list to select the printer settings.

  To configure the printer, click Configure. For example, you can enable or disable duplex printing, or schedule delayed printing, if this functionality is supported by the printer.

Location

  Use this drop-down list to select one of the following print destinations:

  CUPS

    Print the file to a CUPS printer.

    If the selected printer is a CUPS printer, CUPS is the only entry in this drop-down list.

  lpr

    Print the file to a printer.

  「ファイル」

    Print the file to a PostScript file.

    Click Save As to display a dialog where you specify the name and location of the PostScript file.

  Custom

    Use the specified command to print the file.

    Type the name of the command in the text box. Include all command-line arguments.

State

  This functionality is not supported in this version of gedit.

Type

  This functionality is not supported in this version of gedit.

Comment

  This functionality is not supported in this version of gedit.

#### 「用紙」タブ付きセクション

「用紙サイズ」

  ドロップダウンリストからファイルを出力する用紙のサイズを選択します。

「Width」

  Use this spin box to specify the width of the paper. Use the adjacent drop-down list to change the measurement unit.

「高さ」

  用紙の高さを指定します。

「Feed orientation」

  ドロップダウンリストからプリンタ内の用紙の向きを選択します。

「ページ方向」

  ドロップダウンリストから用紙の向きを選択します。

「レイアウト」

  ドロップダウンリストからページレイアウトを選択します。「プレビュー」領域には、選択した各レイアウトのプレビューが表示されます。

Paper tray

  Use this drop-down list to select the paper tray.

## Programming Features

Several of gedit's features for programming are provided with plugins. For example, the Tag List plugin provides a list of commonly-used tags for different markup languages: see .

### Syntax Highlighting

Syntax highlighting makes source code easier to read by showing different parts of the text in different colors.

gedit chooses an appropriate syntax highlighting mode based on a document's type. To override the syntax highlighting mode, choose View Highlight Mode , then choose one of the following menu items:

Normal

  Do not display any syntax highlighting.

Sources

  Display syntax highlighting to edit source code. Use the Sources submenu to select the source code type.

Markup

  Display syntax highlighting to edit markup code. Use the Markup submenu to select the markup code type.

Scripts

  Display syntax highlighting to edit script code. Use the Scripts submenu to select the script code type.

Others

  Display syntax highlighting to edit other types of code. Use the Others submenu to select the code type.

For more information about how to configure syntax highlighting, see .

### Piping the Output of a Command to a File

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 `ls | gedit`, then press Return.

`ls` コマンドの結果が新しいテキストファイルに出力され、gedit ウィンドウに表示されます。

Alternatively, you can use the External tools plugin to pipe command output to the current file.

## 設定

gedit の設定を行うには、 「編集」「設定」を選択します。「設定」ダイアログには次のカテゴリがあります。

### View Preferences

Text Wrapping

  Select the Enable text wrapping option to have long lines of text flow into paragraphs instead of running off the edge of the text window. This avoids having to scroll horizontally

  Select the Do not split words over two lines option to have the text wrapping option preserve whole words when flowing text to the next line. This makes text easier to read.

「行番号」

  Select the Display line numbers option to display line numbers on the left side of the gedit window.

Right Margin

  Select the Display right margin option to display a vertical line that indicates the right margin.

  Use the Right margin at column spin box to specify the location of the vertical line.

### Editor Preferences

「タブ」

  Use the Tab width spin box to specify the width of the space that gedit inserts when you press the Tab key.

  Select the Insert spaces instead of tabs option to specify that gedit inserts spaces instead of a tab character when you press the Tab key.

Auto Indentation

  Select the Enable auto indentation option to specify that the next line starts at the indentation level of the current line.

File Saving

  Select the Create a backup copy of files before saving option to create a backup copy of a file each time you save the file. The backup copy of the file contains a ~ at the end of the filename.

  Select the Autosave files every ... minutes option to automatically save the current file at regular intervals. Use the spin box to specify how often you want to save the file.

「元に戻す」

  Select the Limit to ... actions option to set a limit on the number of editing actions that you can undo. Use the spin box to specify the maximum number of actions that you can undo.

  Select the Unlimited undo option to set no limit on the number of editing actions that you can undo.

### Font & Colors Preferences

Font

  Select the Use default theme font option to use the default system font for the text in the gedit text window.

  The Editor font 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.

Colors

  Select the Use default theme colors option to use the default theme colors in the gedit text window.

  Click on the Normal text color color button to display the color selector dialog. Select a color to use to display normal text in the gedit text window.

  Click on the Background color color button to display the color selector dialog. Select a background color for the gedit text window.

  Click on the Selected text color color button to display the color selector dialog. Select a color to use to display selected text.

  Click on the Selection color color button to display the color selector dialog. Select a background color to use to highlight a text selection.

### Syntax Highlighting Preferences

Enable syntax highlighting

  Select this option to highlight the syntax of the text that you edit.

Highlight mode

  Use this drop-down list to select a syntax mode to configure.

Elements

  Use this list box to select a syntax element to configure.

Format buttons

  Use the following buttons to change the format of the selected syntax element:

  ボタン | Format
  --- | ---
  Shows icon for bold format. | Bold
  Shows icon for italic format. | Italic
  Shows icon for underline. | Underline
  Shows icon for strikethrough. | Strikethrough

Foreground

  Select this option to change the font color of the selected syntax element. Click on the color button to display the color selector dialog, then select the font color.

Background

  Select this option to change the background color of the selected syntax element. Click on the color button to display the color selector dialog, then select the background color.

Reset to Default

  Click on this button to reset the foreground color and background color of the selected syntax element to the default values.

### Plugins Preferences

Plugins add extra features to gedit. For more information on plugins and how to use the built-in plugins, see .

#### Enabling a Plugin

To enable a gedit plugin, perform the following steps:

1. 「編集」「設定」を選択します。

2. Select the Plugins tab.

3. Select the check box next to the name of the plugin that you want to enable.

4. Click Close to close the Preferences dialog.

#### Disabling a Plugin

A plugin remains enabled when you quit gedit.

To disable a gedit plugin, perform the following steps:

1. 「編集」「設定」を選択します。

2. Select the Plugins tab.

3. Deselect the check box next to the name of the plugin that you want to disable.

4. Click Close to close the Preferences dialog.

## プラグイン

### プラグインの使用

You can add extra features to gedit by enabling plugins. A plugin is a supplementary program that enhances the functionality of an application. Plugins add new items to the gedit menus for the new features they provide.

Several plugins come built-in with gedit, and you can install more. The gedit website lists third-party plugins.

To enable and disable plugins, or see which plugins are currently enabled, use the Plugins Preferences.

The following plugins come built-in with gedit:

- Change Case allows you to change the case of the selected text.

- Document Statistics shows the number of lines, words, and characters in the document.

- External Tools allows you to execute external commands from gedit.

- File Browser allows you to browse your files and folders in the side pane.

- Indent Lines adds or removes indentation from the selected lines.

- Insert Date/Time adds the current date and time into a document.

- Modelines allows you to set editing preferences for individual documents, and supports Emacs, Kate and Vim-style modelines.

- Python Console allows you to run commands in the python programming language.

- Snippets allows you to store frequently-used pieces of text and insert them quickly into a document.

- Sort arranges selected lines of text into alphabetical order.

- Spell Checker corrects the spelling in the selected text, or marks errors automatically in the document.

- Tag List lets you insert commonly-used tags for HTML and other languages from a list in the side pane.

- User Name inserts the username of the current user into the document.

### Change Case Plugin

The Change Case plugin changes the case of the selected text.

The following items are added to the Edit menu when the Change Case plugin is enabled:

Menu Item | Action | Example
--- | --- | ---
「編集」 Change Case All Upper Case | Change each character to uppercase. | `This text` becomes `THIS TEXT`
「編集」 Change Case All Lower Case | Change each character to lowercase. | `This Text` becomes `this text`
「編集」 Change Case Invert Case | Change each lowercase character to uppercase, and change each uppercase character to lowercase. | `This Text` becomes `tHIS tEXT`
「編集」 Change Case Title Case | Change the first character of each word to uppercase. | `this text` becomes `This Text`

### Document Statistics Plugin

The Document Statistics plugin 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 Document Statistics dialog. To use the Document Statistics plugin, perform the following steps:

1. Choose Tools Document Statistics to display the Document Statistics dialog. The Document Statistics dialog displays the following information about the file:

   - 現在の文書の行数

   - 現在の文書の単語数

   - 現在の文書の文字数 (空白を含む)

   - 現在の文書の文字数 (空白を除く)

   - 現在の文書のバイト数

2. You can continue to update the gedit file while the Document Statistics dialog is open. To refresh the contents of the Document Statistics dialog, click Update.

### External Tools Plugin

The External Tools plugin allows you to execute external commands from gedit. You can pipe some content into a command and exploit its output (for example, sed), or launch a predefined command (for example, make).

Use the External Tools Manager to create and edit commands. To run an external command, choose it from the Tools menu.

#### Built-in Commands

The following commands are provided with the External Tools plugin:

Build

  Runs make in the current document's directory.

Directory Listing

  Lists the contents of the current document's directory in a new document.

Environment Variables

  Displays the environment variables list in the bottom pane.

Grep

  Searches for a term in all files in the current document directory, using pattern matching. Results are shown in the bottom pane.

Remove Trailing Spaces

  Removes all spaces from the end of lines in the document.

#### Defining a Command

To add an external command, choose Tools External Tools.

In the External Tools Manager window, click New. You can speficy the following details for the new command:

Description

  This description is shown in the statusbar when the menu command is chosen.

Accelerator

  Enter a keyboard shortcut for the command.

Commands

  The actual commands to be run. Several gedit environment variables can be used to pass content to these commands: see .

Input

  The content to give to the commands (as stdin): the entire text of the current document, the current selection, line, or word.

Output

  What to do with the output of the commands: display in the bottom pane, put in a new document, or place in the current document, at the end, at the cursor position, or replacing the selection or the entire document.

Applicability

  Determines which sort of documents can be affected by the command, for example whether saved or not, and local or remote.

#### Variables

You can use the following variables in the Commands field of the command definition:

- GEDIT_CURRENT_DOCUMENT_URI

- GEDIT_CURRENT_DOCUMENT_NAME

- GEDIT_CURRENT_DOCUMENT_SCHEME

- GEDIT_CURRENT_DOCUMENT_PATH

- GEDIT_CURRENT_DOCUMENT_DIR

- GEDIT_DOCUMENTS_URI

- GEDIT_DOCUMENTS_PATH

### File Browser Plugin

The File Browser Plugin shows your files and folders in the side pane, allowing you to quickly open files.

To view the File Browser, choose View Side Pane and then click on the tab showing the File Browser icon at the bottom of the side pane.

#### Browsing your Files

The File Browser tab initially shows your file manager bookmarks. To browse the contents of any item, double-click it.

To show a parent folder, choose from the drop-down list, or press the up arrow on the File Browser's toolbar.

To show the folder that contains the document you are currently working on, right-click in the file list and choose Set root to active document.

#### Opening a File

To open a file in gedit, double-click it in the file list.

#### Creating Files and Folders

To create a new, empty text file in the current folder shown in the browser, right-click in the file list and choose New File.

To create a new folder in the current folder shown in the browser, right-click in the file list and choose New Directory.

### Indent Lines Plugin

The Indent Lines plugin adds or removes space from the beginning of lines of text.

To indent or unindent text, perform the following steps:

1. インデントを設定する行を選択します。1 行にインデントを設定したり削除したりするには、その行にカーソルを置きます。場所はどこでも構いません。

2. - To indent the text, choose Edit Indent .

   - To remove the indentation, choose Edit Unindent .

The amount of space used, and whether tab character or space characters are used, depends on the Tab Stops settings in the Editor Preferences: see .

### Insert Date/Time Plugin

The Insert Date/Time plugin inserts the current date and time into a document. To use the Insert Date/Time plugin, perform the following steps:

1. 「編集」「日付/時間を挿入」を選択します。

   If you have not configured the Insert Date/Time plugin to automatically insert the date/time without prompting you for the format, gedit displays the Insert Date and Time dialog. Select the appropriate date/time format from the list. Click Insert to close the Insert Date and Time dialog. gedit inserts the date/time at the cursor position in the current file.

   If you have configured gedit to use one particular date/time format, the Insert Date and Time dialog is not displayed. The date/time is automatically entered at the cursor position in the current file.

#### Configuring the Insert Date/Time Plugin

日付/時間を挿入プラグインを設定するには、次の手順を実行します。

1. 「編集」「設定」を選択します。

2. Select the Plugins tab.

3. 日付/時間を挿入 プラグインを選択します。

4. Click Configure Plugin to display the Configure insert date/time plugin dialog.

5. 次のようにオプションを 1 つ選択します。

   - 日付/時間を挿入するたびに日付/時間の形式を指定する場合は、「Prompt for a format」オプションを選択します。

   - gedit が提供する日付/時間形式の 1 つを毎回使用する場合は、「Use the selected format」オプションを選択後、一覧から適当な形式を選択します。このオプションを選択すると、「編集」「日付/時刻を挿入」を選択しても、日付/時間の形式をたずねるプロンプトは表示されません。

   - カスタマイズした日付/時間形式を毎回使用する場合は、「Use custom format」オプションを選択後、適当な形式をテキストボックスに入力します。カスタム形式の指定方法については、strftime 3を参照してください。このオプションを選択すると、「編集」「日付/時刻を挿入」を選択しても、日付/時間の形式をたずねるプロンプトは表示されません。

6. 「了解」をクリックして、「日付/時間を挿入プラグインの構成」ダイアログを閉じます。

7. 「設定」ダイアログを閉じるには、「閉じる」をクリックします。

### Modelines Plugin

The Modelines plugin allows you to set preferences for individual documents. A modeline is a line of text at the start or end of the document with settings that gedit recognises.

You can override the following preferences with modelines:

- Tab width

- Insert spaces instead of tabs

- Text Wrapping

- Right margin width

The Modelines plugin supports a subset of the options used by other text editors Emacs, Kate and Vim.

#### Emacs Modelines

The first two lines of a document are scanned for Emacs modelines.

The Emacs options for tab-width, indent-tabs-mode and autowrap are supported. For more information, see the GNU Emacs Manual.

#### Kate Modelines

The first and last ten lines a document are scanned for Kate modelines.

The Kate options for tab-width, indent-width, space-indent, word-wrap and word-wrap-column are supported. For more information, see the Kate website.

#### Vim Modelines

The first and last three lines a document are scanned for Vim modelines.

The Vim options for et, expandtab, ts, tabstop, wrap, and textwidth are supported. For more information, see the Vim website.

A current limitation in gedit prevents the last line of a document from being used as a modeline.

### Python Console Plugin

The Python Console Plugin allows you to run commands in the python programming language from gedit. Enabling the plugin adds a tab to the bottom pane. This shows recent output and a command prompt field.

Commands entered into the python console are not checked before they are run. It is therefore possible to hang gedit, for example by entering an infinite loop.

### Snippets Plugin

The Snippets plugin allows you to store frequently-used pieces of text, called snippets, and insert them quickly into a document.

Snippets are specific to the language syntax of the current document. For example, when you are working with an HTML document, you can choose from a list of snippets that are useful for HTML. In addition, some snippets are global, and are available in all documents.

A number of built-in snippets are installed with gedit, which can be modified.

#### Inserting Snippets

To insert a snippet into a document, type its tab trigger and press Tab. A snippet's tab trigger is usually the first few letters of the snippet, or something else that is short and easy to remember.

Alternatively, press CtrlSpace to see a list of snippets you can insert.

#### Adding Snippets

To create a new snippet, do the following:

1. Choose Tools Manage Snippets. The Snippets Manager window opens.

2. The list of snippets is grouped by language. Select the language you want to add a snippet to, or a snippet in that language group. To add a snippet for all languages, choose Global at the top of the list. The syntax of the document you are currently working with is shown by default.

3. Click New. A new snippet appears in the list.

4. Enter the following information for the new snippet:

   Name

     Enter a name for the snippet in the text field within the snippet list. The name of a snippet serves only as a reminder of its purpose. You can change name of a snippet you create by clicking on it in the list.

   Snippet text

     Enter the text of the snippet in the Edit snippet text box. For special codes you can use, see .

     You can switch back to the document window to copy text without closing the Snippets Manager window.

   Tab Trigger

     Enter the tab trigger for the snippet. This is the text that you type before pressing Tab to insert the snippet.

     The tag must be either a single word comprising only letters, or any single character. The Tab trigger will highlight in red if an invalid tab trigger is entered.

   Accelerator

     Type a shortcut key to use for inserting the snippet.

#### Editing and Removing Snippets

To edit a snippet, select it in the list and make changes to its text and activation properties.

To rename a snippet, click it again in the list.

To restore a built-in snippet that you have changed, press Revert.

To remove a snippet, select it in the list and press Remove. You can not remove built-in snippets, only those you have created yourself.

#### Snippet Substitutions

In addition to inserting stored text, a snippet can include customizable text, or mark spaces where you can add text once the snippet is inserted in your document.

You can use the following placeholder codes in snippet text:

Tab placeholders

  `$n` defines a tab placeholder, where `n` is any number from 1 upwards.

  `${n:default}` defines a tab placeholder with a default value.

  A tab placeholder marks a place in the snippet text where you can add extra text after the snippet is inserted.

  To use tab placeholders, insert the snippet as normal. The cursor is placed at the first tab placeholder. Type text, and press Tab to advance to the next tab placeholder. The number in the placeholder code defines the order in which tab advances to each place in the text.

  Press ShiftTab to return to the previous tab placeholder. Pressing Tab when there are no more tab placeholders moves the cursor to the end of the snippet text, or to the end placeholder if it exists.

Mirror placeholders

  A repeated tab placeholder will mirror the placeholder already defined. This allows you to type in text only once that you want to appear several times in the snippet.

End placeholder

  `$0` defines the end placeholder. This allows you to finish working with the snippet with the cursor at a point other than the end of the snippet text.

Environmental variables

  Environmental variable such as `$PATH` and `$HOME` are substituted in snippet text. The following variables specific to gedit can also be used:

  $GEDIT_SELECTED_TEXT

    The currently selected text.

  $GEDIT_FILENAME

    The full filename of the document, or an empty string if the document isn't saved yet.

  $GEDIT_BASENAME

    The basename of the filename of the document, or an empty string if the document isn't saved yet.

  $GEDIT_CURRENT_WORD

    The word at the cursor's location in the document. When this variable is used, the current word will be replaced by the snippet text.

Shell placeholders

  `$(cmd)` is replaced by the result of executing cmd in a shell.

  `$(n:cmd)` allows you to give this placeholder a reference, where n is any number from 1 upwards. Use `$n` to use the output from one shell placeholder as input in another.

Python placeholders

  `$<cmd>` is replaced by the result of evaluating cmd in the python interpreter.

  `$<a:cmd>` specifies another python placeholder as a dependency, where a gives its order in the snippet. This allows you to use python functions defined in another snippet. To specify several dependencies, separate the numbers with commas thus: `$<a,b:cmd>`

  To use a variable in all other python snippets, declare it as `global`.

### Sort Plugin

The Sort plugin arranges selected lines of text into alphabetical order.

ソート操作は元に戻すことができませんので、ソートの実行前にファイルを保存してください。ソート操作後、保存したファイルに戻るには、「ファイル」「Revert」を選択します。

ソートプラグインを使用するには、次の手順を実行します。

1. Select the lines of text you want to sort.

2. Choose Edit Sort . The Sort dialog opens.

3. Choose the options you want for the sort:

   - To arrange the text in reverse order, select Reverse order.

   - To delete duplicate lines, select Remove duplicates.

   - To ignore case sensitivity, select Ignore case.

   - To have the sort ignore the characters at the start of the lines, set the first character that should be used for sorting in the Start at column spin box.

4. To perform the sort operation, click Sort.

### Spell Checker Plugin

The Spell Checker plugin checks the spelling in the selected text. You can configure gedit to check the spelling automatically, or you can check the spelling manually, in the specified language. The language setting, and the autocheck spelling properties, apply per document. To use the Spell checker plugin, perform the following steps:

1. Choose Tools Set Language to display the Set language dialog. Select the appropriate language from the list. Click OK to close the Set language dialog.

2. To check the spelling automatically, choose Tools Autocheck Spelling . To unset the automatic spell check, choose Tools Autocheck Spelling again. When automatic spell checking is set, an icon is displayed beside the Autocheck Spelling menu item. Automatic spell checking is unset by default, each time gedit starts.

   Unknown spellings are displayed in a different color, and underlined. Right-click on an unknown spelling, then select Spelling Suggestions from the popup menu:

   - To replace the unknown spelling with another spelling in the list, select the replacement spelling from the Spelling Suggestions popup menu.

   - To add the unknown spelling to your personal dictionary, select Spelling Suggestions Add .

   - To ignore all occurrences of the unknown spelling, so that they are no longer flagged as unknown but are not added to your personal dictionary, select Spelling Suggestions Ignore All . The unknown word is ignored in the current gedit session only.

3. To check the spelling manually, choose Tools Check Spelling .

   If there are no spelling errors, an Information dialog displays a message stating that the document does not contain misspelled words. Click OK to close the Information dialog.

   If there are spelling errors, the Check Spelling dialog is displayed:

   - The Misspelled word is displayed at the top of the dialog.

   - A suggested known spelling is displayed in the Change to text box. You can replace this with another known spelling by selecting a spelling from the Suggestions list, or you can enter text directly into the Change to text box.

   - To check the spelling of the text in the Change to text box, click Check Word. If this is a known word, the Suggestions list is replaced with the text `(correct spelling)`. If the word is not known, new entries appear in the Suggestions list.

   - To ignore the current occurrence of the unknown word, click Ignore. To ignore all occurrences of the unknown word, click Ignore All. The unknown word is ignored in the current gedit session only.

   - To change the current occurrence of the unknown word to the text in the Change to text box, click Change. To change all occurrences of the unknown word to the text in the Change to text box, click Change All.

   - To add the unknown word to your personal dictionary, click Add word.

   - To close the Check Spelling dialog, click Close.

### Tag List Plugin

The Tag List plugin allows you to insert common tags from a list in the side pane.

To use the Tag List plugin, perform the following steps:

1. Choose View Side Pane .

2. By default, the side pane shows a tab containing a list of open documents. Click on the tab showing a + icon at the bottom of the side pane to show the tag list tab.

3. Select the appropriate tag category from the drop-down list. For example, HTML - Tags.

4. タグリストをスクロールして、希望のタグを見つけます。

5. 現在のファイルのカーソル位置にタグを挿入するには、タグリストで該当するタグをダブルクリックします。次の方法でもタグを挿入できます。

   - To insert a tag in the current file and change the focus from the side pane to the display area, press Return.

   - To insert a tag in the current file and maintain the focus on the Tag list plugin window, press ShiftReturn.

### User Name Plugin

The User name plugin inserts the username of the current user into the document.

To insert your username at the cursor position, choose Edit Insert User Name .

This plugin is mostly provided as an example of how to create your own plugins. For more information on creating plugins, see the gedit website.