Is it possible to get emacs style indenting in Notepad++?
Specifically, I like how emacs indents up to the nearest open parentheses or brace. For example, if I'm defining a function in C++, and I want each argument on a separate line, emacs indents each parameter up to the open parentheses that holds all the arguments.
int my_function( double num1,
double num2,
double num3 )
In emacs, "double num2" and "double num3" would be indented when I hit the tab key to line up with "double num1". This works with any level of parentheses and braces. For example, if I'm assigning an object that has other objects as parameters, this still works.
Rect my_rectangle = Rect( Point( x1,
y1 ),
Point ( x2,
y2 ) );
For this, y1 would be indented to line up with x1, and the second Point object would line up with the first Point object, and then y2 would line up with x2. I realize it is silly to make new lines for x1 and x2, but those values could be coming from other objects with lengthy member functions or from other functions such that it is necessary to use new lines.
By the way, it sure would be nice if there was preview post functionality in this forum and a way to post stuff in code format with equal width characters.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does TextFX Edit -> Reindent C++ code does the trick on selected text after you typed? I think it is deliberate policy not to interfere with typing and do any reformatting later.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The name of what I've been looking for is GNU formatting. That appears to be what Emacs uses. ANSI formatting is nearly identical, but slightly better I think. Code::Blocks comes with a plug in called AStyle. I bound it to a keyboard command. When I hit it, it formats my code in whatever style I choose (ANSI, K&R, Linux, GNU, Java, Custom). It would be nice if it could format the line I'm on as I'm typing, since this method doesn't allow any part of the file I'm working on to deviate, but it still works great.
I looked briefly for an AStyle plug in for Notepad++, but could not find one. Does Notepad++ have anything like this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible to get emacs style indenting in Notepad++?
Specifically, I like how emacs indents up to the nearest open parentheses or brace. For example, if I'm defining a function in C++, and I want each argument on a separate line, emacs indents each parameter up to the open parentheses that holds all the arguments.
int my_function( double num1,
double num2,
double num3 )
In emacs, "double num2" and "double num3" would be indented when I hit the tab key to line up with "double num1". This works with any level of parentheses and braces. For example, if I'm assigning an object that has other objects as parameters, this still works.
Rect my_rectangle = Rect( Point( x1,
y1 ),
Point ( x2,
y2 ) );
For this, y1 would be indented to line up with x1, and the second Point object would line up with the first Point object, and then y2 would line up with x2. I realize it is silly to make new lines for x1 and x2, but those values could be coming from other objects with lengthy member functions or from other functions such that it is necessary to use new lines.
By the way, it sure would be nice if there was preview post functionality in this forum and a way to post stuff in code format with equal width characters.
There is such a plugin. Google for UniversalIndentGUI, or visit http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Central. It wraps a few code formatters, among which AStyle.
CChris
Does TextFX Edit -> Reindent C++ code does the trick on selected text after you typed? I think it is deliberate policy not to interfere with typing and do any reformatting later.
CChris
No. That doesn't do anything like what I described.
The name of what I've been looking for is GNU formatting. That appears to be what Emacs uses. ANSI formatting is nearly identical, but slightly better I think. Code::Blocks comes with a plug in called AStyle. I bound it to a keyboard command. When I hit it, it formats my code in whatever style I choose (ANSI, K&R, Linux, GNU, Java, Custom). It would be nice if it could format the line I'm on as I'm typing, since this method doesn't allow any part of the file I'm working on to deviate, but it still works great.
I looked briefly for an AStyle plug in for Notepad++, but could not find one. Does Notepad++ have anything like this?