本文翻译自: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. 我完全同意它应该是可能的,因为当你第一次突出它时,程序可以区分foobuffoon ,但似乎没有人知道这样做的方法。


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

Sublime Text:选择变量的所有实例并编辑变量名称相关推荐

  1. Sublime Text 全程图文指引

    From(Sublime Text 全程指南):http://zh.lucida.me/blog/sublime-text-complete-guide From(Sublime Text 3 全程详 ...

  2. Sublime Text 3中的OpenSees插件配置

    Sublime Text 是一个轻量.简洁.高效.跨平台的编辑器:可跨平台支持Windows/Mac/Linux:支持32与64位操作系统:支持语法高亮(不限于 C, C++, C#, CSS, HT ...

  3. 开发 Sublime Text 3 插件简易教程

    之前我常用的编程工具是UltraEdit和Editplus,UltraEdit里强大的搜索和大文本加载功能是我喜欢的.但这两款文本编辑器是收费的,我一直用破解版的心里有鬼.自从发现了Sublime T ...

  4. Sublime Text 3 配置浏览器预览路径 localhost

    原文链接:http://jingyan.baidu.com/article/15622f2419ce79fdfcbea5ea.html 按步骤设置成功!感谢大侠! 以下是原文: Sublime Tex ...

  5. python3 rid1.7.4.2 控制台中文乱码_TL;DR - 有关 Python 2 和 Sublime Text 中文 Unicode 编码问题的分析与理解...

    TL;DR 问题背景: 相信很多用 Sublime Text 来写 Python 2 的同学都遇到过以下这个问题(例如这位同学 /t/100435 和这位同学/t/163012 ): 在 Sublim ...

  6. 在 Sublime Text 中使用 SFTP 插件快速编辑远程服务器文件 Sublime-text with SFTP plugin ...

    Sublime Text 2 本身并不强大,但是它方便使用插件扩展功能,所以变得很强大.今天介绍一个很实用的插件 SFTP ,可以大大提高前端工作效率. 常见的工作流程 有时候修改一些网站上的文件,通 ...

  7. 基础篇 之 Mac Sublime Text 设置别名 subl

    LZ-Says:河入江,江入海,海纳百川 前言 Mac,高逼格,直到现在 LZ 都认为 Mac 还是高逼格的存在,看着大神嗖嗖各种命令行,羡慕牙痒痒. 特此点滴记录,在此,感谢我韩哥指点- 提前预祝我 ...

  8. sublime运行python代码python没显示_解决windows下Sublime Text 2 运行 PyQt 不显示的方法分享...

    解决方案 搜了一下,找到一个 Linux 下的解决方案,如下所示: Sublime Text2 运行pySide/pyQt程序的问题 Ctrl-B后,界面不会弹出来,但是后台进程里面有"py ...

  9. MinGW安装与环境变量配置和Sublime Text 3搭建C++编译环境

    一.MinGW在Windows中的安装与配置: MinGW MinGW(Minimalist GNU For Windows)是个精简的Windows平台C/C++.ADA及Fortran编译器,相比 ...

最新文章

  1. iOS Sprite Kit教程之编写程序以及Xcode的介绍
  2. 李开复对谈张亚勤:科学家创业需要企业家伙伴,开放心态看待元宇宙 | MEET2022...
  3. python与数据库连接的代码_python连接数据库的案例及源代码
  4. 华为机试HJ8:合并表记录
  5. php字符是否在字符串中出现,php 判断一个字符串中的字符是否都在另一个中出现(算法)...
  6. 关于个人电脑连不上公司svn服务器,显示拒绝访问的错误
  7. matlab怎么学机器人算法,机器人学、机器视觉与控制——MATLAB算法基础
  8. Linux文件系统(一)——常用文件系统
  9. 黑苹果安装 hackintosh Lenovo Y50-70 TransMac 破解版安装
  10. 2015年imac一体机安装双系统问题及解决技巧
  11. 全球智能制造产业联盟落地深圳
  12. 广义表的概念及其存储结构
  13. 软件工程基础第一次作业
  14. 微信小程序 如何接入视频激励广告
  15. ubuntu18.04 安装Pangolin
  16. TCP/IP详解(特详!)
  17. c语言飞机票实验报告格式,c语言航班信息查询系统实验报告
  18. wireshark抓包测试:海康摄像机
  19. MPB:山大倪金凤组-培菌白蚁肠道簇虫分离与分子鉴定的方法
  20. 【java进阶02:抽象类和接口】类与类之间的关系 抽象类与接口的区别

热门文章

  1. [渝粤教育] 西南科技大学 会计学原理 在线考试复习资料(1)
  2. kotlin 仿照setOnclickListener写法
  3. 苹果公司的企业文化_企业文化到底有什么用?
  4. 画春天的景色计算机教案,【美丽的春天图画】美丽的春天幼儿园春季教案
  5. APS高级计划排程和生产计划排产系统电子行业的解决方案
  6. Ubuntu14.04 安装 TP_LINK驱动 TL-WDN5200H 1.0无线网卡
  7. Python实用工具之制作证件照(有界面、附源码、赞关藏)
  8. TensorFlow2学习七、使用MNIST手写体识别数据集识别自己手写图片
  9. 编译原理_P1004
  10. ipset如何与netfilter内核模块进行通信