Notepad++. Some cleaning tricks of LUA code

Notepad++ It is an excellent text editor. It allows you to do specific cleaning tasks, also to work with LUA code.

1. Clean all lines, each line from the character --

In LUA it is common to use the double hyphen -- to add annotations.

--.*$ will search the entire line from the characters --

image

--[[
   entry line 1
   entry line 2
   entry line 3
]]

--[[ ]] To remove these envelopes, it is better to search and remove them manually.

Note: Therefore, it is advisable not to use the double hyphen -- in the defined code. For example, within a string. Replace it with other characters to rebuild later:

  1. original local my_local_string = "--"
  2. modified local my_local_string = "__"
  3. search and replace --> --.*$
  4. restore local my_local_string = "--"

2. Remove empty lines (and empty content)
It is also common to use empty lines to separate functions and sections of code. To compact, it is a good idea to clean lines.
image
This operation will compact the code, but keep the indentation.

Do you have any interesting tricks to work with the LUA code?

Not really! I’ve used notepad++ quite a lot, and a bit of Atom and vscode. But I find myself ending up using the native scripting editor most of the time :slight_smile: Especially now that it scales nicely to my screen resolution.

Trimming trailing space in notepad++ is still something I do though. Just a healthy amount of coding OCD.

(I would probably switch to notepad++ again if Renoise was keeping track of updated files, as well as the native editor does.)

@joule, I also use the native Renoise script editor 90% of the time, mainly for the reason you have cited (keeping track of updated files). However, I have always wondered why taktik does not add a separate zoom to the script editor, simply that it enlarges the text to the programmer’s taste. It seems to me something basic for a text editor.
notepad%20%20zip

But when I want to order code, mainly when I finish a tool, I go to Notepad++. I know that Notepad++ allows some very useful search/edit tricks. Unfortunately, I don’t have a broad list of these tricks. That’s why I created this thread.

Any idea which formatter plugin for Sublime works bug-free for LUA?

Any vi/vim/gvim users here?

2 Likes

YEP!!

1 Like

Currently using Notepad++ for working with renoise.Documents.

Scripting in the terminal but loading the resultant xmls in Notepad++. Run script then click on Notepad and it gives you a message that the doc has been updated. Click OK/yes and you can see what your script did to the xml.

Been much more comfortable than messing just with the terminal for this.

I also use the folder search ‘Ctrl + Shift + F’ on the whole renoise script folder to find stray prints and source files for keyboard shortcuts.

yess, neovim actually

and years later I feel stupid trying and failing to use a regular text editor, vimming habits hardwire fast to your brain

that, and mapping caps locks to escape, wonderful and a pain when using the pc at work

2 Likes

every day, most of time, as my work requires me to do so, VIM #1
(now let’s wait for emacs users so we can start a proper war :P)

1 Like

Wow, check the recent version of VSCode. Seems to be Sublime “on steroids”. It also supports LUA. And is crossplatform!

I actually now think the sublime coder joined the vscode team, or it is based on sublime. But it is so much better. PHP, JS, Node, LUA, debugging, git, all very nicely included. There even is a syntax highlighter for .m3u files, or a full mysql database manager, a included terminal :man_cartwheeling: All free.

So… did you try Atom?

1 Like

No, why :slight_smile: