Skip to content

Commit

Permalink
Added snippet example for environment variables (#219)
Browse files Browse the repository at this point in the history
I wanted to use an environment variable in a substitution but couldn't figure out how because the docs didn't explicitly mention that this was possible and they didn't give an example. This PR adds that missing information.
  • Loading branch information
TW80000 authored and FichteFoll committed Aug 31, 2016
1 parent bb56944 commit 8a3b312
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion source/extensibility/snippets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ The substitution syntax has the following syntaxes:
- ``${var_name/regex/format_string/options}``

**var_name**
The variable name: 1, 2, 3...
The variable name: 1, 2, 3... or an environment variable such as TM_FILENAME or SELECTION.

**regex**
Perl-style regular expression: See the `Boost library documentation for
Expand Down Expand Up @@ -270,3 +270,15 @@ It also illustrates that replaces may occur before the actual tabstop.
Transformation: Text In Snail Case
Original: text_in_snail_case
You can also use environment variables with substitutions:

.. code-block:: perl
# In file MyModule.js:
Transformation: ${TM_FILENAME/(\w+)\.js/\1/g}
# Output:
Transformation: MyModule

0 comments on commit 8a3b312

Please sign in to comment.