Pages: [1]   Go Down
Author Topic: CTRL-n New could do a bit more  (Read 1487 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13673
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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:

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 smiley-sad  -  That's why I propose/prefer a build in solution.

AutoHotKey script for WINDOWS-a key combination to generate a minimum sketch
Code:
#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
Logged

Rob Tillaart

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13673
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-wink
Logged

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

ottawa, canada
Offline Offline
God Member
*****
Karma: 6
Posts: 990
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1]   Go Up
Jump to: