22

I enjoy coding in the FrontEnd (except it crashes and lookup across files does not exist), but I often miss 'hands on keyboard', customizable code templates.

E.g. I often forget to wrap an option name with quotes "_" or I'm starting a new function and would like to avoid retyping Attributes/Options Catch/Check etc.

I don't like palettes for something that I need to do quickly and frequently.

Is there a package to support my needs?

Kuba
  • 136,707
  • 13
  • 279
  • 740
  • 5
    "I don't know which version you use, but Mathematica hasn't crashed on me since the late nineties." – Stephen Wolfram, 2015 – Carlos Chida Feb 23 '18 at 18:14
  • @CarlosChida Hilarious quote! Where did you find that? – M.R. Jan 16 '19 at 04:48
  • 1
    @M.R. Not found: he said it to me in a face-to-face meeting in Champaign during the Wolfram Conference 2015 when I pointed out that Apple’s Retina Displays didn’t seem to be fully supported yet. – Carlos Chida Jan 30 '19 at 21:25

1 Answers1

24

Revision history:

  • v0.8.0 (06-07-2018) VerificationTest template

    enter image description here

  • v0.7.0 (21-02-2018) V10.4 support

    As of v0.7.0 code templates should work in V10.4.


Yes, in a beta stage at the moment. Feedback appreciated.

Should work on Win/MacOs.

https://github.com/kubaPod/DevTools

Setup

   (*additional package I use to install github assets' paclets,
     you can download .paclet manually if you want 
    *)
Import["https://raw.githubusercontent.com/kubapod/mpm/master/install.m"]
Needs["MPM`"]  

   (*installing the package*)  
MPMInstall["kubapod", "devtools"]

  (*changing default .m stylesheet to a dev's stylesheet*)
CurrentValue[$FrontEnd, "DefaultPackageStyleDefinitions"] = 
 FrontEnd`FileName[{"DevTools", "DevPackage.nb"}]


  (*test*)
FrontEndTokenExecute["NewPackage"]

How to:

  • Ctrl+1 to open a menu

  • navigate with arrows and hit enter/return or hit a shortkey like n / { / [

Customization

Once you setup a new stylesheet the package should have an additional toolbar with 'Edit code templates' button on the top right. Click on it and a user's templates file should open.

It is just a .m file with a header that should explain everything. It will be improved in future.

Showcase

enter image description here

There is also a dark one based on a build-in ReversedColors.nb stylesheet:

CurrentValue[$FrontEnd, "DefaultPackageStyleDefinitions"
] = FrontEnd`FileName[{"DevTools", "DevPackageDark.nb"}]

enter image description here

Menu in V10.4

enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740
  • Oh Lordy this is way more than I though it was! Any clue how 12 likes it? – CA Trevillian Jun 14 '19 at 11:20
  • 1
    @CATrevillian I don't use it very often (I work more and more in Intellij) but so far I didn't face any problems related to v12 – Kuba Jun 14 '19 at 11:30
  • 1
    This is going to be a game changer for me. I suck at “real programming” ie inserting error checking like the above example, add onto that I have bad hands too that like to smash every key but the right ones! – CA Trevillian Jun 14 '19 at 11:34
  • 1
    @CATrevillian I looking forward to hearing about your experience. – Kuba Jun 14 '19 at 11:43