# Pluma 手册

2015-2020
MATE Documentation Project
2007
GNOME Documentation Project
2002
2003
2004
Sun Microsystems
2000
Eric Baudais
MATE 文档项目
GNOME 文档项目
MATE 文档项目
MATE 桌面
Joachim
Noreiko
GNOME 文档项目
GNOME
Hal
Canary
增加快捷键栏
Sun Java 桌面系统开发团队
Sun Microsystems
gdocteam@sun.com
Eric
Baudais
GNOME 文档项目
baudais@okstate.edu
Baris
Cicek
提供有关 pluma 应用程序早期版本的修订信息。
George
Ajit
提供有关插件的信息。
1.0
2000

Eric Baudais baudais@okstate.edu

GNOME 文档项目

2.0
2002年三月

Sun GNOME 文档团队

GNOME 文档项目

2.1
2002年六月

Sun GNOME 文档团队

GNOME 文档项目

2.2
2002年八月

Sun GNOME 文档团队

GNOME 文档项目

2.3
2002年九月

Sun GNOME 文档团队

GNOME 文档项目

2.4
2003年一月

Sun GNOME 文档团队

GNOME 文档项目

2.5
2003年三月

Sun GNOME 文档团队

GNOME 文档项目

2.6
2003年九月

Sun GNOME 文档团队

GNOME 文档项目

2.7
2004年三月

Sun GNOME 文档团队

GNOME 文档项目

2.8
2005年七月

Sun Java 桌面系统开发团队

GNOME 文档项目

2.9
2006年七月

GNOME 文档团队

GNOME 文档项目

3.0
2005年七月

MATE 文档团队

MATE 文档项目

本手册涉及了 Pluma 的 1.10 版本
Christopher Meng
i@cicku.me
2012-2013
Christopher Meng
ravix
dr.neemous@gmail.com
2013
ravix
Dianjin Wang
1132321739qq@gmail.com
2012
Dianjin Wang
Cravix
dr.neemous@gmail.com
2013
Cravix
nyanyh
rebuilty@gmail.com
2013
nyanyh
liulitchi
xingzuo88@qq.com
2013
liulitchi
玉堂白鹤
yjwork@qq.com
2015
玉堂白鹤
Mingye Wang
arthur200126@gmail.com
2015-2016
Mingye Wang
白铭骢
jeffbai@aosc.xyz
2015-2016
白铭骢
刘子兴
liushuyu@aosc.xyz
2015-2016
刘子兴
Mingtian Yang
i@skylee.xyz
2020
Mingtian Yang

## 介绍

pluma应用程序可以让你创建并编辑文本文件。

pluma的目标是做一个简单且容易的文本编辑器。更多强大的功能可以被不同的plugins，它们允许在文本编辑时执行更多的任务。

## 入门

### 启动 pluma

你可以用以下方法启动pluma：

应用程序菜单

  Choose 附件 Pluma文本编辑器 。

命令行

  执行以下命令：`pluma`

默认状态下，当在文件管理器中你打开一个文本文档时，pluma 将会启动，并展示该文档。

### pluma 窗口

当你启动puma时，以下窗口会被展示：

#### pluma 窗口

显示 pluma 主窗口。

pluma窗口包含以下元素：

菜单栏

  菜单栏上的菜单包含处理pluma文件所需的所有命令。

工具栏

  工具栏包含您可以从菜单栏访问的命令的子集。

显示区域

  显示区域包含您正在编辑的文件的文本。

状态栏

  状态栏显示当前pluma活动的信息和菜单项的上有关信息。状态栏还显示以下信息:

  - 光标位置：光标所在的行号和列号。

  - 编辑模式：如果编辑器处于插入模式，状态栏将会显示文本INS。如果编辑器处于替换模式，则状态栏将会显示文本OVR。按Insert键改变编辑模式。

侧窗格

  侧窗格会显示打开的文档列表和其他的信息，这些信息取决于启用了哪些插件。

  默认情况下侧窗格不会显示。要让它显示，请选择视图侧窗格。

底部面板

  底部面板由编程工具（比如Python 控制面板插件）来显示输出。

  默认情况下，底部面板不会显示。要显示它，请选择视图底部面板。

当您右键单击pluma窗口时，应用程序将弹出一个菜单。它包含最常见的文本编辑命令。

与其他 MATE 应用程序一样，pluma中的操作可以通过多种方式执行：使用菜单、使用工具栏或快捷键。所有应用程序的通用快捷键都会列在用户指南中。

### 命令行里运行 pluma

您可以从命令行运行pluma并打开一个或多个文件。要从命令行打开多个文件，请输入以下命令，然后按回车（Return）：

`pluma 文件1.txt 文件2.txt 文件3.txt`

或者，您也可以指定一个URI而不是文件名。

请参阅pluma 1手册页来获取有关如何从命令行运行pluma的更多信息。

## 文件操作

### 创建新文档

要创建新文档，请选择文件 新建。pluma窗口中会显示一个新的空白文档。

### 打开文件

若要打开文件，请选择文件 打开以显示打开文件对话框。选择要打开的文件，然后单击打开。文件会显示在pluma的窗口中。

该应用程序将记录您编辑的五个最新文件的路径和文件名，并将这些文件显示为文件菜单上的菜单项。您还可以单击工具栏上的 显示最近的文件菜单图标。 图标来显示最近的文件列表。

您可以在pluma中打开多个文件。应用程序会为每个打开的文件而向窗口添加一个标签页。点击获取更多信息。

### 保存文件

您可以用以下方式保存文件：

- 若要将更改保存到现有的文件，请选择 文件 保存 。

- 若要保存新文件或将现有文件保存为另一个文件，请选择 文件 另存为 。在另存为对话框中输入文件名称，然后单击保存。

- 若要保存当前在pluma中打开的所有文件，请选择 文档 保存所有 。

要关闭当前在pluma中打开的所有文件，请选择 文档 全部关闭 。

### 使用标签页

当打开多个文件时，pluma将在显示区域上方显示每个文档的标签页。要切换到另一个文档，单击它的标签页。

要将文档移动到另一个pluma窗口，请将文件对应标签页拖动到您要移动到的窗口。

要将文档移动到新的pluma窗口，可将其标签页拖到桌面上，或选择 文档 移动到新窗口 。

## 与文本工作

### 编辑文本

您可以按照下列方式编辑一个文件中的文本：

- 从键盘上输入新文本。闪烁的插入光标会标记新文字出现的点。要改变这一点，请使用键盘上的方向键或用鼠标点击。

- 要将选定的文本复制到剪贴板上，请选择 编辑 复制 。

- 要从文件中删除选定的文本，并将该段文本移动到剪贴板上，请选择 编辑 剪切 。

- 想要从文件中永久删除所选文本，请选择 编辑 删除 。

- 要在光标位置插入剪贴板里的内容，请选择 编辑 粘贴 。无论是从pluma还是其他应用程序中粘贴，您都必须要先剪切或复制文本，然后才能将文本粘贴到文件中。

- 要选择文件中的所有文本，请选择 编辑 全选 。

### 撤销和重做更改

要撤销您所做的更改，请选择 编辑 撤销 。要撤销此操作，请选择 编辑 重做 。

## 查找和替换

在pluma中，有两种搜索文本的方法。您可以使用查找对话框来搜索特定的文本，或者使用增量搜索来突出显示匹配的文本。

### 查找文本

如果要搜索一个文件中的文本字符串，请按照以下步骤执行。

1. 选择 搜索 查找 以显示查找对话框。

2. 在搜索输入框中键入您想要查找的字符串。您可以包含特殊字符，例如新行或制表符：请参见。

3. 单击查找以在文件中搜索当前光标后第一个匹配的字符串。如果pluma找到了匹配的字符串，该应用会选择将该字符串的第一个展现在您眼前。其他的匹配字符串也会被高亮显示。

4. 要查找下一个匹配的字符串，请点击查找或选择 搜索 查找下一个 。要查找该文本的上一次出现，请选择 搜索 查找上一个 。

关闭查找对话框后，您仍然可以通过选择 搜索 查找下一个 和 搜索 查找上一个 来将选择区域移动到文本的其他位置。

要移除文本中的高亮显示，请选择 搜索 清除高亮显示 。

### 增量搜索

增量搜索功能会在你逐字逐句输入要搜索的文本时高亮显示文本中的匹配文本。(类似于一些网页浏览器中的搜索功能)。

