Getting to know a snippet
As developers, we all get to write the same short code fragments over and over again on different files and projects. The best example of this is the following code:
<!DOCTYPE html> <html> <head> <title> My cool Website </title> </head> <body> <p> Hello World! </p> </body> </html>
We all have written something similar so many times. That's why Sublime has the snippets feature. Snippets are smart templates that insert the right text when we need it, where we need it.
Let's see this example live by using Lorem ipsum. We have this empty HTML page that we wrote using our awesome, fast fingers. Now we want to enter some placeholder text inside the <p>
tags, as shown in the following screenshot:
We just type the trigger letter for our snippet, in this case l, and we get all the options. Pressing Tab will insert the snippet as shown in the following screenshot:
Yes! We now have a Lorem ipsum...