Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Implement macros (and/or TextMate-style snippets) in IDE #733

Open
totalgee opened this Issue · 2 comments

3 participants

@totalgee

Perhaps this will be solved in the future by Quarks, once the Document class is re-implemented under the SC IDE, but it would be great for live coding (and coding in general, in fact) if there were a way to support TextMate-style snippets -- or some other basic macros support -- in the Qt editor.

Related to this, it would also be great if there were an option to insert matching brackets, parentheses, etc, as you type them (as in Xcode and many other editors).

@timblechmann

macros: can you give a detailed explanation?

matching brackets: there is already an issue for this

@totalgee

SuperAbbrev (by Sune Simonsen) in jEdit (which I use) is here: http://plugins.jedit.org/plugins/?SuperAbbrevs

I would be really happy with something like SuperAbbrev, which would let me define things like this (as an example):

syndef mapped to:

SynthDef(\\${1:test}, { |out = 0, freq = 440, amp = 0.5, pan = 0, gate = 1|
    var sig = ${2:SinOsc.ar(440)};
    var env = EnvGen.ar(${3:Env.perc}, gate, doneAction: 2);
    Out.ar(out, Pan2.ar(sig * env * amp, pan));
}).add;

pbind mapped to:

Pbind(\\instrument, \\${1:test}, \\degree, ${2:0}, \\dur, ${3:0.5})${4:.play};

Which lets me type just 'syndef' and then Tab. The plugin inserts the snippet, jumps me to the $1 location (in this case, 'test' is inserted by default and highlighted). I can type in a new synth name, then if I hit tab I jump to the $2 location to enter the next variable. Shift-tab lets you move back to the $1 location and change it (it also reselects the variable text when you jump to it).

  • Tab basically cycles forward between all the insertion points (wrapping back to the beginning when it reaches the $end), and shift-tab moves backwards through them. There are more complex behaviours possible, but even just this would be really cool.
  • If a variable like $2 appears more than once in the abbreviation, all variables with the same name change accordingly. You can just use $1, $2 to get empty variables, or use ${1:myDefault} to set initial text to something.
  • Variables don't have to appear in order in the expanded text.
  • If you are at the end of the snippet (an optional $end variable can be defined) and start typing, you automatically exit the snippet-insertion behaviour (i.e. tab would no longer jump you between the variables). You also exit the snippet mode it if you move the cursor.

See http://ifakedit.com/log/2006/02/19/jedit-tutorial-a-how-to-on-abbreviations-superabbrevs-in-html-ruby-on-rails-and-more/ for more details.

(TextMate snippets are similar, and are described here: http://manual.macromates.com/en/snippets)

More powerful capabilities, with regular expression and such, are possible, but even just this basic macro expansion would be extremely useful.

@scztt scztt modified the milestone: 3.7
@scztt scztt added the enhancement label
@scztt scztt modified the milestone: 3.7, future
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.