要开始增量搜索，请选择 搜索 增量搜索 。搜索框会出现在显示区域的顶部。

开始键入后，文档中匹配的文本将被高亮显示。光标位置后的第一个匹配文本也会被选中。

在保持增量搜索框打开的情况下，如果要选中下一个匹配文本，请按 Ctrl G 。按 Ctrl Shift G 键返回到上一个匹配文本。

您也可以使用向上下方向键或鼠标滚轮来更换选择的匹配文本。

### 替换文本

搜索一个文件中的字符串，并将其替换成另一个字符串，请执行以下步骤：

1. 选择 搜索 替换 以显示替换对话框。

2. 在搜索输入框中输入您要查找的字符串。您可以包含特殊字符，例如换行或制表符：参见。

3. 在替换为输入框中键入你需要的字符串来替换找到的字符串。

要在替换字符串之前检查该每一个匹配字符串出现的位置，请点击查找。如果pluma找到了该字符串，该应用程序会选择该字符串。点击替换以替换选中的字符串的出现。要查找下一个匹配字符串出现的位置，请再次点击查找。

要替换整个文档中出现的所有匹配字符串，请点击全部替换。

### 查找与替换选项

查找对话框和替换对话框都有以下选项：

- 选择区分大小写选项，可以只查找与您输入的文本的大小写相匹配的字符串的出现。例如，如果选择了区分大小写，“TEXT”将不匹配“text”。

- 选择匹配整个单词选项，可以只查找与您输入的文本中的整个单词相匹配的字符串。例如，选择了匹配整个单词选项，“text”将不匹配“texture”。

- 选择反向搜索选项，文档的最后开始反向搜索。

- 选择回到稳当头部继续搜索选项，搜索到文件的一端时，会从文件的另一端继续搜索。

### 特殊字符

您可以在文本中添加以下转义字符以查找或替换特殊字符。

`\n`

  插入新行

`\t`

  插入一个制表符。

`\r`

  插入一个回车。

`\\`

  如要搜索反斜线字符，则使用必须转义字符。例如，如果您要找的是字符串“\n”，则您必须在搜索栏中输入“\\n”。或者说，如果你要寻找一串反斜线，您必须将搜索到的反斜线数量加倍。

### 将光标定位在特定行上

要将光标跳转到当前文件中的制定行上，请选择 搜索 跳转到指定行 。在显示区域的顶部会出现行号框。

键入你要让光标跳转的行数，文档将自动滚动到您指定行。

要关闭该输入框并让光标跳转至指定行，请按回车。

## 打印

### 设置页面选项

要设置页面选项，请选择 文件 页面设置 来显示页面设置对话框。

通过页面设置对话框，您可以指定以下打印选项:

#### 一般標籤部分

打印语法高亮显示

  选择此选项可打印语法突出显示。更多有关语法突出显示的信息，请参阅。

打印页眉

  如果选择此选项，您打印的每一页中将包含页眉。您不能在此配置页眉。

行号

  选择打印行号选项，在打印文件时将包括行号。

  使用每几行打印一次行号来指定打印行号的频率，例如每5行、每10行打印一次等。

文字折行

  当您打印文件时，选择启用文字折行选项，以在字符级别上将文字折叠到下一行。该应用程序会在进行行号编号时将被折叠的行计为一行。

  当您打印文件时，选择不将一个单词拆在两行选项，以在打印文件时，在单词级别上将文本折叠下一行。

#### 字体

主体部分

  单击此按钮，选择用于打印文件正文的字体。

行号

  点击此按钮，选择用于打印行号的字体。

页眉和页脚

  电机此按钮，选择要打印文件中的页眉和页脚的字体。

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

### 打印一个文档

您可以使用pluma执行以下打印操作。

- 让打印机打印一个文档；

- 使打印命令输出到文件中。

如果您打印一个文件，pluma会将该文件的输出发送到一个印前格式文件。最常见的印前格式是PostScript和便携式文档格式（PDF）。

要预览您要打印的页面，请选择 文件 打印预览 。

要将当前文件打印到打印机或文件，请选择 文件 打印 以显示打印对话框。

在打印对话框中，您可以指定以下打印选项。

#### 常规

