+19

"find whole word" for variables

U N. hace 13 años actualizado por Felix Lange hace 13 años 2

Currently, "find" with "whole word" option enabled doesn't allow to match php variables ($var) and some of ruby variables (@var, @@var) (if the whole variable is searched ("$var"), not the alphanumeric part ("var")). I do kindly request a way to make these match, possibly involving the accordingly adjusted word_separators list.

For the details as to how and why I tried to deal with a similar scenario in a plugin, please see https://github.com/SublimeText/WordHighlight/pull/2

I may have been not complete clear, but I'm not asking for the specific fix, but to mend the whole inconsistency on what is actually a word. For example, if one adjusts word_separators to exculde '$', then move-by-word-forward (ctrl+right) and move-by-word-backward work as expected, treating '$var' as a word. Find with "whole word" flag, however, doesn't

Modifying word_separators also breaks "Select More". While it works from the menu (clicking Selection→Select More), the shortcut (⌘D on Mac OS X) fails.


Steps to reproduce this problem:

1. remove '?' from word_separators

2. move cursor inside word "?MODULE"

3. press ⌘D, ST2 selects the whole word "?MODULE"

4. press ⌘D again, status bar shows "unable to find \b\?MODULE\b"