├── Comment.tmPreferences ├── Cisco Definitions.json-tmLanguage ├── README.md └── Cisco Definitions.tmLanguage /Comment.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Comment 7 | scope 8 | text.cisco 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_COMMENT_START 16 | value 17 | ! 18 | 19 | 20 | 21 | uuid 22 | C831BAED-BA65-4F98-AE9A-553CE36EF999 23 | 24 | -------------------------------------------------------------------------------- /Cisco Definitions.json-tmLanguage: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cisco", 3 | "scopeName": "text.cisco", 4 | "fileTypes": ["cfg","txt"], 5 | "patterns": [ 6 | 7 | { "match": "^\\s*no ", 8 | "name": "invalid.illegal.cisco" 9 | }, 10 | 11 | { "match": "access-list", 12 | "name": "support.function.cisco" 13 | }, 14 | 15 | { "match": "crypto ", 16 | "name": "string.unquoted.cisco" 17 | }, 18 | { "match": "any", 19 | "name": "string.unquoted.cisco" 20 | }, 21 | { "match": "deny ", 22 | "name": "support.constant.cisco" 23 | }, 24 | 25 | { "match": "permit ", 26 | "name": "constant.character.escape.cisco" 27 | }, 28 | { "match": "object-group", 29 | "name": "markup.list.cisco" 30 | }, 31 | { "match": "object", 32 | "name": "markup.list.cisco" 33 | }, 34 | 35 | { "match": "host", 36 | "name": "markup.list.cisco" 37 | }, 38 | 39 | { "match": "^[\\s]*!(.*)", 40 | "name": "comment.cisco" 41 | }, 42 | { "match": "static", 43 | "name": "constant.numeric.cisco" 44 | }, 45 | 46 | { "match": "tunnel-group", 47 | "name": "support.class.cisco" 48 | }, 49 | 50 | { "match": "crypto", 51 | "name": "support.class.cisco" 52 | }, 53 | 54 | { "match": "\\d+\\.\\d+\\.\\d+\\.\\d+(/\\d{1,2})?", 55 | "name": "constant.numeric.cisco" 56 | }, 57 | 58 | { "match": "[0-9a-fA-F]{0,4}:([0-9a-fA-F]{0,4}:)+[0-9a-fA-F]{0,4}(/\\d{1,3})?", 59 | "name": "constant.numeric.cisco" 60 | } 61 | 62 | ], 63 | "uuid": "f3ba50f0-2bad-48b7-9509-f6d72e353ddb" 64 | } 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cisco syntax package for Sublime Text 2 2 | 3 | Sublime Text 2 Syntax Definitition for Cisco router/switch/firewall configurations. This package will highlight Cisco configuration and commands within Sublime Text 2. 4 | 5 | ## Installing 6 | 7 | **Using Package Control:** If you have [package control](https://sublime.wbond.net/) installed then installing this is a snap. Simply open the command palette (Tools->Command Palette). Then type "install" then search for this plugin by typing "Cisco Syntax Highlighter". That's it. It should be installed. 8 | 9 | **Without Git:** Download the zip from github, and extract the files to your Sublime Text "Packages" directory, into a new directory named `Cisco`. You can find the packages directy by going to Preferences -> Browse packages, within Sublime Text 2. 10 | 11 | **With Git:** Clone the repository in your Sublime Text "Packages" directory: 12 | 13 | git clone git://github.com/tunnelsup/sublime-cisco-syntax.git 14 | 15 | ## Usage 16 | Once installed navigate to View->Syntax->Cisco to apply the Cisco syntax to the document. 17 | 18 | This syntax definition will automatically be applied to .txt files and .cfg files. 19 | 20 | Using control-/ will comment out any line that is highlighted. 21 | 22 | 23 | ## Customizing 24 | Once Cisco syntax is turned on you can then try different color schemes by going to Preferences -> Color Schemes. 25 | 26 | If you wish to customize this even further for your own needs navigate to the Cisco package (Preferences -> Browse Packages). Edit the `Cisco Definitions.json-tmlanguage` file within Sublime Text 2. Install AAAPackageDev. After your changes go to Tools -> Build, to rebuild the syntax definitions. 27 | 28 | ## Further Reading 29 | See official website for further information and discussion. 30 | [http://www.tunnelsup.com/tup/2013/03/29/sublime-text-2-cisco-syntax-and-snippets](http://www.tunnelsup.com/tup/2013/03/29/sublime-text-2-cisco-syntax-and-snippets) 31 | 32 | -------------------------------------------------------------------------------- /Cisco Definitions.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | cfg 8 | txt 9 | 10 | name 11 | Cisco 12 | patterns 13 | 14 | 15 | match 16 | ^\s*no 17 | name 18 | invalid.illegal.cisco 19 | 20 | 21 | match 22 | access-list 23 | name 24 | support.function.cisco 25 | 26 | 27 | match 28 | crypto 29 | name 30 | string.unquoted.cisco 31 | 32 | 33 | match 34 | any 35 | name 36 | string.unquoted.cisco 37 | 38 | 39 | match 40 | deny 41 | name 42 | support.constant.cisco 43 | 44 | 45 | match 46 | permit 47 | name 48 | constant.character.escape.cisco 49 | 50 | 51 | match 52 | object-group 53 | name 54 | markup.list.cisco 55 | 56 | 57 | match 58 | object 59 | name 60 | markup.list.cisco 61 | 62 | 63 | match 64 | host 65 | name 66 | markup.list.cisco 67 | 68 | 69 | match 70 | ^[\s]*!(.*) 71 | name 72 | comment.cisco 73 | 74 | 75 | match 76 | static 77 | name 78 | constant.numeric.cisco 79 | 80 | 81 | match 82 | tunnel-group 83 | name 84 | support.class.cisco 85 | 86 | 87 | match 88 | crypto 89 | name 90 | support.class.cisco 91 | 92 | 93 | match 94 | \d+\.\d+\.\d+\.\d+(/\d{1,2})? 95 | name 96 | constant.numeric.cisco 97 | 98 | 99 | match 100 | [0-9a-fA-F]{0,4}:([0-9a-fA-F]{0,4}:)+[0-9a-fA-F]{0,4}(/\d{1,3})? 101 | name 102 | constant.numeric.cisco 103 | 104 | 105 | scopeName 106 | text.cisco 107 | uuid 108 | f3ba50f0-2bad-48b7-9509-f6d72e353ddb 109 | 110 | 111 | --------------------------------------------------------------------------------