打印范围

  选择以下选项之一以确定要打印的页数：

  - 全部

    选择该项以打印文件中的所有页面。

  - 行号

    选择此选项，可以仅打印指定的行数。使用从和直到输入框指定行数范围。

  - 选择部分

    选择此选项，可以仅打印所选文本。此选项仅在文本被选择时可用。

副本

  使用 副本数 旋转框来指定您要打印文件副本数量。

  如果您打印了多个文件的副本，请选择整理选项来整理打印的副本。

#### 打印缩进选项

打印机

  使用此下拉列表选择要打印文件的打印机。

设置

  使用此下拉列表选择打印机设置。

  要配置打印机，请单击配置。例如，如果打印机支持此功能，则可以启用或禁用双面打印，或计划延迟打印。

定位

  使用此下拉列表选择以下的一个打印目标：

  CUPS

    使用 CUPS 打印机打印文件。

    如果所选打印机是CUPS打印机, CUPS 是此下拉列表中的唯一条目。

  行式打印机

    使用普通打印机打印文件

  文件

    将文件打印到 PostScript 文件中。

    单击另存为以显示一个对话框，您可以在其中指定PostScript文件的名称和位置。

  自定义

    使用指定的命令来打印文件。

    在文本框中键入命令的名称。包括所有命令行参数。

状态

  此版本的pluma不支持该功能。

类型

  此版本的pluma不支持该功能。

注释

  此版本的pluma不支持该功能。

#### 页面设置

纸张大小

  使用此下拉列表选择要将文件打印到的纸张的大小。

宽度

  使用此旋转框指定纸张的宽度。使用相邻的下拉列表更改测量单位。

高度

  使用此旋转框指定纸张的高度。

进纸方向

  使用此下拉列表选择打印机中纸张的方向。

页面方向

  使用此下拉列表选择页面方向。

布局

  使用此下拉列表选择页面布局。您选择的每个布局的预览显示在预览区域中。

纸盘

  使用此下拉列表选择纸盘。

## 编程辅助

pluma的一些编程辅助功能是通过插件提供的。例如，Tag List插件为不同的语言提供了一个常用的标记列表：见

### 语法高亮

语法高亮显示可以通过不同的颜色以显示文本的不同部分，使代码更容易阅读。

pluma会根据文档的类型选择合适的突出显示模式。要重新设置语法高亮模式，选择 视图 突出显示模式 ，然后选择以下菜单项之一：

纯文本

  不使用任何突出显示。

源代码

  使用突出显示来编辑源代码。使用源代码子菜单以选择源代码类型。

标记

  使用语法高亮来编辑标记代码。使用标记子菜单以选择标记代码类型。

脚本

  使用语法高亮来编辑脚本代码。使用脚本子菜单以选择标记代码类型。

其他

  使用语法高亮来编辑其他形式的代码。使用其他子菜单以选择代码类型。

### 将命令输出传输到文件

可以使用pluma将命令的输出通过管道传输（pipe）到文本文件。例如，要将ls命令的输出通过管道传输到文本文件，只需要输入`ls | pluma`，然后按Return键。

`ls`命令的输出将呈现在pluma窗口中新建的文本文件里。

另外，你也可以使用外部工具插件将命令输出到当前文件。

## 快捷键

使用快捷键可以比使用鼠标和菜单更快速地执行普通任务。下表列出了所有pluma的快捷键。

有关快捷键的更多信息，请参阅桌面用户指南。

标签页

标签页的快捷键

快捷键 | 命令
--- | ---
Ctrl + Alt + PageUp | 向左切换一个标签页。
Ctrl + Alt + PageDown | 向右切换标签页。
Ctrl + W | 关闭标签页。
Ctrl + Shift + L | 保存所有标签页
Ctrl + Shift + W | 关闭所有标签页
Alt + n | 切换到第 n 个标签页。

文件

文件操作中的快捷键：

快捷键 | 命令
--- | ---
Ctrl + N | 新建一个文件。
Ctrl + O | 打开一个文档。
Ctrl + S | 将正在使用的文档存到磁盘中。
Ctrl + Shift + S | 以一个新文件名保存当前文档。
Ctrl + P | 打印当前文档。
Ctrl + Shift + P | 文档打印预览。
Ctrl + W | 关闭当前文档。
Ctrl + Q | 退出 Pluma。

编辑

文档编辑中的快捷键：

