Block indentation in Notepad++

Scripting and setups with Notepad++ and AutoHotkey.
william_ahk
Posts: 481
Joined: 03 Dec 2018, 20:02

Block indentation in Notepad++

Post by william_ahk » 15 Mar 2021, 22:31

One thing that pains me the most when writing AHK scripts in Notepad++ is that there's no block indentation when pressing enter in the middle of a new pair of curly brackets. Is there any way to implement this feature in Notepad++?
no_indentation.png
no_indentation.png (973 Bytes) Viewed 4095 times
expected_indentation.png
expected_indentation.png (1.11 KiB) Viewed 4095 times

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Block indentation in Notepad++

Post by boiler » 18 Mar 2021, 21:09

I’m sure you’ve considered this, but you could avoid that pain by switching to an editor that handles things like that (and much more) such as Visual Studio Code. I tried Notepad++ for AHK for a while, among others. Once I tried VSCode, I’ve stayed with it.

william_ahk
Posts: 481
Joined: 03 Dec 2018, 20:02

Re: Block indentation in Notepad++

Post by william_ahk » 03 Sep 2021, 05:29

After a lot of research I still can't find any solution, so I wrote an AHK script to get by:

Code: Select all

#IfWinActive, ahk_class Notepad++ ahk_exe notepad++.exe
:X`n:{::
SendInput {{}{Enter 2}{}}{Up}{Tab}
#If
If anybody knows how to implement this in udl it would be greatly appreciated!

Guest

Re: Block indentation in Notepad++

Post by Guest » 28 Nov 2023, 04:26

william_ahk wrote:
03 Sep 2021, 05:29
After a lot of research I still can't find any solution, so I wrote an AHK script to get by:

Code: Select all

#IfWinActive, ahk_class Notepad++ ahk_exe notepad++.exe
:X`n:{::
SendInput {{}{Enter 2}{}}{Up}{Tab}
#If
If anybody knows how to implement this in udl it would be greatly appreciated!
I came here looking for the same thing. My solution was just to set the language to C++. I don't know why Auto-indent doesn't work with user-defined languages.

Post Reply

Return to “Notepad++”