双击高亮变量 Sublime Text 3 包括 $ [英] Double click highlight variable Sublime Text 3 include $

查看:123
本文介绍了双击高亮变量 Sublime Text 3 包括 $的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望 ST3 在选择 PHP 文件时包含$",因此我通过删除 $ 来编辑 word_separators :

I wanted ST3 to include the "$" when selecting PHP files so I edited word_separators by removing $ as such :

"word_separators": "./\\()\"':,.;<>~!@#%^&*|+=[]{}`~?"

现在它会在双击变量时突出显示包括$"在内的整个变量.但是,现在 Sublime 没有使用默认的 match_selection 功能匹配/概述这些变量.
对此有何想法?是否有我缺少的设置.非常感谢.

And now it highlight the whole varibale including the "$" when double clicking a variable. However, now Sublime is not matching/outlining those variables using the default match_selection functionality.
Any thoughts on this? Is there a setting I am missing. Much appreciated.

推荐答案

请参阅我的回答这个问题深入了解更改 word_separators 和各种查找和选择选项.长话短说,改变 word_separators 会改变双击的行为,正如你所指出的,但其他操作,包括 match_selection,依赖于一个显然可以的内部单词分隔符列表用户不得更改.因此,当您双击选择一个 PHP 变量时,您将选中 $,但不会突出显示该变量的其他实例.但是,当使用 CtrlD 进行多项选择时,它们被选中:

Please see my answer to this question for an in-depth look at the effect of changing word_separators and various find and select options. Long story short, altering word_separators changes the behavior of double-clicking, as you noted, but other operations, including match_selection, rely on an internal word separators list that apparently can't be altered by the user. So, when you double-click to select a PHP variable, you'll get the $ selected, but other instances of the variable won't be highlighted. They will be selected when using CtrlD to make multiple selections, however:

此外,当使用Find对话框时,其他实例将被突出显示:

Additionally, when using the Find dialog, other instances will be highlighted:

因此,为了解决您的原始问题,如果您需要查看当前选定变量的所有实例,请在您的用户首选项中设置 "find_selected_text": true,双击以选择您的感兴趣的变量,然后点击 CtrlF(F 在 OS X 上)以查看所有事件.请确保您没有选择正则表达式搜索按钮,因为 $ 在正则表达式中具有特殊含义.

So, to address your original problem, if you need to see all the instances of the currently-selected variable, set "find_selected_text": true in your user preferences, double-click to select your variable of interest, then hit CtrlF (F on OS X) to view all occurrences. Just make sure you don't have the regex search button selected, as $ has a special meaning in regexes.

这篇关于双击高亮变量 Sublime Text 3 包括 $的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