[ADD][VIM] C header guard snippet

This commit is contained in:
Bruno BELANYI 2020-08-19 15:51:25 +02:00
parent 0178fe9c44
commit 99c5a8148c
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
snippet once "Include header once only guard"
#ifndef ${1:`!p
if not snip.c:
import random, string
name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper()
snip.rv = name.upper()
else:
snip.rv = snip.c`}
# define $1
${0}
#endif /* !$1 */
endsnippet