environment msdn documentation, gvim, C#
problem I want legacy C defines like this to be represented by a nice C# enum.
solution
- Copy the table from msdn containing the #define names, values and comments to gvim
- Use this regular expression
%s#\\v(\\u)([A-Z_]+) (0x\\d+)L (.*)#^M///<summary>^M/// \\4^M///</summary>^M\\1\\L\\2 = \\3,#
- Paste into your C# file
Notes
- \v sets vim to very magic mode - fear - so the () don't have to be escaped.
- \u matches uppercase characters.
- ^M is a new line - on Windows use "Strg+Q Enter" to get it.
- \L\2 changes the contents of the succedding back reference to lower case.