快捷键 | 命令
--- | ---
Ctrl + Z | 撤销最近一次操作。
Ctrl + Shift + Z | 重做最后一次撤销的操作。
Ctrl + X | 剪切选中的文本或者文本块，把它们放入剪贴板中。
Ctrl + C | 复制选中的文本或位置到剪贴板。
Ctrl + V | 粘贴剪贴板内的内容。
Ctrl + A | 选择全部。
Ctrl + D | 删除当前一行内容。
Alt + Up | 将选中行上移一行。
Alt + Down | 将选中行下移一行。

面板

显示和隐藏面板的快捷键：

快捷键 | 命令
--- | ---
F9 | 显示/隐藏侧边栏
Ctrl + F9 | 显示/隐藏底部面板。

查找

搜索中的快捷键：

快捷键 | 命令
--- | ---
Ctrl + F | 查找一个字符串
Ctrl + G | 查找下一个匹配的字符串。
Ctrl + Shift + G | 查找上一个匹配的字符串。
Ctrl + K | 交互搜索
Ctrl + H | 搜索并替换。
Ctrl + Shift + K | 清除高亮。
Ctrl + I | 跳转到指定行。

工具

工具的快捷键：

快捷键 | 命令
--- | ---
Shift + F7 | 检查拼写（需要插件）。
Alt + F12 | 移除尾部空格（需要插件）。
Ctrl + T | 缩进（需要插件）。
Ctrl + Shift + T | 移除缩进（需要插件）。
F8 | 在当前目录运行“make”（需要插件）。
Ctrl + Shift + D | 目录列表（需要插件）。

帮助

帮助的快捷键：

快捷键 | 命令
--- | ---
F1 | 打开pluma的用户手册。

## 首选项

若要配置pluma，请选择 编辑 首选项 。首选项对话框包含有以下内容：

### 查看首选项

文字折行

  选择文字折行选项以使一行过长文本折叠到一段中，而非溢出窗口。这样可以避免横向滚动

  选择不将一个单词拆在两行选项以使文本换行选项在将文本换行时保留整个单词。使文本更易于阅读。

行号

  选择显示行号选项以在pluma窗口的左侧显示行号。

当前行

  选择突出显示当前行选项突出显示光标所在行。

右边距

  选择显示右边距选项以显示一条指示右边距的垂直线。

  使用右边距于列数字设定框以设定垂直线的位置。

括号匹配

  选择突出显示匹配的括号选项使光标位于括号上时，突出显示与之匹配的括号。

### 编辑器首选项

Tabs

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

  Select the Insert spaces instead of tabs option to specify that pluma 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.

### 字体和颜色首选项

Font

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

  The Editor font field displays the font that pluma uses to display text. Click on the button to specify the font type, style, and size to use for text.

Color Scheme

  You can choose a color scheme from the list of color schemes. By default, the following color schemes are installed:

  Classic

    Classic color scheme based on the gvim color scheme.

  Cobalt

    Blue based color scheme.

  Kate

    Color scheme used in the Kate text editor.

  Oblivion

    Dark color scheme using the Tango color palette.

  Tango

    Color scheme using the Tango color scheme.

  You can add a new color scheme by clicking on Add..., and selecting a color scheme file

  You can remove the selected color scheme by clicking on Remove

### 插件首选项

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

#### Enabling a Plugin

To enable a pluma plugin, perform the following steps:

1. Choose Edit Preferences .

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 pluma.

To disable a pluma plugin, perform the following steps:

1. Choose Edit Preferences .

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.

## 插件

### Working with Plugins

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

Several plugins come built-in with pluma.

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

The following plugins come built-in with pluma:

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

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

- allows you to execute external commands from pluma.

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

- adds or removes indentation from the selected lines.

- adds the current date and time into a document.

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

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

- allows you to strip trailing whitespaces in your document after saving.

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

- arranges selected lines of text into alphabetical order.

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

- 允许您从侧边栏中的列表中插入用于 HTML 和其他语言的常用标记。

For more information on creating plugins, see .

### 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:

