Thanks Hans,
So if the cursor is in item 1 like this
a = c(1|11,222)
Then hitting tab would move to highlight all of item 2.
To do so as you described is a bit complex but doable. A very naïve approach would be to use the attached two things:
EditVector.tmMacro (key bound to SHIFT+CTRL+V in scope source.r)
- which calls TM's Find function to select a given vector c(.*?) in
the current line
- and calls EditVector.tmCommand
EditVector.tmCommand:
- which splits the selection (delimiter := ',') into snippet items
- and replaces the selection with a snippet for all items within the
vector
Running the macro, I get an error
interpreter failed: Exec format error
I imagine it is in the Perl #!/usr/bin/perl -X $i=1; $sel= $ENV{'TM_SELECTED_TEXT'}; $sel=~s/^c {0,}( {0,}//;$sel=~s/ {0,})$//; for(split(/ *, */,$sel)) {push(@out, "${".$i++.":$_}")} print "c(".join(", ",@out).")${".$i."}";
Cheers, tim