In snippet Get Element, when i type get and push tab, it will show
getElementsByTagName('')
and the letter T is highlight and editable, then typed letter I, it will change to
getElementById('')
automatically.
I want to create a snippet which can toggle text by the letter i typed, just like the snippet Get Element do, but i can't find where the snippet location.
Anyone know its location or know how to create a snippet like that?
The snippet is inside the archived JavaScript package, which is located in the installation directory, and then
Packages/JavaScript.sublime-package. Inside that package, the file's name isSnippets/Get-Elements.sublime-snippetand it has the following contents:Basically, it works with conditional replace format strings. You can find the documentation for those in the boost regex docs, however I suggest to just have two different snippets in this situation with the triggers
gettandgetirespectively, since those still require the same number of key strokes but are way easier to create and maintain.You can open archived resource files like this easily with the PackageResourceViewer package.
Details on what archived packages are: http://docs.sublimetext.info/en/latest/extensibility/packages.html