Home Download Buy Blog Forum Support

[SOLVED] Highlighting variables including the dollar symbol?

[SOLVED] Highlighting variables including the dollar symbol?

Postby bigcakelover on Wed Nov 02, 2011 4:22 pm

Hi

Is there a way to specify the rules for highlighting words and variables using - for example - Ctrl+D or double clicking a word?

What I mean is, if you have a variable like $example, double clicking this would highlight everything including its dollar symbol so you can copy/paste it without having to first type an additional dollar symbol.

The current behaviour is, if you double click $example, only "example" is highlighted and the dollar symbol is not.

Also, in the same vein, can you specify "smart highlighting" or "smart caret positioning" so that if you have a variable with underscores or camelCase, double clicking only highlights a certain part of the variable? For example: $example_with_underscores or $exampleWithCamelCase would only highlight "with" if I double-clicked on "_with_"? Then if I double clicked again, it would proceed to select the entire variable?

Thanks
Last edited by bigcakelover on Wed Nov 02, 2011 8:19 pm, edited 1 time in total.
bigcakelover
 
Posts: 6
Joined: Wed Nov 02, 2011 4:18 pm

Re: Highlighting variables including the dollar symbol (Ctrl+D)?

Postby DSHugo on Wed Nov 02, 2011 7:53 pm

For the first part of the question, you'd have to adjust the `word_separators` setting to not include `$` sign. However, if you aim for a more-or-less consistent php support, you will currently not get one. E.g. "find" + "whole word" does not take `word_separators` into account, which gets in the way of replacing variables, and does not help one single bit (see userecho entry, and please vote if it applies to you).

The second part is tricker, there is probably no way to do what you want without writing a plugin to expand selection accordingly.
DSHugo
 
Posts: 42
Joined: Tue Sep 20, 2011 11:05 am

Re: Highlighting variables including the dollar symbol (Ctrl+D)?

Postby bigcakelover on Wed Nov 02, 2011 8:19 pm

DSHugo wrote:For the first part of the question, you'd have to adjust the `word_separators` setting to not include `$` sign.

Brilliant. This worked. Adding "_" to that list also allows separate highlighting of underscored terms in variables, but as you said, modifications would be needed to get it to "expand selection" as I wanted. Thanks!
bigcakelover
 
Posts: 6
Joined: Wed Nov 02, 2011 4:18 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 20 guests