用于在 Xcode 4 中查找当前选定文本的键盘快捷键
在 Visual Studio 中(多年来我的主要用途),我可以按 Ctrl+F 立即搜索文本插入符所接触的标识符或字符串,或者如果我有选择,则搜索当前选定的文本。我可以按 Ctrl+Shift+F 搜索整个项目、解决方案或其他文件集。我喜欢这个。
在 Xcode 3.* 中——我近年来的主要挤压——我可以按 Cmd+Opt+F 立即搜索当前选定的文本,然后按 Cmd+Opt+Shift+F(有点少,但可行)来搜索整个项目。与 VS 方法相比,我不太喜欢这种方法,因为我首先必须选择一些文本,然后搜索它,而不是如果我没有选择任何内容,IDE 会自动为我获取当前标识符。但没关系。
现在,在 Xcode 4 中,我注意到有一个 Cmd+E 快捷方式可以使 Xcode“使用选择进行查找”。但它……嗯,这很糟糕。显然,它所做的就是复制当前选择并将其粘贴到查找框中。它不显示查找框,因此如果当前未显示查找框,则 Cmd+E 没有可见效果。 Cmd-E 实际上并不调用搜索——它仅复制文本。因此,现在搜索标识符变成了一个三步过程:选择标识符,按 Cmd+E,按 Cmd+F(或 Cmd+Shift+F 用于项目范围搜索)。
IMO,Xcode 4 的三步过程比 Xcode 3 的两步过程更糟糕,而 Xcode 3 的两步过程又比 Visual Studio 的一步过程更糟糕。
我的问题:鉴于用户界面效率的下降以及最近的国际事件,世界是否正在走下坡路,很快一切都会以激烈的灾难结束,剩下的少数人类将被迫重新输入战争与和平 每次他们想要搜索标识符时?
In Visual Studio—my main squeeze for many years—I can press Ctrl+F to immediately search for the identifier or string that my text caret is touching, or else the currently selected text if I have a selection. I can press Ctrl+Shift+F to search the whole project, solution, or other file sets. I like this.
In Xcode 3.*—my main squeeze in recent years—I could press Cmd+Opt+F to immediately search for the currently selected text and Cmd+Opt+Shift+F (a bit of a handful, but workable), to search throughout the project. I liked this a bit less than the VS approach because I first had to select some text, then search for it, rather than the IDE automatically picking up the current identifier for me if I hadn't selected anything. But it was fine.
Now in Xcode 4 I notice that there is a Cmd+E shortcut that makes Xcode "Use Selection for Find." But it... well it sucks bad. All it does--apparently--is to copy the current selection and paste it into the find box. It doesn't show the find box, so if the find box isn't currently shown then Cmd+E has no visible effect. Cmd-E does not actually invoke the search--it only copies the text. So now searching for an identifier becomes a three step process: select the identifier, press Cmd+E, press Cmd+F (or Cmd+Shift+F for project-wide search).
IMO, Xcode 4's three-step process is worse than Xcode 3's two-step process, which is worse than Visual Studio's one-step process.
My question: In light of this falling UI efficiency along with recent international events, is the world just going downhill and soon all will end in a fiery apocalypse in which the few remaining humans will be forced to retype War and Peace each time they want to search for an identifier?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ughoavgfhw 提供了正确的答案(上面)。在
所选文本
上使用Cmd+E开始搜索该文本。然后立即输入 Cmd+Shift+F 在整个项目中搜索文本点击 enter 的所有实例。这是相当快速、一致且明智的。它不像 Visual Studio 的单笔查找/在文件中查找那么直接 - Xcode 需要两笔而不是一笔 - 但就我个人而言,额外的步骤并不困扰我。
ughoavgfhw offered the correct answer (above). Use Cmd+E on the
selected text
to begin searching with that text. Then immediately type Cmd+Shift+F to search the whole project for all instances of the text hit enter.This is quite quick, consistent, and sensible. It's not as immediate as Visual Studio's single-stroke Find/Find-in-Files—Xcode requires two strokes rather than one—but personally the extra step doesn't bother me.
对我来说,最好的选择是进入 Xcode> 首选项> 键绑定,然后在过滤器中输入“在工作区中查找选定的文本”并将其绑定到您所需的键,我将其绑定到 Shift+Ctrl+Option+Cmd+F
注意:I我使用的是 Xcode 版本 10.3
For me the best option was to go under Xcode>Preferences>Key Bindings and in Filter type "find selected text in workspace" and bind it to your desired key, I binded it to Shift+Ctrl+Option+Cmd+F
Note: I am using Xcode version 10.3
迟到了,但有人可能会受益:
我使用免费的 BetterTouchTool 并为丢失或尴尬的 Xcode 快捷方式定义自定义快捷方式。您可以将多个操作附加到自定义快捷方式,我已将 Cmd+E - Cmd+Shift+F - Enter 分配给鼠标中键,它让我只需单击一下即可在工作区中搜索选定的文本。您可以将相同的操作分配给键盘快捷键,尽管我更喜欢使用鼠标按钮来完成此任务,因为我也使用鼠标进行文本选择。
ps:BTT 让您可以选择在哪个应用程序中应用您的快捷方式,或者您可以将自定义快捷方式设置为全局,我也觉得这很方便。
Late to party but someone might benefit:
I use the free BetterTouchTool and define a custom shortcut for missing or awkward Xcode shortcuts. You can attach multiple actions to your custom shortcuts, I have assigned Cmd+E - Cmd+Shift+F - Enter to middle mouse button, it lets me search the selected text in workspace with a single click. You can assign the same actions to a keyboard shorcut though I like mouse buttons better for this task because I also do the text selection with mouse.
ps: BTT gives you the option to select in which application your shortcut will apply or you can make your custom shortcuts global, which I also find handy.