Skip to content

esert/align_whitespace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Align Whitespace

Align C/C++ declaration, assignment, parameter, call, and macro blocks around the active cursor line.

Examples:

int a;
float b;

becomes:

int   a;
float b;
MyStruct foobar = {1, 2, 3};
YourStruct bax = {};
HisStruct baz = {5};

becomes:

MyStruct   foobar = {1, 2, 3};
YourStruct bax    = {};
HisStruct  baz    = {5};
int lerp(
    int a,
    int b,
    float r,
);

becomes:

int lerp(
    int   a,
    int   b,
    float r,
);
int x = lerp(1, 2, 0.5f);
float xx = lerp(11, 22, 1);

becomes:

int   x  = lerp(1,  2,  0.5f);
float xx = lerp(11, 22, 1   );
#define FOO(X) \
    X(a, 1, 2) \
    X(aa, 11, 22) \
    X(aaa, 111, 222)

becomes:

#define FOO(X)      \
    X(a,   1,   2)  \
    X(aa,  11,  22) \
    X(aaa, 111, 222)

Command

  • Align Whitespace: C/C++ Block

Default keybinding

  • F1 for *.cpp, *.cc, *.cxx, *.h, *.hpp

Notes

  • The alignment logic is implemented in python/align_cpp_block.py.
  • The extension shim in extension.js only registers the VS Code command and invokes Python.
  • The default Python command is python3. You can change it with the alignWhitespace.pythonCommand setting.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors