ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Splunk Conf File Syntax Highlighting

Syntax highlighting for Splunk .conf files in Sublime Text 2 & 3

Labels language, syntax

Details

Installs

  • Total 6K
  • Win 3K
  • Mac 2K
  • Linux 1K
Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8
Windows 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 0 1 0 0 3 0 0 0 0 0 0 1
Mac 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 2 0 0 0 1 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime Text syntax highlighting for .conf files

Sublime Text is awesome! But, there's no great way to get syntax highlighting for a Splunk .conf file… until now!

It works with Sublime Text 2 & 3!

Before

before

After

after

Installation

  • Install it from Package Control - search for Splunk Conf File Syntax Highlighting

Manual Installation

  • Clone the repo
  • cd sublime-splunk-conf-highlighting

Sublime Text 2

  • cp splunk-conf.tmLanguage ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/user/splunk-conf.tmLanguage

Sublime Text 3

  • cp splunk-conf.tmLanguage ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/user/splunk-conf.tmLanguage

Patterns

Patterns are used to identify some part of a file.

Patterns used by this package:

  • ^# DO NOT EDIT THIS FILE\\!$ - marks any lines as invalid if they are # DO NOT EDIT THIS FILE!
  • ^#.*$ - marks any lines that start with # as a comment
  • ^\\[.*\\]$ - marks any line starting with [ and ending with ] as a stanza
  • ^[\\w+\\.\\-\\:]+ - marks the beginning of a line as a conf key; defined by any whitespace, alphanumeric, - or : characters
  • = - marks any = as an equals sign

Patterns have 3 main attributes:

  • match (or, begin and end): regex patterns
  • name: a TextMate language grammar group, comment.line for an inline comment
  • comment: a comment about the pattern

Resources

Development Notes

There are 2 important files here:

  • splunk-conf.YAML-tmLanguage - The AAAPackageDev package compiles this to the following, this YAML file is much easier to use
  • splunk-conf.tmLanguage - This is a TextMate language definition file in XML format. SublimeText uses this format, it's a necessary evil.

  • Install package control if you haven't already

  • cmd + shift + P (Mac) or ctrl + shift + P (Windows)

    • Install package
    • AAAPackageDev
  • Open splunk-conf.YAML-tmLanguage

  • cmd + B should update splunk-conf.tmLanguage, make a small change and see if it worked. If not, play with your build system settings under Tools -> Build System

  • During development you'll need to constantly copy the splunk-conf.tmLanguage into your Sublime Text package folder, like so: cp splunk-conf.tmLanguage ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/user/splunk-conf.tmLanguage

  • If something doesn't seem to update, quit & reopen Sublime Text and it should work.