Half eso-lang, half vim plugin, all lua.
gwen b687b89180 bunp | 3 jaren geleden | |
---|---|---|
examples | 3 jaren geleden | |
ftdetect | 3 jaren geleden | |
lib | 3 jaren geleden | |
lua | 3 jaren geleden | |
plugin | 3 jaren geleden | |
.gitignore | 3 jaren geleden | |
.gitmodules | 3 jaren geleden | |
LICENSE | 3 jaren geleden | |
README.md | 3 jaren geleden | |
tracks-r-us.png | 3 jaren geleden |
tracks-R-us is half esoteric programing language, half vim plugin, all lua.
The idea is that your code is executed one line at a time, and each line corresponds to one beat at the set BPM.
You can see where execution is in a particular buffer by finding the playhead. It will be highlighted with the vim sign '~~' and a big green bar.
Each vim buffer with .tRu
or .tru
in the buffern name will be executed, playheads are indepentend of each other.
Lines will be loaded and executed as lua from within the vim process.
The other core feature is that it integrates tightly with vim so you can use The One True Editor while you live code
:TruStart - Starts tRu playback
:TruPause - Pauses tRu playback. Playheads will keep thier positions
:TruToggle - Toggles play/pause
:TruStep - Move the playhead(s) forward by one beat. Mostly useful for debugging in pause mode.
.t - TruToggle
.T - TruStep
g:tRuBPM - The BPM of the playhead(s). Defaults to 60, in order to change this mid-run you'll need to pause/unpause the playback to restart the timers
g:tRuPluginFolder - Read-only, string containing the path of the plugin folder
g:tRuPlaying - Read-only, 1 when tRu is playing 0 otherwise
tRu comes with a small library of functions to give you more powah. Documentation below
These functions allow you to send OSC messages. See lua-osc if you wany more complez osc packing By default tRu will send messages to localhost:6312
The osc
function must have an osc address which it will send, and it may be followed buy any number of strings, or numbers which will be sent as arguments to the OSC address.
-- results in an OSC message with the address '/hello' and arguments 'world', 1(and integer), and 2.3(a float)
-- being sent to localhost:6312
osc('/hello', 'world', 1, 2.3)
The n
function will execute a normal mode macro relative the playhead (NOT your cursor. I worked hard on that so it's important)
-- this line will copy itself downward. That line will then copy ITSELF downward
n('yyp')
You can run litterally any vim macro. which can most def crash/break things in fun and curious ways. So becareful I guess
The 'ex' function will run an ex mode command. It has a convenience code ~~
which if placed at the start will select the line where the play head is at before running the command
-- an inconvenient way to echo things (use lua's print instead)
ex('echo "hello, world"')
-- copies the line at the playhead into the unnamed buffer
ex('~~y')
-- would quit vim as soon as the playhead reached it
ex('qa!')
The G
and gg
functions will jump the playhead for this bufferto the specified line. If the line number is out of range it'll be skipped
The top line in the file is number 1 not line 0
G(1)
gg(2)
Moves the playhead down by number
lines. Invalid numbers like 1.1
will result in no change, negative numbers will move upward.
j(2)
Moves the playhead up by number
lines. Invalid numbers like 1.1
will result in no change, negative numbers will move downward.
k(2)