If you use VS Code at 42, this will probably interest you! 🔥
I had a bit of fun creating custom snippets to improve my workflow at 42 🤓 and wanted to share them with the 42 community! 🤗
You'll simply need to copy the snippet files in your computer. Yes, that's about it. 👌
Depending on your OS, your user snippets are located here:
- Windows:
%APPDATA%\Code\User\snippets
- Mac:
$HOME/Library/Application Support/Code/User/snippets
- Linux:
$HOME/.config/Code/User/snippets
WARNING
To quickly copy these sweet snippets, execute the upload command for your OS:
- Mac:
sh upload_mac.sh
- Linux:
sh upload_linux.sh
What it does: creates a Norminette-approved boilerplate to comment a function. No more excuses not to comment your code 👀
Prefixes to use it: new_comment
or nc
What it does: creates a boilerplate main to help you during your intense debugging section 🐛
Prefixes to use it: main
or int main
What it does: creates a printf statement with the variable name you have on your clipboard. You just have to input its type and you are all set to find your bug 🐛
Prefixes to use it: printf_w_var_name
What it does: creates a printf statement with the name of your file (e.g. in ft_itoa.c see below)
Prefixes to use it: printf_w_func_name
What it does: creates a simple boiler-plate printf statement
Prefixes to use it: printf_wo_func_name
What it does: adds an include with the same header file name as your current file (e.g. in ft_test.c: #include "ft_test.h"
)
Prefixes to use it: include_custom
or ic
What it does: simply adds #include "libft.h
Prefixes to use it: include_libft
or il
What it does: creates the boiler-plate ifndef define endif
based on the name of your file
Prefixes to use it: new_header_file
or nhf
If you want to tweak these snippets to your liking or even create brand new ones, here are ressources to help you!
- VS Code's own documentation (https://code.visualstudio.com/docs/editor/userdefinedsnippets)
- A Snippet generator that works for VS Code, Sublime Text and Atom (https://snippet-generator.app/)
Have fun with it!