# Align C preprocessor definitions

How do I align C preprocessor definitions using vim's Align plugin?

Something like:

#define ORING 'r'
#define OLRING "ring"


where the string 'r' should be aligned with "ring".

I don't find any example like this at http://www.drchip.org/astronaut/vim/align.html#Examples they all use a separator like =.

I have tried :Align \tsp which might work because it aligns on whitespaces, but nothing happens.

Thank you

• Why don't you simply insert a space before 'r'? – romainl Apr 19 '16 at 20:51

You can use :<range>Align \s which will use the white spaces as separators. It will give you the following:
#define   ORING    'r'

To align only the part between the quotes you can use: :<range>Align $$'\|"$$.* which means "align starting on ' or " and all characters following it". This gives the following:
#define ORING  'r'