A number of Notepad++ commands - word selection, moving to next or previous word, and some other - rely on a definition of what a word is. Well, a word is a contiguous sequence of word characters. Now what is a word character?
By default, a word character is either one of the 26 basic roman alphabet letters in either case, a digit or the underscore. Also included are all haracters in the 0x80..0xFF range, which allows accented letters to be taken as word characters in any ANSI or UTF-8 encoding. For files in some Unicode mode, any character with a cde above 256 is considered to be a word character - even when there is no corresponding glyph!
Sometimes, this is not enough, because osome prohramming languages consider some non alphanumeric characters to be part of identifiers - for instance, PHP variable names start with a $ sign -. And you may want o avoid adjusting the seletion when it didn't include such signs.
There is a workaround involving directly writing some macro definitions in shortcuts.xml so as to define macros you couldn't possibly record from the keyboard. They are to be inserted right after the <Macros> tag in the file:
The following macro defines the set of racters making up words:<p>
<Macro name="wordchars" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type="1" message="2077" wParam="0" lParam="0" sParam=your char set as a string> </Macro>
For instance, the string that would just add the $ sign to the standard set is "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345679_$". While humans expect a sorted string without repetitions, Scintilla doesn't care. <p>Since macros do not have paramegetrs, you'll have to define one macro per nonstandard character set.
- The same can be done for whitespace characters, but the need to define extra white space is probably more limited:
<Macro name="wschars" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type="1" message="2443" wParam="0" lParam="0" sParam=your char set a a string> </Macro>
<p>Like for the previous macro, you need to define one variant for every desired non standard set. If you wish to use this macro, you MIST define the word characters first.
- The following resets characters for words and whutespace to default. It is strongly recommended to define it, in case anything goes wrong with your nonstandard definitions:
<Macro name="resetchars" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type=0 message="2444" wParam="0" lParam="0" sParam=""> </Macro>
Throughout this wiki, macros of this kind are assigned to Ctrl+Alt+Numpad 4 , expecting not toupset any user settings. The name and shortcut of any macro can be changed from the Shortcut mapper - and you can even remove the keyboard shortcut if you wish.The use of PythonScript to automate the process of word customisation is described at length in https://sourceforge.net/p/notepad-plus/discussion/331754/thread/9d0a9b7e/ .