-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.orig
29 lines (23 loc) · 966 Bytes
/
README.orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Scriptname: AddIfndefGuard
Version: 0.1
Licence: This script is in the public domain.
Author/Maintainer: Rory McCann <ebelular at gmail dot com>
DESCRIPTION:
When one writes a header file for C/C++, compile errors will occur if the
same header script is included more than once. A common solution is to add
#ifndef FILENAME_H
#define FILENAME_H
to the start of a file, and
#endif
to the end. This solves the problem.
However this is mechanical and routine. So the computer should do it. So here's
a script to do it.
It will add those lines to the top of the file you call it in. It will
change FILENAME to be the uppercase name of that file, ommiting the file
extension. It will not (yet) check to see if a #define/#ifndef/#endif
black has already been added. It will not check the filename, so it can be
called on anyfile.
INSTALL:
Place AddIfndefGuard.vim to the plugins directory. (On UNIX it's ~/.vim/plugins/)
USAGE:
:call AddIfndefGuard()