菜单条目 | 动作 | Example
--- | --- | ---
Edit Change Case All Upper Case | Change each character to uppercase. | `This text` becomes `THIS TEXT`
Edit Change Case All Lower Case | Change each character to lowercase. | `This Text` becomes `this text`
Edit Change Case Invert Case | Change each lowercase character to uppercase, and change each uppercase character to lowercase. | `This Text` becomes `tHIS tEXT`
Edit 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:

   - Number of lines in the current document.

   - Number of words in the current document.

   - Number of characters, including spaces, in the current document.

   - Number of characters, not including spaces, in the current document.

   - Number of bytes in the current document.

2. You can continue to update the pluma 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 pluma. 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:

构建

  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 specify the following details for the new command:

描述

  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 pluma environment variables can be used to pass content to these commands: see .

输入

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

输出

  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.

#### Editing and Removing Tools

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

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

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

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

#### Variables

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

- PLUMA_CURRENT_DOCUMENT_URI

- PLUMA_CURRENT_DOCUMENT_NAME

- PLUMA_CURRENT_DOCUMENT_SCHEME

- PLUMA_CURRENT_DOCUMENT_PATH

- PLUMA_CURRENT_DOCUMENT_DIR

- PLUMA_DOCUMENTS_URI

- PLUMA_DOCUMENTS_PATH

### File Browser Pane Plugin

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

要查看文件浏览器，请选择查看侧边栏，然后点击侧边栏底部显示文件浏览器图标的选项卡。

#### 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.

#### 打开文件

To open a file in pluma, 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 Folder.

### 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. Select the lines that you want to indent. To indent or unindent a single line, place the cursor anywhere on that line.

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. Choose Edit Insert Date and Time .

   If you have not configured the Insert Date/Time plugin to automatically insert the date/time without prompting you for the format, pluma 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. pluma inserts the date/time at the cursor position in the current file.

   If you have configured pluma 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

To configure the Insert Date/Time plugin, perform the following steps:

1. Choose Edit Preferences .

2. Select the Plugins tab.

3. Select the Insert Date/Time plugin.

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

5. Select one of the options, as follows:

   - To specify the date/time format each time you insert the date/time, select the Prompt for a format option.

   - To use the same pluma-provided date/time format each time you insert the date/time, select the Use the selected format option, then select the appropriate format from the list. When you select this option, pluma does not prompt you for the date/time format when you choose Edit Insert Date and Time .

   - To use the same customized date/time format each time you insert the date/time, select the Use custom format option, then enter the appropriate format in the text box. Refer to the strftime 3 for more information on how to specify a custom format. When you select this option, pluma does not prompt you for the date/time format when you choose Edit Insert Date and Time .

6. Click OK to close the Configure insert date/time plugin dialog.

7. To close the Preferences dialog, click Close.

### 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 pluma recognizes.

Preferences set using modelines take precedence over the ones specified in the preference dialog.

You can set the following preferences with modelines:

- Tab width

- Indent width

- Insert spaces instead of tabs

- 文字折行

- 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-offset, 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, sw, shiftwidth, wrap, and textwidth are supported. For more information, see the Vim website.

### Python Console Plugin

The Python Console Plugin allows you to run commands in the python programming language from pluma. 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 pluma, for example by entering an infinite loop.

### Save Without Trailing Spaces Plugin

The Save Without Trailing Spaces Plugin removes whitespace characters such as space (`˽`), tab (`\t`), carriage returns (`\r`) etc. from the end of a line. To use the Save Without Trailing Spaces plugin, perform the following steps:

1. Enable the plugin as described in .

2. When your document is ready, save it.

3. You will see that any trailing whitespaces has been stripped after the document has been saved.

### 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 pluma, 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 Ctrl Space 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:

   名称

     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.

   Shortcut key

     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 Shift Tab 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 pluma can also be used:

  $PLUMA_SELECTED_TEXT

    The currently selected text.

  $PLUMA_FILENAME

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

  $PLUMA_BASENAME

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

  $PLUMA_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.

You cannot undo the Sort operation, so you should save the file before performing the sort. To revert to the saved version of the file after the sort operation, choose File Revert .

To use the Sort plugin, perform the following steps:

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 pluma 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 pluma 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 pluma 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 pluma 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

标签列表插件允许您在侧边栏中插入列表中的普通标签。

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

1. 选择查看侧边栏。

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. Scroll through the tag list to find the required tag.

5. To insert a tag at the cursor position in the current file, double-click on the tag in the tag list. You can also insert a tag as follows:

   - 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 Shift Return .