Author Topic: Lock C macro definitions to leftmost column  (Read 193 times)

smartin

  • Senior Community Member
  • Posts: 104
  • Hero Points: 3
Lock C macro definitions to leftmost column
« on: July 24, 2020, 01:55:43 pm »
Hi all.
Does anyone know how to do this? I assume that it can be done. The idea is that as I write #if, #define, etc this will automatically be placed on the left most column. Additionally if it can be locked there during beautify, reindent, etc it would be perfect.
Cheers.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5549
  • Hero Points: 449
Re: Lock C macro definitions to leftmost column
« Reply #1 on: July 24, 2020, 02:03:16 pm »
The default beautifier profile for C++ places preprocessor statements at the far left. Tools>Beautify>Beautify (Default)

Smart editing doesn't currently automatically unindent preprocessing as you type. Interesting idea though especially since the beautifier is configured that way.

smartin

  • Senior Community Member
  • Posts: 104
  • Hero Points: 3
Re: Lock C macro definitions to leftmost column
« Reply #2 on: July 24, 2020, 02:31:58 pm »
I currently have beautify set to keep # in left most column, however it indents the rest of the preprocessor command, unless I set "Indent preprocessing directives" in which case the example code seems to show "#if" leftmost but "#    define" indented. Not quite what I expected.

With regards smart editing there are a few editors out there that unindent preprocessing whilst editing.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5549
  • Hero Points: 449
Re: Lock C macro definitions to leftmost column
« Reply #3 on: July 24, 2020, 03:02:08 pm »
If you can't get the beautifier to do what you want for preprocessing, please post a small sample of the before and after you want.

rowbearto

  • Senior Community Member
  • Posts: 1807
  • Hero Points: 121
Re: Lock C macro definitions to leftmost column
« Reply #4 on: July 24, 2020, 03:27:15 pm »
My personal preference is to not have the # in the leftmost column, I find it very hard to read. I like to indent macros with # just like C code. For example when I use #if/#endif I will keep it at the current indentation level and indent inside of it just like it was a C if statement.

hs2

  • Senior Community Member
  • Posts: 2749
  • Hero Points: 289
Re: Lock C macro definitions to leftmost column
« Reply #5 on: July 24, 2020, 08:05:20 pm »
Me too. Thankfully it’s / should be an option  :)