Chapter 06 · Editing and files编辑与文件編輯與檔案
Find and replace查找与替换尋找與取代
Opening the bar
⌘F— find bar.⌘⌥F— find and replace bar.⌘G/⌘⇧G— next and previous match.
The bar docks at the bottom of the editor pane and keeps focus on the find field, so you can type a query immediately.
Modes
| Toggle | Effect |
|---|---|
| Regex | Interprets the query as a regular expression. |
| Case | Makes matching case-sensitive. |
| Whole word | Requires word boundaries around the match. |
Feedback while typing
Press Return or jump to the next match to execute the search. The field then shows a counter such as 1/4, every match is tinted, and the current match uses a stronger tint so it stands out without a selection block.
Replacing
- Replace substitutes the current match and advances.
- Replace All processes every match in the document in one pass.
- With regex enabled, capture groups can be referenced in the replacement (
$1,$2).
History
Both fields keep the 20 most recent entries, newest first, and deduplicate repeats. History is per field and survives while the document is open.
Scope
The free edition searches the active document. Searching across a folder is the Pro project-search module; see Project workspace.
Practical notes
- Regex mode treats the query literally otherwise — characters like
.and*are ordinary text in plain mode. - Replacing inside a very large file still runs on the document model, but the view only repaints the visible region.
- Escape closes the bar and returns focus to the editor.
打开查找栏
⌘F— 查找栏。⌘⌥F— 查找替换栏。⌘G/⌘⇧G— 下一个 / 上一个匹配。
查找栏停靠在编辑区底部,并自动把焦点放在输入框,打开即可输入。
模式
| 开关 | 作用 |
|---|---|
| 正则 | 把查询当作正则表达式解释。 |
| 区分大小写 | 匹配时区分大小写。 |
| 全词匹配 | 要求匹配两侧为词边界。 |
输入时的反馈
按回车或跳转到下一个匹配后执行搜索:输入框显示 1/4 这类计数,所有匹配着色,当前匹配用更强的底色区分——不依赖选中块,因此不会遮挡文字。
替换
- 替换:替换当前匹配并前进。
- 全部替换:一次处理文档内所有匹配。
- 开启正则时,替换文本可用
$1、$2引用捕获组。
历史
查找与替换两个输入框各保留最近 20 条,按时间倒序并去重。历史按输入框独立,文档打开期间一直有效。
作用范围
免费版只在当前文档内搜索;跨文件夹搜索属于 Pro 的项目搜索模块,见《项目工作区》。
实用提醒
- 非正则模式下
.、*等字符按普通文本处理。 - 超大文件中的替换作用在文档模型上,视图只重绘可见区域。
- Esc 关闭查找栏并把焦点还给编辑区。
開啟尋找欄
⌘F— 尋找欄。⌘⌥F— 尋找取代欄。⌘G/⌘⇧G— 下一個 / 上一個匹配。
尋找欄停靠在編輯區底部,並自動把焦點放在輸入框,開啟即可輸入。
模式
| 開關 | 作用 |
|---|---|
| 正則 | 把查詢當作正規表達式解釋。 |
| 區分大小寫 | 匹配時區分大小寫。 |
| 全詞匹配 | 要求匹配兩側為詞邊界。 |
輸入時的回饋
按回車或跳轉到下一個匹配後執行搜尋:輸入框顯示 1/4 這類計數,所有匹配著色,當前匹配用更強的底色區分——不依賴選取塊,因此不會遮擋文字。
取代
- 取代:取代當前匹配並前進。
- 全部取代:一次處理文件內所有匹配。
- 開啓正則時,取代文字可用
$1、$2引用捕獲組。
歷史
尋找與取代兩個輸入框各保留最近 20 條,按時間倒序並去重。歷史按輸入框獨立,文件開啟期間一直有效。
作用範圍
免費版只在當前文件內搜尋;跨資料夾搜尋屬於 Pro 的專案搜尋模組,見《專案工作區》。
實用提醒
- 非正則模式下
.、*等字元按普通文字處理。 - 超大檔案中的取代作用在文件模型上,檢視只重繪可見區域。
- Esc 關閉尋找欄並把焦點還給編輯區。