I made a generic INI file syntax highlighting package.
INI.tmLanguage.zip (636 Bytes)
Accounts for quoted property names and/or values containing “=”
Hope you can find it useful! Let me know if you have any suggestions.
I made a generic INI file syntax highlighting package.
INI.tmLanguage.zip (636 Bytes)
Accounts for quoted property names and/or values containing “=”
Hope you can find it useful! Let me know if you have any suggestions.
Heh, I was just looking for one the other day. Ended messing with a version from the TM repository, though mines more for rainmeter. Not sure if you’d want to mess around with yours to make it good for that. My attempt was rather hackish as I’m not too experienced with regEx.
I need to correct a problem with this file comments that begin with
; space comment
; Enable the PHP scripting language engine under Apache.
engine = On
; Enable compatibility mode with Zend Engine 1 (PHP 4.x)
zend.ze1_compatibility_mode = Off
; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
show up as comments in my ini files but what do I edit in this files so that comments that start with
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server 4.1). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"
shows up as actual comment in ST?
It appears that this
^(;).*$\n?
controls the semicolon, but it also needs to include comments that begin with #
I tried ^#;].*$\n?
but that did not work
Nvrmnd: needed to open and close ST
Awesome, thanks.
Jon should add this to the next build.
I opened a UserEcho request for it here.
[quote=“capnhud”]I need to correct a problem with this file comments that begin with
; space comment
; Enable the PHP scripting language engine under Apache.
engine = On
; Enable compatibility mode with Zend Engine 1 (PHP 4.x)
zend.ze1_compatibility_mode = Off
; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
show up as comments in my ini files but what do I edit in this files so that comments that start with
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server 4.1). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"
shows up as actual comment in ST?
It appears that this
^(;).*$\n?
controls the semicolon, but it also needs to include comments that begin with #
I tried ^#;].*$\n?
but that did not work
Nvrmnd: needed to open and close ST[/quote]
You may use
^(;|#).*$\n?
It works for me
Thanks to TS for making this one.
[quote=“hgraca”]Hi,
this seems to be what I want, but where do I put that xml file?
tkx[/quote]
Create a folder named “INI” in your-sublime-text-folder/Packages/
and put the extracted file “INI.tmLanguage” there.
Can the comment highlighting in this be modified to include comments that do not start on the beginning of the line?;
key = value ; tab key value comment
*edit: Upon further research I found that is not valid INI code. I did still want to be able to have a commented line that started with a space or tab, so I used another language file to come up with this:
^\s*(;|#).*$\n?[/code] instead of [code]^(;).*$\n?
I prefer to follow this convention of allowing semicolon comments anywhere on the line. I have created a fork of clintberry sublime-text-2-ini package that includes syntax highlighting for comments anywhere on the line.
github.com/robertcollier4/sublime-text-2-ini
Or just view the diff of the changes made here.
Note: have also added the .reg extension to fileTypes detection - the INI syntax highlighting works great for Windows Registry Scripts as well.
Anyone knows if there’s a successor plugin for ST3? That github repo ^ gives a 404
Not sure if it is a successor, but I use https://github.com/clintberry/sublime-text-2-ini
Like @deathaxe, I also have that INI package installed, but most of the time I prefer to use the built-in Git Formats > Git Config language.
In case it might be useful for anyone here; I made a syntax definition for INI files for myself a while ago at https://github.com/jwortmann/ini-syntax, because I was not satisfied with the existing INI package on Package Control mentioned by @deathaxe above. It especially has enhanced highlighting for Windows Registry files, here is an example:
Like e.g. the built-in JSON syntax it uses the string
scope for both key names and values, which means that you might need to extend your color scheme with a rule for meta.mapping.key string
if you want different highlighting colors for keys and values (at least the built-in color schemes don’t have such a rule).