- **Epistemic status:** #budding Code snippets are re-usable source code that allows the user to avoid repetitive typing when working with source-code. The snippets can be integrated with a snippet manager with some text editors and IDE's (See the guides for your favorite text editor [[#^66f633]]). ## Benefits of using code snippets - Saves you time from unnecessary keystrokes (Your wrist will thank you) - There are instances where code is highly complex or requires a lot of boilerplate and having a code snippet can reduce formatting and syntax error keeping your code consistent - They can be shared with your coworkers and the world ## Structure of code snippets - **Title:** Title of the snippet (duh) - **Prefix:** Prefix that you are going to type to trigger the snippet in the code editor - **Body:** Code that will be pasted on the space that you call the snippet with the prefix - **Description:** Description to have some context on what the snippet does ## Code snippet guides for popular code editors ^66f633 - [VSCode](https://code.visualstudio.com/docs/editor/userdefinedsnippets) - [Atom](https://flight-manual.atom.io/using-atom/sections/snippets/) - Vim - [UltiSnips](https://github.com/sirver/UltiSnips) - [vim-snippets](https://github.com/honza/vim-snippets) --- ## References - DEV Community. “Code Snippets - A Beginner’s Guide.” Accessed June 30, 2022. <https://dev.to/matthewbrophy/code-snippets---a-beginners-guide-p4d>. - “Snippet (Programming).” In _Wikipedia_, May 3, 2022. <https://en.wikipedia.org/w/index.php?title=Snippet_(programming)&oldid=1085945801>.