use plugin from macro
I’m currently using the addon “indent by fold” to indent my lua code, however is indents lines that begin with ‘else’ incorrectly so i wrote a macro that fixed these mistakes with a regex replace.
This means that i have to click 2 buttons to indent my code, which is annyoing does anyone know how i can extend my macro to call ‘indent by fold’ first?
to be honest - if you are programming lua why don’t you use the
lua script plugin from dail and program your own indent routine or better check out his examples as far as I remember there was already an indent functionality developed?!
I believe you are talking about this posting?: https://notepad-plus-plus.org/community/topic/12741/auto-identation-in-lua-code-language
Thx to both of you, this was quite helpful.
If you do plan on using that Lua code you probably instead want to use this slightly updated version of it. The post Claudia and Scott referenced was a very early version of it I put together real quick.
Thx again, i noticed though that the script cannot currectly indent functions that are passed as parmeters to other functions, in particular LuaAutoIndent.lua cannot correctly indent itself since it contain multiple lines like
npp.AddEventHandler("OnSwitchFile", function(filename, bufferid)also it doesn’t indent correctly after the line
if editor:findtext(increaseIndentPattern, SCFIND_REGEXP, start_pos, end_pos) thenthis is becasue the
I never said it was perfect ;) You are welcome to make changes and submit a pull request.