如何替换选区中的文本? [英] How do I replace text in a selection?
问题描述
我刚刚开始使用来自 emacs 的 Sublime Text 2.
I've just started using Sublime Text 2, coming from emacs.
我选择了一个文本区域.在该区域内,我想用255"替换0"的所有文本实例.
I have a region of text selected. Within that region, I'd like to replace all text instances of '0' with '255'.
如何进行这种文本替换?
How do I do this kind of text replacement?
推荐答案
这让我很沮丧,上面的答案都没有真正让我得到我想要的.我终于找到了我正在寻找的答案,如果你在 Mac 上执行 ⌘ + option + F 它将带来一个 Find-Replace编辑器底部的栏位于您打开的文件的本地.
This frustrated the heck out of me, and none of the above answers really got me what I wanted. I finally found the answer I was looking for, on a mac if you do ⌘ + option + F it will bring up a Find-Replace bar at the bottom of your editor which is local to the file you have open.
有一个图标选项,当鼠标悬停在它上面时会显示在选择中",您可以选择在选择中查找和替换.我在下面的屏幕截图中指出了正确的图标.
There is an icon option which when hovered over says "In Selection" that you can select to find and replace within a selection. I've pointed to the correct icon in the screenshot below.
点击全部替换,瞧,'0'
的所有实例都将被替换为 '255'
.
Hit replace all, and voila, all instances of '0'
will be replaced with '255'
.
注意:此功能仅在您使用 ⌘ + option + F 时可用.
Note: this feature is ONLY available when you use ⌘ + option + F.
当您使用 ⌘ + shift + F 时它不会出现.
It does NOT appear when you use ⌘ + shift + F.
注意:这会将 '0'
的所有实例替换为 '255'
.如果你想用 255
替换 0
(不带引号),那么只需输入 0
(不带引号)和 255
分别位于 Find What:
和 Replace With:
字段中.
Note: this will replace all instances of '0'
with '255'
. If you wanted to replace 0
(without the quotes) with 255
, then just put 0
(without quotes) and 255
in the Find What:
and Replace With:
fields respectively.
注意:
option 键也标记为 alt 键.
⌘ 键也被标记为 command 键.
⌘ key is also labeled as the command key.
这篇关于如何替换选区中的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!