<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Beautify your code with LUA]]></title><description><![CDATA[<p dir="auto">Since I received some great help here not so long ago, gonna post this here for who’s interested. I found a cool piece of LUA code online that can easily be reconfigured for any language.</p>
<p dir="auto">The most important values to change to make basic beautifing possible are:</p>
<pre><code>KeywordReferenceData = {
        IndentType {"Else",IndentBoth},
        IndentType {"ElseIf",IndentBoth},

        IndentType {"Native",IndentIgnore},
        IndentType {"New",IndentIgnore},
        IndentType {"As",IndentIgnore},
        IndentType {"Int",IndentIgnore},
        IndentType {"Length",IndentIgnore},
        IndentType {"Import",IndentIgnore},
        IndentType {"None",IndentIgnore},
        IndentType {"Parent",IndentIgnore},
        IndentType {"Property",IndentIgnore},
        IndentType {"String",IndentIgnore},
        IndentType {"Hidden",IndentIgnore},
        IndentType {"Self",IndentIgnore},
        IndentType {"Return",IndentIgnore},
        IndentType {"ScriptName",IndentIgnore},
        IndentType {"True",IndentIgnore},
        IndentType {"Global",IndentIgnore},
        IndentType {"Float",IndentIgnore},
        IndentType {"Bool",IndentIgnore},
        IndentType {"AutoReadOnly",IndentIgnore},
        IndentType {"Extends",IndentIgnore},
        IndentType {"False",IndentIgnore},
        IndentType {"Auto",IndentIgnore},

        IndentType {"EndEvent",IndentLeft},
        IndentType {"EndFunction",IndentLeft},
        IndentType {"EndIf",IndentLeft},
        IndentType {"EndProperty",IndentLeft},
        IndentType {"EndState",IndentLeft},
        IndentType {"EndWhile",IndentLeft},

        IndentType {"If",IndentRight},
        IndentType {"State",IndentRight},
        IndentType {"Event",IndentRight},
        IndentType {"Function",IndentRight},
        IndentType {"While",IndentRight},
}
</code></pre>
<p dir="auto">And clearing all the keywords in these array’s since those have no value in your language anyway.</p>
<pre><code>ScriptObjects = CaseType {}

ApiData = CaseType {}

EventData = CaseType {}
</code></pre>
<p dir="auto">I recommend reading through the code below these arrays, its not that hard to understand. There you can adjust the rules for your language, or add some new ones. Or just comment functions that are problematic for your language.</p>
<p dir="auto">All you need is LUA for windows wich can be downloaded here, and make sure to add it to PATH when installing: <a href="https://code.google.com/archive/p/luaforwindows/downloads" rel="nofollow ugc">https://code.google.com/archive/p/luaforwindows/downloads</a></p>
<p dir="auto">Then put the LUA script somewhere in a folder, and open Notepad++, press F5 to open the run box. enter this command and press save to bind it to a shortcut:</p>
<pre><code>lua "[install path]\skyindent.lua" -b "$(FULL_CURRENT_PATH)"
</code></pre>
<p dir="auto">[install path] being the full path to the script. Make sure to save your file before beautifying or lose your changes. When you saved your file first, the script will make a backup of the state of the file before beautifying.</p>
<p dir="auto">I hope this will help some people.</p>
<p dir="auto">Source : <a href="https://ck.uesp.net/wiki/User:PROXiCiDE/SkyIndent.lua" rel="nofollow ugc">https://ck.uesp.net/wiki/User:PROXiCiDE/SkyIndent.lua</a></p>
<p dir="auto">I had to clear the keyword arrays in the code block below, because my post was too long. Still too long, will reply to my own topic then… I hope that works.</p>
<p dir="auto">Edit: didn’t work, I guess everyone knows and trusts pastebin: <a href="https://pastebin.com/FKqPERmf" rel="nofollow ugc">https://pastebin.com/FKqPERmf</a></p>
]]></description><link>https://community.notepad-plus-plus.org/topic/25266/beautify-your-code-with-lua</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 19:48:17 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/25266.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Dec 2023 17:48:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Beautify your code with LUA on Wed, 20 Dec 2023 20:05:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a></p>
<p dir="auto">While I agree that in a perfect world I wouldn’t make a post like this, but actually present a finished solution or product like a plugin… but one has only so much time between work and family.</p>
<p dir="auto">I’ll take a look at the lua script plugin somewhere in the future, I didn’t even know there was a LUA plugin. I just happen to stumble on this script when doing some research, and figured it could be helpful for other people too. Thats pretty much the only reason I posted it here on the forum.</p>
<p dir="auto">I currently have my hands full with a project, creating an UDL for notepad++. Beatutifying and auto indenting is on my list and will eventually get around to it, but at the moment I have other priorities. Such as writing calltips for about 3000 entries, and coming through on other promisses made.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91367</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91367</guid><dc:creator><![CDATA[Khundian Twitch]]></dc:creator><pubDate>Wed, 20 Dec 2023 20:05:22 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Wed, 20 Dec 2023 18:28:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/91363">Beautify your code with LUA</a>:</p>
<blockquote>
<p dir="auto">Certainly, if it were an actual Notepad++ plugin code-beautifier being discussed, then 100% on-topic.</p>
</blockquote>
<p dir="auto">A great way for OP to bring it back on-topic would be to show how to make that script work <em>in the LuaScript plugin</em>, and then (if possible) show how to automatically run the beautifier through that plugin every time you save a script of the right type.  I know that <a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> has shown <a href="/post/45544">¹</a> how to run a linter or beautifier during the file-save event using NppExec, and you <a href="/post/71021">²</a> and I <a href="/post/88374">³</a> have shown examples of PythonScript that runs either a Python and/or Perl code-checker to verify there are no compiler errors when a .py or .pl file is saved.  So seeing another <a href="https://dail8859.github.io/LuaScript/examples/luasyntaxchecker.lua.html" title="dail's syntax checker" rel="nofollow ugc">⁴</a> example of how to do a similar event-prompted beautification in LuaScript would be hugely beneficial to someone who prefers LuaScript to PythonScript.  (That’s actually why I upvoted the original post, though I had intended to come back and essentially add this paragraph as a reply, but Round Tuits™ are sometimes elusive.)</p>
<p dir="auto"><em>edit: added references; also was reminded about <a href="https://dail8859.github.io/LuaScript/examples/luasyntaxchecker.lua.html" rel="nofollow ugc">dail’s syntax checker in LuaScript</a> that actually served as the inspiration for Alan’s code and thus mine</em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/91364</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91364</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 20 Dec 2023 18:28:22 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Wed, 20 Dec 2023 17:15:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a></p>
<p dir="auto">Like I said, it’s not a big deal.<br />
We just try to keep people on the straight-and-narrow here.  :-)<br />
If someone wants a code-beautifier, it’s easy to go in search of one elsewhere.<br />
Certainly, if it were an actual Notepad++ plugin code-beautifier being discussed, then 100% on-topic.</p>
<blockquote>
<p dir="auto">…OP also showed how to link from Notepad++…</p>
</blockquote>
<p dir="auto">Well … a <em>Run</em> menu item can be created to just about anything, so it doesn’t help the original posting be any more on-topic.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91363</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91363</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 20 Dec 2023 17:15:06 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Wed, 20 Dec 2023 17:08:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> I personally did not have any issues with the post. Some people use Lua. Notepad++ includes support for Lua (but not cookie files) in its list of supported languages. Notepad also includes a Lua lexer as a plugin. Finally, the OP also showed how to link from Notepad++ into the Lua prettifier.</p>
<p dir="auto">There’s a <a href="https://github.com/dail8859/LuaScript" rel="nofollow ugc">LuaScript plugin for Notepad++</a> that works with up to at least npp v8.3 and at least for the v8.3 era was a good example of a plugin that integrates with both Notepad++ and Scintilla.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91362</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91362</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Wed, 20 Dec 2023 17:08:19 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Wed, 20 Dec 2023 12:07:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/khundian-twitch" aria-label="Profile: Khundian-Twitch">@<bdi>Khundian-Twitch</bdi></a></p>
<p dir="auto">No moderator deletes  such posts.<br />
It’s not a big deal, just trying to educate you about forum etiquette.<br />
Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91357</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91357</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 20 Dec 2023 12:07:11 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Wed, 20 Dec 2023 06:27:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a><br />
Whatever man, got better things to do than go back and forth with you over something so trvial as a post on a forum. If the moderators deem my post unsuitable for the forum, they will delete it… right?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91356</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91356</guid><dc:creator><![CDATA[Khundian Twitch]]></dc:creator><pubDate>Wed, 20 Dec 2023 06:27:45 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Wed, 20 Dec 2023 01:36:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/khundian-twitch" aria-label="Profile: Khundian-Twitch">@<bdi>Khundian-Twitch</bdi></a> said in <a href="/post/91354">Beautify your code with LUA</a>:</p>
<blockquote>
<p dir="auto">Its for people who use notepad++ for programming</p>
</blockquote>
<p dir="auto">It’s really just a general code beautification thing, nothing to do with Notepad++.<br />
Please try to confine your postings here to Notepad++ specific discussion.<br />
People here probably also like chocolate chip cookies, but nobody is here to read about that.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91355</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91355</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 20 Dec 2023 01:36:22 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Tue, 19 Dec 2023 23:44:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a><br />
Its for people who use notepad++ for programming, since re-indenting or beautifying your written code is supported only in a few languages in Npp.This could potentially be very interesting to people.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91354</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91354</guid><dc:creator><![CDATA[Khundian Twitch]]></dc:creator><pubDate>Tue, 19 Dec 2023 23:44:53 GMT</pubDate></item><item><title><![CDATA[Reply to Beautify your code with LUA on Tue, 19 Dec 2023 20:38:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/khundian-twitch" aria-label="Profile: Khundian-Twitch">@<bdi>Khundian-Twitch</bdi></a></p>
<p dir="auto">Does this have anything whatsoever to do with Notepad++?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/91348</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/91348</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 19 Dec 2023 20:38:43 GMT</pubDate></item></channel></rss>