Go Down

Topic: CTRL-n New could do a bit more (Read 1 time) previous topic - next topic

robtillaart


99% of the time when I start a new sketch I press CTRL-n and an new empty windows open

Then I write something I "always" start with
Code: [Select]


void setup()
{
  Serial.begin(115200);
  Serial.println(Start...);
}

void loop()
{
  Serial.println();
}


It would be great if the IDE fills the new window with such content to speed up starting a new sketch.
Preferably this text is read from a file called CTRLN.pde or new.pde or so. This way the user can patch the default content easily.


This morning I started some fiddling with AutoHotKey.exe to get something similar done, it has a lot of possibilities - see AHK-code below -

Works quite well on windows, but it won't on linux or Mac-OS :(  -  That's why I propose/prefer a build in solution.

AutoHotKey script for WINDOWS-a key combination to generate a minimum sketch
Code: [Select]

#a::
Send void setup() {Enter} {{} {Enter} Serial.begin(115200); {Enter}  Serial.println("Start..."); {Enter}  {}} {Enter} {Enter}
Send void loop() {Enter} {{} {Enter} Serial.println(); {}} {Enter} {Enter} {Control Down} t {Control Up}
return

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

retrolefty

There is a basic start-up sketch in the file/examples/Basics/BareMinimum that you can edit to include the serial commands you want to default with. Then when you wish to start a new sketch, you can just open that file and then do a save as with the new name of your sketch and off you go. So not a single hot key, but it will save you keystrokes on starting a new sketch.

Lefty



robtillaart

Thanks lefty!

Never looked there to see if there was something useful  :smiley-red: :smiley-red: :smiley-red:

It is easy to add some nice stripped sketches there as starter ...

Learned something today ;)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

pellen

It would still be a nice improvement if New/ctrl-N was just a shortcut to open that file, rather than the rather useless empty document, imo.

bill2009

There is, actually, a way to do what you're suggesting.  I forget if it was an ide mod or what but "template" was part of what it was called.  sorry to be vague but have a good hard google around and maybe you'll find it.

WizenedEE

If you create a sketch (or move BareMinimum) to the /examples root directory, then it's only one more button click to open up the example than new sketch (2 if you use ctrl+n)

retrolefty

Quote
It would still be a nice improvement if New/ctrl-N was just a shortcut to open that file, rather than the rather useless empty document, imo.


But sometimes an empty document is just what I require it to open with, as in case of if I'm doing a cut and paste of a sketch found online somewhere.

Lefty


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy