From fd2cfa07643cfde45e9009c8402e6a7ffb62e7e4 Mon Sep 17 00:00:00 2001 From: Chris Bogaards Date: Wed, 7 May 2014 02:00:28 +0200 Subject: [PATCH 1/3] Added a menu option under 'Tools' for opening hosts file --- Main.sublime-menu | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Main.sublime-menu b/Main.sublime-menu index 47a0cb2..2061c9e 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -1,4 +1,15 @@ [ + { + "caption": "Tools", + "id": "tools", + "children": + [ + { + "command": "open_hosts_file", + "caption": "Open Hosts File" + } + ] + }, { "caption": "Preferences", "mnemonic": "n", From f1adb895b79e9296e8ed7670b1f648e99442830d Mon Sep 17 00:00:00 2001 From: Chris Bogaards Date: Wed, 7 May 2014 02:01:10 +0200 Subject: [PATCH 2/3] Removed comment from JSON. JSON does not support comments. --- SublimeHostsEdit.sublime-settings | 1 - 1 file changed, 1 deletion(-) diff --git a/SublimeHostsEdit.sublime-settings b/SublimeHostsEdit.sublime-settings index d24348f..461adbb 100644 --- a/SublimeHostsEdit.sublime-settings +++ b/SublimeHostsEdit.sublime-settings @@ -1,5 +1,4 @@ { - //PATH to `hosts` file depending on system "windows_hosts_file_location": "C:/Windows/System32/drivers/etc/hosts", "linux_hosts_file_location": "/etc/hosts", "osx_hosts_file_location": "/private/etc/hosts" From 76dfcacbce6026e49ee86fda41c31d46ebd000ac Mon Sep 17 00:00:00 2001 From: Chris Bogaards Date: Wed, 7 May 2014 02:03:45 +0200 Subject: [PATCH 3/3] Added JSON versions for tmPreference and tmLanguage files for easy modification Also re-build the tmLanguage file to include correct DOCTYPE --- syntax/Comments.JSON-tmPreferences | 13 +++++++++++++ syntax/Host Config.JSON-tmLanguage | 23 +++++++++++++++++++++++ syntax/Host Config.tmLanguage | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 syntax/Comments.JSON-tmPreferences create mode 100644 syntax/Host Config.JSON-tmLanguage diff --git a/syntax/Comments.JSON-tmPreferences b/syntax/Comments.JSON-tmPreferences new file mode 100644 index 0000000..f0ba3dd --- /dev/null +++ b/syntax/Comments.JSON-tmPreferences @@ -0,0 +1,13 @@ +{ + "name": "Comments", + "scope": "source.hosts-config", + "settings": { + "shellVariables": [ + { + "name": "TM_COMMENT_START", + "value": "# " + } + ] + }, + "uuid": "E6CBDBA3-30DC-4EBD-B4DD-2527FBEED52A" +} \ No newline at end of file diff --git a/syntax/Host Config.JSON-tmLanguage b/syntax/Host Config.JSON-tmLanguage new file mode 100644 index 0000000..e855ded --- /dev/null +++ b/syntax/Host Config.JSON-tmLanguage @@ -0,0 +1,23 @@ +{ + "fileTypes": [ + "hosts" + ], + "name": "Hosts Config", + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.definition.comment.source.hosts-config" + } + }, + "name": "comment.line.number-sign.source.hosts-config", + "match": "(#).*$\\n?" + }, + { + "name": "constant.source.hosts-config", + "match": "^[\\d|\\.]+" + } + ], + "scopeName": "source.hosts-config", + "uuid": "783C4FE3-EF25-41F2-9AF4-B6094E9927A2" +} \ No newline at end of file diff --git a/syntax/Host Config.tmLanguage b/syntax/Host Config.tmLanguage index 712949b..f3094d5 100644 --- a/syntax/Host Config.tmLanguage +++ b/syntax/Host Config.tmLanguage @@ -1,5 +1,5 @@ - + fileTypes