Link to home
Start Free TrialLog in
Avatar of WeThotUWasAToad
WeThotUWasAToad

asked on

Auto-indent certain lines in Notepad++

Hello,

Is there a way to have Notepad++ automatically indent certain words or symbols when they appear at the beginning of a line?

I am new to Notepad++ and I am using it with a plug-in for AutoHotkey (AHK). I have recently received some excellent help from EE experts including how to modify font colors by going to:

Language > Define your language… > Keywords Lists tab > Styler (for individual groups) > Styler Dialog

Now I am wondering if there is a similar location to set and modify auto-indents. For example, while recently trying another Text Editor (called AHK Studio), I noticed that any time a block of code between braces occurs, the block is automatically indented. That same functionality is what I'm looking for in Notepad++.

Thanks
Avatar of DonConsolio
DonConsolio
Flag of Austria image

Try the NppAutoindent plugin from plugin manager.
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WeThotUWasAToad
WeThotUWasAToad

ASKER

Edit Note: This comment was posted before seeing the above post from Joe Winograd.

Thanks for the response.

Try the NppAutoindent plugin from plugin manager.

I went to the download page here: https://sourceforge.net/projects/npp-plugins/files/NppAutoIndent/NppAutoIndent%20Plugin%20v1.2/ and downloaded the file called: NppAutoIndent_1_2_dll.zip.

I unzipped the folder and moved the two resulting files to: C:\Program Files (x86)\Notepad++ However, there is a folder in that same location called plugins (C:\Program Files (x86)\Notepad++\plugins) and I'm wondering if I should have placed the two files there instead — or if it even matters.

I then opened Notepad++ and navigated to Plugins > Plugin Manager > Show Plugin Manager > Available tab and ticked NppAutoIndent. I then clicked Install. Installation was interrupted by a pop up saying I should check for updates which I did. Finally I was instructed to restart Notepad++.

By the way, after the above steps I found that NppAutoIndent is no longer under the Available tab but is now under the Installed tab.
User generated image
After the restart, I wasn't quite sure what to do but googling led me to the following:
First off, go to Settings->Preferences->Misc and ensure that Auto-indent is not ticked. Then go to Plugins->NPPAutoIndent and ensure Smart Indent is selected. (From http://stackoverflow.com/questions/4850216/notepad-and-nppautoindent)
I navigated as described in the first step and discovered that the Auto-indent box was ticked so I un-ticked it. Then I navigated according to the second step but found Auto Indent to be "off" and the Smart Indent option to be greyed-out.
User generated imageI tried a couple other things like ticking the box for NppAutoIndent in the Plugin Manager and/or replacing the tick in Settings->Preferences->Misc and restarted Notepad++ a couple of times but nothing changed the greyed-out state so I am back here now looking for more guidance at EE.

Thanks
Hi Steve,
Our messages crossed by one minute — amazing timing! My post shows how to activate the indenting choices — simply click Ignore language. Regards, Joe
You will now have NppAutoIndent in your plugins, but when you first click Plugins>NppAutoIndent, everything will be grayed out. Click Ignore Language and that will bring the indenting choices to life:

Thanks Joe. Perhaps it would be appropriate to start referring to you as Radar O'Reilly since you are answering specific questions I have before I even post them. (Just don't refer to me as Frank Burns please.) hehe
Referring to MASH shows your age...and, since I get it...mine! :)
Yep. And actually, MASH didn't even come out until after I was grown. :P But that and All In The Family were two of my favorites.
All in the Family  was definitely a great show. I sent you a message via the EE Message System. If you haven't used it before, just click the envelope icon on the right side of the EE top toolbar.
Thank you for the extremely detailed and easy-to-follow comments and screenshots.
You're welcome, Steve. As always, very happy to help. Regards, Joe