Double click highlight variable Sublime Text 3 include $

冷暖自知 提交于 2019-12-04 10:13:52

问题


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

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

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.


回答1:


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:

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

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.



来源:https://stackoverflow.com/questions/25613424/double-click-highlight-variable-sublime-text-3-include

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!