I just switched from eclipse to Notepad++ and I modified some behaviour of notepad, but there is still one not resolved : When I double-click on a variable I expect my editor to catch the entire variable. Notepad excludes automatically the php prefix "$", that is not efficient. Is there a way I can change the behaviour ?
Thank you
As of version 7.3.1 (released on 17 Jan 2017) they have added a simple way of doing this. Quoting from the release notes,
An enhancement for customizing of Word characters is added in this version: While double-clicking to select or searching with "Match whole word only" option, the selected characters stop on non-word characters. With this enhancement, users can include any non-word character into word character set, in order to change its default behaviour.
To enable it, go to Settings -> Preferences -> Delimiter, choose "Add your character as part of your word", and add a dollar sign ($
) in the text box. Close and it works!
Here is how you can select the whole $php_variable / $word in Npp, including the '$' sign, with Alt + Click:
EDIT: I realize now that you can do skip the Npp macro and do it only with AutoHotKey. But I'll leave the macro anyway in case smb likes it. For more details look into the AutoHotkey.chm, in the contents tab, navigate to: Kheyboard Control >> Send/SendRaw...
Do not put spaces between the {LButton}{...} or they will be inserted into the editor (the space after the comma seems ok).
It would probably go something like this (havent tested it).
!LButton::
Send, {LButton}{CTRLDOWN}{LEFT}{CTRLUP}{LEFT}{CTRLDOWN}{SHIFTDOWN}{RIGHT}{RIGHT}{SHIFTUP}{CTRLUP}
return
END EDIT
I have finally done this with the help of
The macro:
$php_varia|ble
)The Autohotkey script:
; alt + click translated to Click followed by Ctrl Shift Alt B
!LButton::
Send, {LButton}{CTRLDOWN}{SHIFTDOWN}{ALTDOWN}b{ALTUP}{SHIFTUP}{CTRLUP}
return
Now when you Alt + Click on a php variable in NPP it will select all of it, including the '$' sign.
I also have script for Copy / Cut / Paste by Ctrl + LMouseBtn / Ctrl + Shift + LMouseButton / Ctrl + RMouseButton:
^RButton::
Send, {CTRLDOWN}v{CTRLUP}
return
^LButton::
Send, {CTRLDOWN}c{CTRLUP}
return
^+LButton::
Send, {CTRLDOWN}x{CTRLUP}
return
; the plus sign means the Shift key, etc
; see 'Keyboard control' >> 'Hotkeys and Hotstrings' in the Autohotkey help.chm
I understand your problem, but unfortunately it is not possible with Notepad++ to setup this behaviour.
What you can do is click between the dollar sign and the variable name. Then you will grab the whole variable as long as there is no special character before the dollar sign (for example [$var]
).
I've created a macro that writes $
and then paste whatever it is in the clipboard, then assigned a shortcut to that macro ctr+alt+v.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With