How to use /Word Select Include = in wordfiles to get non-word characters like $ and # interpreted as word characters?

How to use /Word Select Include = in wordfiles to get non-word characters like $ and # interpreted as word characters?

6,613548
Grand MasterGrand Master
6,613548

    Jun 10, 2018#1

    1. Introduction

    UltraEdit and UEStudio interpret by default characters according to Unicode standard on selecting a word or navigating caret with Ctrl+Left/Right Arrow to beginning of previous/next word.

    There are additionally following configuration settings at Advanced - Settings or Configuration - Editor display - Cursor / caret for Ctrl+Left/Right Arrow usage:
    • Underscore is word stop for Ctrl left/right arrow
    • CamelCase naming stops for Ctrl left/right arrow
    But in many programming and scripting languages non-word characters are often used in combination with word characters according to Unicode standard like the dollar sign $, the number sign # (hash), the hyphen -, or the braces { and }.

    It could be a time safer if selecting a word or navigating the caret to beginning of previous/next word would include those non-word characters in list of word characters as well.

    UltraEdit for Windows v25.10 and UEStudio v18.10 introduce /Word Select Include = directive in *.uew syntax highlighting wordfiles for customization of word selection/navigation in syntax highlighted files.

    The *.uew files installed with UltraEdit v25.10 and UEStudio v18.10 or any later version into subdirectory wordfiles in program files folder of UltraEdit and UEStudio do not contain /Word Select Include = directive. This directive must be added by every user who wants to include some non-word characters in list of characters which should be interpreted as word characters for word selection/navigation in syntax highlighted files.


    2. Preparation

    UltraEdit and UEStudio copy the entire wordfiles subdirectory in program files directory of UE/UES to application data directory %APPDATA%\IDMComp\UltraEdit respectively %APPDATA%\IDMComp\UEStudio on start if there is not already a wordfiles directory in the application data directory. So this directory/file copying is done usually only once per user account.

    UE and UES as of v20.00 and later do never replace existing files in %APPDATA%\IDMComp\UltraEdit\wordfiles respectively %APPDATA%\IDMComp\UEStudio\wordfiles as long as this directory exists without or with *.uew files on start of UE/UES.

    But the installer of UltraEdit for Windows and UEStudio installs and updates the *.uew files in wordfiles subfolder in program files folder of UE/UES which is usually write-protected for a user on using Windows standard settings and use default installation path.

    Therefore my recommendation is to first update manually the *.uew files in wordfiles subdirectory in application data directory of UltraEdit/UEStudio before making any customization depending on previous customizations on wordfiles.
    • No *.uew wordfile edited manually before in wordfiles subdirectory in application data directory:

      Copy the files usually installed into
      • %ProgramFiles%\IDM Computer Solutions\UltraEdit\wordfiles
      • %ProgramFiles(x86)%\IDM Computer Solutions\UltraEdit\wordfiles
      • %ProgramFiles%\IDM Computer Solutions\UEStudio\wordfiles
      • %ProgramFiles(x86)%\IDM Computer Solutions\UEStudio\wordfiles
      with Ctrl+A (select all), Ctrl+C (copy) and Ctrl+V (paste) to
      • %APPDATA%IDMComp\UltraEdit\wordfiles
      • %APPDATA%IDMComp\UEStudio\wordfiles
      with replacing the existing files with same name.
       
    • One or more *.uew wordfile edited manually before in wordfiles subdirectory in application data directory:

      Compare each *.uew file usually installed into
      • %ProgramFiles%\IDM Computer Solutions\UltraEdit\wordfiles
      • %ProgramFiles(x86)%\IDM Computer Solutions\UltraEdit\wordfiles
      • %ProgramFiles%\IDM Computer Solutions\UEStudio\wordfiles
      • %ProgramFiles(x86)%\IDM Computer Solutions\UEStudio\wordfiles
      with the matching *.uew file in
      • %APPDATA%IDMComp\UltraEdit\wordfiles
      • %APPDATA%IDMComp\UEStudio\wordfiles
      and merge the differences into the *.uew file in wordfiles subdirectory in application data directory which should be taken over according to your own decision from latest installed default wordfile for keeping the customizations.
    Users like me using a different wordfiles directory than predefined wordfiles subdirectory in application data directory according to a customization made at Advanced - Settings or Configuration - Editor display - Syntax highlighting have to take into account that UltraEdit/UEStudio never update the *.uew files in custom wordfiles directory. UltraEdit and UEStudio copy never the installed wordfiles into the custom wordfiles directory on start even if the configured wordfiles directory does not exist at all. So a custom wordfiles directory is completely managed only by the user.


    3. Preconditions

    There are some preconditions which should be known before adding /Word Select Include = directive into a *.uew file:
    1. Do not open a *.uew file using Windows Explorer or any other file manager. This could result in editing a *.uew file not read by UltraEdit/UEStudio. It is better to start UltraEdit/UEStudio, open Advanced - Settings or Configuration - Editor display - Syntax highlighting, select the language to modify in list of installed installed wordfiles, click on button Open to open the appropriate wordfile, and click on button Cancel to close configuration dialog without modification of any other setting.
    2. It is not possible to get a character included as word character if this character is also specified on the line starting with /Delimiters = in the wordfile. In other words it is not possible to include a non-word character for word selection/navigation which is explicitly defined as word delimiter for syntax highlighting.
    3. The configuration setting Underscore is word stop for Ctrl left/right arrow is by default checked and so caret navigation with Ctrl+Left/Right stops on underscores within a word. A checked Underscore is word stop for Ctrl left/right arrow can be overruled for a syntax highlighted file with specifying the underscore on line starting with /Word Select Include = in corresponding wordfile.
      It is not possible to overrule in the wordfile the opposite, i.e. get Ctrl+Left/Right stop on underscore if setting Underscore is word stop for Ctrl left/right arrow is not checked in configuration.
    4. The single space left and the single space right to equal sign after /Word Select Include are mandatory and not optional.

    4. Customizations

    Here is a language (wordfile) based list of perhaps useful customizations regarding to /Word Select Include = .

    I don't have recommendations for all languages installed with UltraEdit/UEStudio because I have not enough knowledge and example files for all languages.

    I invite every forum member to add a post to this topic with one more suggestions for useful customizations regarding to /Word Select Include = .


    4.1 Batch (batch.uew)

    /Delimiters = ! $tab&'()+/:;<=>[\]^`{|}
    /Word Select Include = #%*-.?_~

    Note: tab must be replaced in the wordfile by a horizontal tab character after pasting the suggested delimiters line from browser window into the wordfile.

    There is removed the asterisk *, the hyphen - and the dot . from list of delimiters.

    The . does not need to be a word delimiter for syntax highlighting of batch files in my opinion.

    The removal of * and - are more problematic because the asterisk is used in wildcard patterns as well as in arithmetic expressions and the hyphen at beginning of (Unix style) options and as minus sign in an arithmetic expression. On usage of * or - in an arithmetic expression with no spaces around, it would be better to get asterisk and hyphen interpreted as word delimiters. But I use spaces in arithmetic expressions around the operators for better readability. For that reason I prefer * being interpreted as word character to easier select wildcard patterns and - to easier select options starting with a hyphen by pressing Ctrl+J.

    The suggested word select include list makes it possible to quickly select wildcard patterns like File_???_*.*, batch file argument references like %~nx1, FOR loop variable references like %%~dpI, immediate expanded environment variable references like %COMPUTERNAME% and options like -n. And _ in word select include list overrules configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.

    I'm undecided regarding to removal of ! from delimiters list and adding the exclamation mark to word select include list for quick selection of delayed expanded variable references like !variable! in addition to %variable%. And I'm undecided regarding to adding " to word select include list for quick selection of "%variable%" with the double quotes. There are advantages and disadvantages which balance each other.


    4.2 C/C++ (c_cplusplus.uew)

    /Word Select Include = #_

    This directive with number sign (hash) and underscore is useful for quick selection of preprocessor directives like #include, #if, etc. and to overrule configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.


    4.3 C# (csharp.uew)

    /Word Select Include = #_

    This directive with number sign (hash) and underscore is useful for quick selection of preprocessor directives like #include, #if, etc. and to overrule configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.


    4.4 CSS (css.uew)

    /Word Select Include = #%-_

    This directive with number sign (hash), percent sign, hyphen and underscore is useful for quick selection of unique identifiers and color values starting with # like #title and #008000, percent values like 25%, CSS properties like font-family and to overrule configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.

    I'm undecided regarding to removal of . from delimiters list and adding the dot instead to word select list. That would make sense for quick selecting floating point values like 8.5em and for class definitions like .top6 or div.head.


    4.5 HTML (html.uew)

    /Delimiters = ! "tab$&'()*+,.:;<=>?@[\]^{|}~–— 
    /Word Select Include = %_

    Note: tab must be replaced in the wordfile by a horizontal tab character after pasting the suggested delimiters line from browser window into the wordfile.

    There is removed % from list of delimiters because I think for syntax highlighting the percent sign is not really necessary, except somebody likes percent values being highlighted with the value with the color for numbers and the percent sign with a different color. I don't have a problem with getting the percent sign after the value also highlighted with the color for numbers.

    The word select include list makes it possible to quickly select percent values like 25% and to overrule configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.


    4.6 JavaScript (javascript.uew)

    /Word Select Include = _

    This line just overrules configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.


    4.7 PHP (php.uew)

    /Word Select Include = $_

    The dollar sign in word select include list is for quick selection of PHP variables with $ (anywhere within a string of word characters, not only at beginning) and to override configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.


    4.8 PowerShell (powershell.uew)

    /Word Select Include = $-_

    The dollar sign $, the hyphen - and the underscore _ are added to word select include list for quick selection of variables and many other predefined keywords and to overrule configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.


    4.9 UNIX Shell Scripts (shell.uew)

    /Word Select Include = $_{}

    The dollar sign $, the underscore _ and the braces { and } are set as word select include for quick selection of variables like $variable and ${App_Path} and to overrule configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default.


    4.10 IDM Wordfiles (wf.uew)

    /Word Select Include = /_

    This definition makes it possible selecting quickly /C1, /TGFindStr, etc. and overrule configuration setting Underscore is word stop for Ctrl left/right arrow if being checked as by default for faster caret navigation by word on keywords like CSS_LANG, C_LANG, etc.


    5. Caret navigation example

    The caret positions on using Ctrl+Right starting from beginning of the line or Ctrl+Left starting from end of the line marked with | in the PHP code line below are
    • in first line without /Word Select Include = $_ in php.uew and
    • in second line with /Word Select Include = $_ in php.uew
    |$|limit |= |$|aData|['|limit|'];|
    |$limit |= |$aData|['|limit|'];|
    Best regards from an UC/UE/UES for Windows user from Austria