Sublime Text:选择变量的所有实例并编辑变量名称
本文翻译自:Sublime Text: Select all instances of a variable and edit variable name
I'm new to Sublime, and I just discovered that if I select a variable (not just any string) in my code, all other instances of that variable get a stroke (white outline) around them: 我是Sublime的新手,我刚刚发现,如果我在代码中选择一个变量 (不仅仅是任何字符串),该变量的所有其他实例都会在它们周围得到一个笔划(白色轮廓):
Is there a keyboard shortcut that will let me select all of those instances of the variable and edit them all at once? 是否有键盘快捷键可以让我选择变量的所有实例并一次编辑它们?
Things I've tried: 我试过的事情:
Using ⌘ D , ⌘ K , and ⌘ U lets me select them one-by-one, but I have to manually exclude the non-variable string matches: 使用⌘d,⌘K和⌘ü让我一个接一个地选择它们,但我必须手动排除非可变字符串匹配:
And using Ctrl ⌘ G simply selects all the string matches: 并用Ctrl⌘ 摹简单地选择所有的字符串匹配:
Clearly, Sublime is able to differentiate between variable- and string-matches. 显然,Sublime能够区分变量匹配和字符串匹配。 Is there no way to select just the variable matches? 有没有办法只选择变量匹配?
#1楼
参考:https://stackoom.com/question/18g41/Sublime-Text-选择变量的所有实例并编辑变量名称
#2楼
Despite much effort, I have not found a built-in or plugin-assisted way to do what you're trying to do. 尽管付出了很多努力,但我还没有找到内置或插件辅助的方式来做你想做的事情。 I completely agree that it should be possible, as the program can distinguish foo
from buffoon
when you first highlight it, but no one seems to know a way of doing it. 我完全同意它应该是可能的,因为当你第一次突出它时,程序可以区分foo
和buffoon
,但似乎没有人知道这样做的方法。
However, here are some useful key combos for selecting words in Sublime Text 2: 但是,这里有一些有用的关键组合,用于在Sublime Text 2中选择单词:
Ctrl ⌘ G - selects all occurrences of the current word ( Alt F3 on Windows/Linux) 按Ctrl⌘ 摹 -选择当前单词的所有出现(Alt键 F3在Windows / Linux的)
⌘ D - selects the next instance of the current word ( Ctrl D ) ⌘d -选择当前字的下一个实例(Ctrl键 d)
- ⌘ K , ⌘ D - skips the current instance and goes on to select the next one ( Ctrl K , Ctrl D ) ⌘K,⌘d -跳过当前实例并继续选择下一个( 按Ctrl K,Ctrl键 d)
- ⌘ U - "soft undo", moves back to the previous selection ( Ctrl U ) ⌘ü - “软撤消”,移回到先前的选择(Ctrl键 U)
⌘ E , ⌘ H - uses the current selection as the "Find" field in Find and Replace ( Ctrl E , Ctrl H ) ⌘E,⌘^ h -使用当前的选择作为“查找”字段中查找和替换( 按Ctrl E, 按Ctrl 1H)
#3楼
1. PUT THE CURSOR IN THE VARIABLE 1.将光标放在变量中
⚠️ the key is to start with an empty selection ⚠️ – don't highlight; ⚠️关键是从一个空的选择开始⚠️ - 不要突出显示; just move your cursor there. 只需将光标移动到那里。
2. PRESS ⌘ D as needed. 2.按 ⌘d根据需要。 Not on a Mac? 不在Mac上? Ctrl D Ctrl D
From(Sublime Text 全程指南):http://zh.lucida.me/blog/sublime-text-complete-guide From(Sublime Text 3 全程详 ... Sublime Text 是一个轻量.简洁.高效.跨平台的编辑器:可跨平台支持Windows/Mac/Linux:支持32与64位操作系统:支持语法高亮(不限于 C, C++, C#, CSS, HT ... 之前我常用的编程工具是UltraEdit和Editplus,UltraEdit里强大的搜索和大文本加载功能是我喜欢的.但这两款文本编辑器是收费的,我一直用破解版的心里有鬼.自从发现了Sublime T ... 原文链接:http://jingyan.baidu.com/article/15622f2419ce79fdfcbea5ea.html 按步骤设置成功!感谢大侠! 以下是原文: Sublime Tex ... TL;DR 问题背景: 相信很多用 Sublime Text 来写 Python 2 的同学都遇到过以下这个问题(例如这位同学 /t/100435 和这位同学/t/163012 ): 在 Sublim ... Sublime Text 2 本身并不强大,但是它方便使用插件扩展功能,所以变得很强大.今天介绍一个很实用的插件 SFTP ,可以大大提高前端工作效率. 常见的工作流程 有时候修改一些网站上的文件,通 ... LZ-Says:河入江,江入海,海纳百川 前言 Mac,高逼格,直到现在 LZ 都认为 Mac 还是高逼格的存在,看着大神嗖嗖各种命令行,羡慕牙痒痒. 特此点滴记录,在此,感谢我韩哥指点- 提前预祝我 ... 解决方案 搜了一下,找到一个 Linux 下的解决方案,如下所示: Sublime Text2 运行pySide/pyQt程序的问题 Ctrl-B后,界面不会弹出来,但是后台进程里面有"py ... 一.MinGW在Windows中的安装与配置: MinGW MinGW(Minimalist GNU For Windows)是个精简的Windows平台C/C++.ADA及Fortran编译器,相比 ...Sublime Text:选择变量的所有实例并编辑变量名称相关推荐
最新文章
热门文章