kubaPod / DevTools

DevTools and styles for mathematica developers
28 stars 6 forks source link

(please consider it beta before it hits 1.0.0)

What's there?

Installation / Updating

Uninstall

  PacletUninstall /@ PacletFind["DevTools"];
  DeleteDirectory[FileNameJoin[{$UserBaseDirectory, "ApplicationData", "DevTools"}], 
    DeleteContents -> True
  ];

Quick Guide

Setup dark stylesheet with all features

In order to use the stylesheet as a default one for .m/.wl files, run:

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

And if you don't like it:

  CurrentValue[$FrontEnd, "DefaultPackageStyleDefinitions"
  ] = "Package.nb"

Code templates

Templates menu is available in DevPackageDark.nb stylesheet mentioned above. This stylesheet is not tested for regular notebooks yet but if you want to enable templates menu for any notebook you can run:

  Needs @ "DevTools`";
  CodeTemplatesEnable[];

Templates menu can be opened with Ctrl + 1 shortkey.

Custom code templates can be added via package toolbar / Templates&Actions / EditCodeTemplates item.

  <| "Template" -> _String | _RowBox (*the only one which is reqiired*)
   , "Label" -> _
   , "ShortKey" -> _?(StringMatchQ[Character])
   , "ExpandSelection" -> _boole:True
   , "Preview" -> _ : None
  |>

Alt text

Notebook actions

They are very similar to templates feature.

Actions menu is available in DevPackageDark.nb stylesheet mentioned above. This stylesheet is not tested for regular notebooks yet but if you want to enable actions menu for any notebook you can run:

   Needs @ "DevTools`";
   NotebookActionsEnable[];  (*NotebookActionsDisable[] to revert changes*)

Difference is that the menu with actions is invoked by Ctrl + , and an action item should look like this:

 <|                        (*!!!   DON'T FORGET ABOUT :> FOR THE ACTION !!! *)       
 "Label"    -> _String,
 "ShortKey" -> _String,
 "Action"   :> foo[]   
 |>