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:

I really like VSCode, but then figured, eh it’s a big corporation ripping off a small group of coders making a brilliant piece of software (Sublime), i don’t want to support that… Where did you read that one of the Sublime team is working on VSCode?

VS Code is also pretty balls for Lua unfortunately. I was using it to do my Push tool, but it doesn’t build the symbol tags correctly and jump to definition doesn’t work, even with a luacheck plugin installed.

Sublime does it (almost) right without having a single plugin installed. Just got the Linter + LuaComplete plugins setup and configured correctly and now its tops. Gonna buy a license after i get some chrimbo money.

Nothing is perfect for xrnx dev cos using Luabind custom trickery etc, and the Renoise API is also opaque to the linter, but i think Sublime gets close. I want to move to Vim but have spent a few days tweaking plugins and .vimrc and i’m not even near a usable environment. Sublime in vintage mode is great !

Dun ged? Why it’s rip off? That preview bar simply is exactly the same as sublime, so I guess Microsoft payed the sublime dev for it? Also it simply is now better than sublime, sublime development kind of stuck.

I used vscode for electron and vuejs now, it is actually the absolutely best editor I ever used. But I am no expert. It’s nicely streamlined in workflow.

I wish Renoise had some auto file updater thing for lua scripts, so you wouldn’t need to reload the internal editor to make Renoise recognise changes on lua scripts. Also if it wasn’t querying millions of files each seconds… Using FSEvents on macos or the equivalent on windows.

VS Code is great for JS/Node/Electron dev, yes. I use it to hack on Orca as the debugger is perfect. Has a very complete implementation. But it lacks in other areas and is pretty diabolical for Lua dev.

When i first got it i just thought, i yeah i recognise all these things from Sublime: multi-highlight text under cursor on cmd-d, click to place multi-cursor holding cmd (vs code uses alt but you can change to cmd with an explicit menu option), command line launch utility, the command palette to control a lot of things and run symbol search, go to lines etc., json files for config with ‘user file’ overrides, the overview thingy on the right of the text window. Plus more i can’t remember now. I know not all of this is unique to Sublime, but it’s easy to see the ‘influence’ at least. The one thing i HATE HATE HATE about VS Code is that it feels a bit crippled when it’s not connected to the internet, sometimes completions dont work and stuff. I found ways to install offline packages, but it’s not like that by default.