Skip to content

Instantly share code, notes, and snippets.

@tannerlegvold
Last active June 21, 2022 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tannerlegvold/505e788c96da0a4a49da273463dae187 to your computer and use it in GitHub Desktop.
Save tannerlegvold/505e788c96da0a4a49da273463dae187 to your computer and use it in GitHub Desktop.
My Mathematica config files, including custom keybindings and menus
(** User Mathematica initialization file **)
$ActiveSideOfSelection = Neither;
$ShiftReturnMode = "CursorDoesntMove";
(* btw this is useful https://www.wolframcloud.com/obj/github-cloud/form/BadgeCreation
example: https://www.wolframcloud.com/obj/github-cloud/commits/a69e783425874f894be49712c7494f9e528fa206
I got it from the MSE chat *)
(* This removes the pesky 'Wolfram Mathematica' directory that
clutters my home directory. Solutions are discussed in this SE post
https://mathematica.stackexchange.com/questions/89369/prevent-10-2-from-creating-wolfram-mathematica-directory-on-linux?rq=1 *)
With[{dir = $UserDocumentsDirectory <> "/Wolfram Mathematica"},
If[DirectoryQ[dir], DeleteDirectory[dir]]
];
(* Also maybe find a way to make a command that runs code cleanly on
a already running kernel so it doesnt take a second or two of startup
time *)
(* This makes my absolutely beautiful tabbing work now. Beuatifal *)
(* One problem though. This gets called even when running a wolframscript
from the command line (you can tell because any wolframscript execution
emits an error message complaining about a lack of front end). I need
to figure out how to make this code run only on start up of a front end
and not on startup of a kernel. Also perhaps I should move this code
into a package so it doesnt clutter my init.m file *)
SetOptions[SelectedNotebook[],
NotebookEventActions -> {{"KeyDown", "\t"} :>
KeyBindings`OnTab[]}];
(* Note: one can use this to figure out what kind of key a keypress is:
SetOptions[EvaluationNotebook[],
NotebookEventActions -> {"KeyDown" :>
Print[FullForm@CurrentValue["EventKey"]]}]
This is taken from https://mathematica.stackexchange.com/questions/139704/how-to-detect-special-key-presses-in-a-notebook/167223
*)
(* The two styling functions I know of are
ResourceFunction["DarkMode"][]
ResourceFunction["DraculaTheme"][]
*)
(* Also it looks like there is a problem with Desurround in this case:
[][Normal]
Highlight from the brackets surrounding Normal (dont include the open close
pair upfront). Now do Ctrl + Shift + Backspace and you will see the l in
Normal does not get included in the selection, the selection only goes from
N to a. This is a bug *)
(* Also I just discovered Alt + e + b. It does alot of the work that my Ctrl
+ Left/Right bindings do and could significantly speed them up. If only I
had known about it before *)
(* This is the traceView2 definition from this amazing SE post https://mathematica.stackexchange.com/questions/29339/the-clearest-\
way-to-represent-mathematicas-evaluation-sequence *)
TraceView[expr_] :=
Module[{steps = {}, stack = {}, pre, post, show, dynamic},
pre[e_] := (stack = {steps, stack}; steps = {});
post[e_, r_] := (steps =
First@stack~Join~{show[e, HoldForm[r], steps]};
stack = stack[[2]]); SetAttributes[post, HoldAllComplete];
show[e_, r_, steps_] :=
Grid[steps /. {{} -> {{"Expr ",
Row[{e, " ",
Style["inert", {Italic, Small}]}]}}, _ -> {{"Expr ",
e}, {"Steps",
steps /. {{} -> Style["no definitions apply", Italic], _ :>
OpenerView[{Length@steps,
dynamic@Column[steps]}]}}, {"Result", r}}},
Alignment -> Left, Frame -> All,
Background -> {{LightCyan}, None}];
TraceScan[pre, expr, ___, post];
Deploy@Pane[steps[[1]] /. dynamic -> Dynamic, ImageSize -> 10000]];
SetAttributes[TraceView, {HoldAllComplete}];
(* One could write an ugly and simple function to convert a box structure to a
simple string of characters with no special formatting. To be used
for simple things like getting the first and last characters of a box
expression or seeing what characters are in a box expression. I think
for my purposes though this is unneccessary and simply these two
functions will do. *)
(* Gets the first character of a box structure, if the first thing is
not a character, returns None *)
KeyBindings`FirstCharacter[string_String] := First@Characters@string;
KeyBindings`FirstCharacter[RowBox[{first_, ___}]] :=
KeyBindings`FirstCharacter@first;
KeyBindings`FirstCharacter[_] := None;
(* Gets the last character of a box structure, if the last thing is
not a character, returns None *)
KeyBindings`LastCharacter[string_String] := Last@Characters@string;
KeyBindings`LastCharacter[RowBox[{___, last_}]] :=
KeyBindings`LastCharacter@last;
KeyBindings`LastCharacter[_] := None;
(* When given a box structure, tells you how many times you would need
to press Shift + Right to highlight it from right to left *)
KeyBindings`GetRightLength[RowBox[expr_]] := Plus @@ KeyBindings`GetRightLength /@ expr;
KeyBindings`GetRightLength[SuperscriptBox[expr_, _]] := 1 + KeyBindings`GetRightLength @ expr;
KeyBindings`GetRightLength[SubscriptBox[expr_, _]] := 1 + KeyBindings`GetRightLength @ expr;
KeyBindings`GetRightLength[s_String] := StringLength @ s;
KeyBindings`GetRightLength[_] := 1;
(* When given a box structure, tells you how many times you would need
to press Shift + Left to highlight it from left to right *)
KeyBindings`GetLeftLength[RowBox[expr_]] := Plus @@ KeyBindings`GetLeftLength /@ expr;
KeyBindings`GetLeftLength[s_String] := StringLength @ s;
KeyBindings`GetLeftLength[_] := 1;
(* Output an inactive expression for the diagonalized form of the input matrix. *)
Diagonalize[m_] := Module[{evalues, evectors},
{evalues, evectors} = Eigensystem[m];
evectors = Normalize /@ evectors;
MatrixForm /@
Inactivate[
Inverse@evectors . DiagonalMatrix[evalues] . evectors, Dot]
];
(* Prints to the selection a file embedder (taken from https://mathematica.stackexchange.com/questions/11891/attaching-a-file-to-a-notebook) *)
KeyBindings`OpenFileEmbedder[] := Module[{nb, fileEmbedder},
nb = SelectedNotebook[];
fileEmbedder = DynamicModule[{files = {}, dumpSave, appendFile, fileNames = {}, loadButton, fileSizeStored = {}, dateStored = {}, fileSize = {}, fileModDate = {}, fileChosen, afButton, dfButton, efButton, ofButton, qt, fileName, deleteLastPressed = {}, timeLimite = 60, tempFolder, definitionsFileName = " Definitions Save.m", clearContextButton, tempContext, clearLastPressed = 0, test}, Panel@OpenerView[{" Stored Files", Dynamic@Column[{ Grid[ Join[{{Style["ID", Bold], Style["NAME", Bold], Style["SIZE", Bold], Style["MODIFIED", Bold], Style["ACTIONS", Bold]}}, If[qt[] == 0, {{"", "No Files Loaded", "", ""}}, Transpose[{ Range[qt[]], fileNames, Table[Tooltip[ Row[{Round[fileSize[[i]]/10.^6, 0.01], " MB"}], Column[{Row[{"File size: ", fileSize[[i]], " Bytes"}], "", Row[{"Storage size: ", fileSizeStored[[i]], " Bytes"}]}]], {i, qt[]}], Table[ Tooltip[ DateString[ fileModDate[[i]], {"Year", "/", "Month", "/", "Day"}], Column[{ "Modified on the:", DateString[ fileModDate[[i]], {"Year", "/", "Month", "/", "Day", " ", "Hour", ":", "Minute", ":", "Second"}], "", "Added on the:", DateString[ dateStored[[i]], {"Year", "/", "Month", "/", "Day", " ", "Hour", ":", "Minute", ":", "Second"}]}]], {i, qt[]}], Table[Row[{" ", ofButton[i], " ", loadButton[i], " ", efButton[i], " ", dfButton[i]}, ImageSize -> 250], {i, qt[]}]}]] ], Frame -> All, Alignment -> {{Center, Left, Right, Right, Left}}], Grid[{{afButton[], dumpSave[], clearContextButton[], Tooltip["Rev. 1.2", "By Pedro Fonseca, with the help of:\n\ http://mathematica.stackexchange.com/questions/11891/attaching-a-file-\ to-a-notebook\nSpecial thanks to: Sjoerd C. de Vries"]}}, ItemSize -> 10, Alignment -> Left] }]}], Initialization -> ( clearContextButton[] := Tooltip[Button[ Dynamic[If[clearLastPressed + 3 < AbsoluteTime[], Framed["Clear " <> tempContext[], RoundingRadius -> 10], Framed[Style["CONFIRM", Bold, Red], RoundingRadius -> 10]], UpdateInterval -> 1], If[clearLastPressed + 3 < AbsoluteTime[], clearLastPressed = AbsoluteTime[], clearLastPressed = 0; ClearAll[Evaluate[tempContext[] <> "*"]]], Method -> "Queued", ImageSize -> Large, Appearance -> "Frameless"], "Clears the " <> tempContext[] <> " context"]; (*clearContextButton[]:=Tooltip[Button[Framed["Clear "<> tempContext[],RoundingRadius\[Rule]10],ClearAll[Evaluate[ tempContext[]<>"*"]],Method\[Rule]"Queued",ImageSize\[Rule]Large, Appearance\[Rule]"Frameless"],"Clears the "<>tempContext[]<> " context"];*) tempContext[] := ToExpression["$Context"]; tempFolder[] := ToExpression["$TemporaryDirectory"]; qt[] := Length[fileNames]; dumpSave[] := Tooltip[Button[Framed[tempContext[], RoundingRadius -> 10], Quiet[ test = DeleteFile[ FileNameJoin[{tempFolder[], tempContext[] <> definitionsFileName}]]]; If[test === Null, TimeConstrained[ Save[FileNameJoin[{tempFolder[], tempContext[] <> definitionsFileName}], Evaluate[tempContext[]]], timeLimite]]; If[test === Null, appendFile[ FileNameJoin[{tempFolder[], tempContext[] <> definitionsFileName}]]], Method -> "Queued", Appearance -> "Frameless"], "Saves the " <> tempContext[]]; appendFile[fileLocation_] := If[TimeConstrained[ AppendTo[files, ExportString[ ExportString[Import[fileLocation, "String"], "GZIP", "CompreseionLevel" -> 1], "Base64"]], timeLimite] =!= $Aborted, AppendTo[fileNames, FileNameTake@fileLocation]; AppendTo[fileSize, FileByteCount[fileLocation]]; AppendTo[fileSizeStored, ByteCount[Last@files]]; AppendTo[fileModDate, FileDate[fileLocation]]; AppendTo[dateStored, AbsoluteTime[]]; AppendTo[deleteLastPressed, 0], If[Length[files] > Length[fileNames], files = Delete[files, -1]] ]; afButton[] := Button[Framed["ADD FILE", RoundingRadius -> 10], fileChosen = SystemDialogInput["FileOpen"]; If[fileChosen =!= $Canceled, If[! ListQ[fileChosen], fileChosen = {fileChosen}]; Do[appendFile[fileChosen[[i]]], {i, Length[fileChosen]}] ]; fileChosen = "", Method -> "Queued", ImageSize -> Medium, Appearance -> "Frameless"]; dfButton[position_] := Tooltip[Button[ Dynamic[If[deleteLastPressed[[position]] + 3 < AbsoluteTime[], Framed["DELETE", RoundingRadius -> 10], Framed[Style["CONFIRM", Bold, Red], RoundingRadius -> 10]], UpdateInterval -> 1], If[deleteLastPressed[[position]] + 3 < AbsoluteTime[], deleteLastPressed[[position]] = AbsoluteTime[], files = Delete[files, position]; fileNames = Delete[fileNames, position]; fileSizeStored = Delete[fileSizeStored, position]; dateStored = Delete[dateStored, position]; deleteLastPressed = Delete[deleteLastPressed, position]], Method -> "Queued", Appearance -> "Frameless"], If[deleteLastPressed[[position]] + 3 < AbsoluteTime[], "delete file?", "please confirm"]]; efButton[position_] := Tooltip[Button[Framed["EXPORT", RoundingRadius -> 10], fileName = SystemDialogInput["FileSave", fileNames[[position]]]; If[fileName =!= $Canceled, TimeConstrained[ Export[fileName, ImportString[files[[position]], {"Base64", "String"}], "String"], timeLimite]], Method -> "Queued", Appearance -> "Frameless"], "save to disk"]; loadButton[position_] := Tooltip[Button[Framed["LOAD", RoundingRadius -> 10], TimeConstrained[ Get@Export[FileNameJoin[{tempFolder[], fileNames[[position]]}], ImportString[files[[position]], {"Base64", "String"}], "String"], timeLimite], Method -> "Queued", Appearance -> "Frameless", Enabled -> FileExtension[fileNames[[position]]] == "m"], "Load Definitions, over current session"]; ofButton[position_] := Tooltip[Button[Framed["OPEN", RoundingRadius -> 10], TimeConstrained[ SystemOpen@ Export[FileNameJoin[{tempFolder[], fileNames[[position]]}], ImportString[files[[position]], {"Base64", "String"}], "String"], timeLimite], Method -> "Queued", Appearance -> "Frameless"], "open file"]), SaveDefinitions -> True];
NotebookWrite[nb,ToBoxes @ fileEmbedder];
];
(* I need to implement all of these *)
(*
(* These next two would swap the selection with either its right or
left neighbor argument if they are both arguments of the same function *)
KeyBindings`SwapSelectionRight[] :=
KeyBindings`SwapSelectionLeft[] :=
*)
KeyBindings`ToggleShiftReturnMode[] := (
$ShiftReturnMode = Switch[$ShiftReturnMode,
"CursorDoesntMove",
"CursorMovesBelowCell",
"CursorDoesntMove",
"CursorMovesBelowCell",
_,
"CursorDoesntMove"
]
);
KeyBindings`OnShiftReturn[] := (
Module[{nb, cell, selection, position},
nb = SelectedNotebook[];
(* If the selection is not in a cell then default to standard behavior *)
selection = FrontEndExecute@FrontEnd`UndocumentedGetSelectionPacket[nb];
If[Lookup[selection, "CellSelectionType"] =!= "ContentSelection",
FrontEndExecute@FrontEndToken[nb, "HandleShiftReturn"],
Switch[$ShiftReturnMode,
"CursorDoesntMove",
cell = First@SelectedCells[nb];
position = Lookup[selection, "CharacterRange"];
FrontEndExecute@FrontEndToken[nb, "HandleShiftReturn"];
SelectionMove[cell, Before, CellContents];
SelectionMove[nb, Next, Character, position[[1]]];
SelectionMove[nb, All, Character, position[[2]] - position[[1]]],
"CursorMovesBelowCell",
FrontEndExecute@FrontEndToken[nb, "HandleShiftReturn"]
]
]
]
);
(* This is supposed to reset the active side of the selection. This
doesn't really work the way I want it to. I don't know how to do this *)
KeyBindings`ResetSelection[] := (
(* Ill toss this line in here for testing *)
$ActiveSideOfSelection = $ActiveSideOfSelection /. {Left -> Right, Right -> Left};
Module[{nb},
nb = SelectedNotebook[];
FrontEndExecute @ FrontEndToken[nb, "CreateInlineCell"];
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"];
NotebookWrite[nb, NotebookRead[nb], All]
]
);
(* If the selection is a list (or comma delimited) then this prints
the individual components each on a newline *)
KeyBindings`Column[] := (
Scan[text \[Function] NotebookWrite[#, If[text === ",", "\n", text]],
Module[{read = NotebookRead[#]},
If[MatchQ[read,
RowBox[{"[", _RowBox, "]"}] | RowBox[{"{", _RowBox, "}"}]],
read[[1, 2, 1]], read[[1]]]]
] & @ SelectedNotebook[];
);
KeyBindings`ColumnRecursive[] :=
Module[{nb, count, selection},
nb = SelectedNotebook[];
count = 0;
selection = NotebookRead @ nb;
If[KeyBindings`FirstCharacter @ selection === "{" &&
KeyBindings`LastCharacter @ selection === "}",
Scan[text \[Function]
NotebookWrite[nb, If[text === ",", count++; "\n", text]],
selection[[1, 2, 1]]];
(* Print@count; *)
Table[FrontEndExecute @ FrontEndToken[nb, "MovePreviousLine"], count];
Table[
FrontEndExecute @ FrontEndToken[nb, "MoveLineEnd"];
FrontEndExecute @ FrontEndToken[nb, "SelectLineBeginning"];
KeyBindings`ColumnRecursive[];
FrontEndExecute @ FrontEndToken[nb, "MoveNextLine"],
count + 1];
FrontEndExecute @ FrontEndToken[nb, "MovePreviousLine"];
FrontEndExecute @ FrontEndToken[nb, "MoveLineEnd"]
(* , Print@"NO" *)
]
]
(* When the selection is a List or just comma delimited (no brackets
needed) then this reverses the selection *)
KeyBindings`Reverse[] := (
NotebookWrite[#, Module[{text = NotebookRead[#]},
If[MatchQ[text,
RowBox[{"[", _RowBox, "]"}] |
RowBox[{"{", _RowBox, "}"}]],
MapAt[Reverse, text, {1, 2, 1}],
Reverse /@ text]], All] & @ SelectedNotebook[];
);
(* Reload MenuSetup.tr and executes init.m. I don't know what
FrontEnd`FlushTextResourceCaches does. It doesn't reload KeyEventTranslations.tr
unfortunately so its not as useful as it could be *)
KeyBindings`ReloadResources[] := (
FrontEndExecute @ {FrontEnd`FlushTextResourceCaches[],
ResetMenusPacket[{Automatic, Automatic}]};
Get["/home/tanner/.Mathematica/Kernel/init.m"];
);
KeyBindings`OnOpenBracket[] := (
Module[{type, range},
{type, range} = {"CellSelectionType", "CharacterRange"} /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[SelectedNotebook[]];
If[type === "ContentSelection" && range[[1]] =!= range[[2]],
NotebookApply[SelectedNotebook[], "[\[SelectionPlaceholder]]", All],
NotebookWrite[SelectedNotebook[], "["]]
];
);
KeyBindings`OnOpenBrace[] := (
Module[{type, range},
{type, range} = {"CellSelectionType", "CharacterRange"} /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[SelectedNotebook[]];
If[type === "ContentSelection" && range[[1]] =!= range[[2]],
NotebookApply[SelectedNotebook[], "{\[SelectionPlaceholder]}", All],
NotebookWrite[SelectedNotebook[], "{"]]
];
);
KeyBindings`OnOpenParenthese[] := (
Module[{type, range},
{type, range} = {"CellSelectionType", "CharacterRange"} /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[SelectedNotebook[]];
If[type === "ContentSelection" && range[[1]] =!= range[[2]],
NotebookApply[SelectedNotebook[], "(\[SelectionPlaceholder])", All],
NotebookWrite[SelectedNotebook[], "("]]
];
);
KeyBindings`OnQuotation[] := (
Module[{type, range},
{type, range} = {"CellSelectionType", "CharacterRange"} /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[SelectedNotebook[]];
If[type === "ContentSelection" && range[[1]] =!= range[[2]],
NotebookApply[SelectedNotebook[], "\"\[SelectionPlaceholder]\"", All],
NotebookWrite[SelectedNotebook[], "\""]]
];
);
KeyBindings`OnLessThan[] := (
Module[{type, range},
{type, range} = {"CellSelectionType", "CharacterRange"} /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[SelectedNotebook[]];
If[type === "ContentSelection" && range[[1]] =!= range[[2]],
NotebookApply[SelectedNotebook[], "\[LeftAssociation]\[SelectionPlaceholder]\[RightAssociation]", All],
NotebookWrite[SelectedNotebook[], "<"]]
];
);
(* This currently doesnt work if the cursor is at the beginning or
end of the cell *)
(* Its complicated because it tries hard to figure out if the cursor
is in or on the edge of a valid word so that it "does the right thing" *)
KeyBindings`OpenCurrentTextInDocumentation[] := (
Module[{nb, selection, left, right},
nb = SelectedNotebook[];
selection =
FrontEndExecute@FrontEnd`UndocumentedGetSelectionPacket[nb];
(* If there is a selection then simulate a left arrow to set the \
cursor to the beginning of the selection *)
If[Not@(Equal @@ Lookup[selection, "CharacterRange"]),
FrontEndExecute@FrontEndToken[nb, "MovePrevious"]];
(* Get character to left of cursor *)
FrontEndExecute@FrontEndToken[nb, "SelectPrevious"];
left = NotebookRead[nb];
FrontEndExecute@FrontEndToken[nb, "MoveNext"];
(* Get character to right of cursor *)
FrontEndExecute@FrontEndToken[nb, "SelectNext"];
right = NotebookRead[nb];
FrontEndExecute@FrontEndToken[nb, "MovePrevious"];
(* Determine if we are to the left to the right or in the middle of \
a word and act accordingly *)
Which[
StringMatchQ[left, Except[WordCharacter]] &&
StringMatchQ[right, LetterCharacter],
FrontEndExecute@FrontEndToken[nb, "SelectNextWord"],
StringMatchQ[left, WordCharacter] &&
StringMatchQ[right, Except[WordCharacter]],
FrontEndExecute@FrontEndToken[nb, "SelectPreviousWord"],
StringMatchQ[left, WordCharacter] &&
StringMatchQ[right, WordCharacter],
FrontEndExecute@FrontEndToken[nb, "ExpandSelection"],
True,
(* If we get here then we are between two nonalphanumeric \
characters and we should do nothing *)
Null
];
selection = NotebookRead[nb];
(* If we didnt highlight anything or if the thing we highlighted \
isnt a valid function then do nothing. Otherwise look it up in the \
documentation *)
If[selection === {} || Names[selection] === {},
Null,
NotebookOpen@
FindFile@
FileNameJoin@{"ReferencePages", "Symbols", selection <> ".nb"}
]
]
);
(* This could be improved. Right now it does not work in text cells
because they handle the front end token "Tab" differently. Maybe put
a check in to see if we are in a text cell and if so not call the
token. This should work because typesetting in text cells isnt
possible (if you try it actually creates an inline cell where the
typsetting is possible) *)
KeyBindings`OnTab[] := Module[{nb, type, range},
nb = SelectedNotebook[];
{type, range} = {"CellSelectionType", "CharacterRange"} /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
If[type === "ContentSelection",
FrontEndExecute @ FrontEndToken[nb, "Tab"];
If[range === ("CharacterRange" /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb]),
(* If hitting tab does nothing then its not for navigation or code completion so we are good to run our code *)
If[range[[1]] === range[[2]],
FrontEndTokenExecute[nb, "ExpandSelection"]
];
NotebookApply[nb, "\\[AliasDelimiter]\\[SelectionPlaceholder]\\[AliasDelimiter]"]
]
]
];
(*
KeyBindings`OnTab[] := Module[{nb, selectionInfo},
nb = SelectedNotebook[];
selectionInfo = FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
If[("CellSelectionType" /. selectionInfo) === "ContentSelection",
FrontEndExecute @ FrontEndToken[nb, "Tab"];
If[selectionInfo === FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb],
(*If hitting tab does nothing then its not for navigation or code completion so we are good to run our code*)
FrontEndTokenExecute[nb, "ExpandSelection"];
NotebookApply[nb, "\\[AliasDelimiter]\\[SelectionPlaceholder]\\[AliasDelimiter]"]
]
]
];
*)
KeyBindings`Desurround[] := Module[{nb, selection, range, first, last},
nb = SelectedNotebook[];
selection = NotebookRead[nb];
range = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
first = KeyBindings`FirstCharacter@selection;
last = KeyBindings`LastCharacter@selection;
If[(first === "[" && last === "]") ||
(first === "{" && last === "}") ||
(first === "(" && last === ")") ||
(first === "\"" && last === "\"") ||
(first === "<" && last === ">") ||
(first === "|" && last === "|") ||
(first === "\[LeftAssociation]" && last === "\[RightAssociation]"),
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "MoveNext"];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "DeletePrevious"];
SelectionMove[nb, Previous, Character, range[[2]] - range[[1]] - 1];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "DeleteNext"];
SelectionMove[nb, All, Character, range[[2]] - range[[1]] - 2];
];
If[first === "<" && last === ">",
KeyBindings`Desurround[]
];
];
(* Note: If selection is on a cell (or cell group) then Ctrl + Up/Down
doesn't do anything (I wasn't sure what it should do) *)
KeyBindings`OnControlUp[] := Module[{nb},
nb = SelectedNotebook[];
Switch["CellSelectionType" /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb],
"ContentSelection",
SelectionMove[nb, All, Cell];
FrontEndExecute @ FrontEndToken[nb, "MoveNext"];
FrontEndExecute @ FrontEndToken[nb, "MovePrevious"],
"AboveCell" | "BelowCell",
KeyBindings`MoveUpCell[],
_,
Null
]
];
KeyBindings`OnControlDown[] := Module[{nb},
nb = SelectedNotebook[];
Switch["CellSelectionType" /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb],
"ContentSelection",
SelectionMove[nb, All, Cell];
FrontEndExecute @ FrontEndToken[nb, "MovePrevious"];
FrontEndExecute @ FrontEndToken[nb, "MoveNext"],
"AboveCell" | "BelowCell",
KeyBindings`MoveDownCell[],
_,
Null
]
];
(* All four of these cell actions assume you are between cells. Their behaviour
is unpredictable otherwise. I should consider renaming these to use
Previous and Next instead of Up and Down. Note: another possible value
for UndocumentedGetSelectionPackets "CellSelectionType" is "NoNotebookSelection" *)
KeyBindings`MoveUpCell[] := Module[{nb},
nb = SelectedNotebook[];
KeyBindings`SelectUpCell[];
Switch["CellSelectionType" /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb],
"CellRangeSelection",
FrontEndExecute @ FrontEndToken[nb, "MovePreviousLine"],
"OnCell",
FrontEndExecute @ FrontEndToken[nb, "MoveNext"];
FrontEndExecute @ FrontEndToken[nb, "MovePrevious"]
]
];
KeyBindings`MoveDownCell[] := Module[{nb},
nb = SelectedNotebook[];
KeyBindings`SelectDownCell[];
Switch["CellSelectionType" /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb],
"CellRangeSelection",
FrontEndExecute @ FrontEndToken[nb, "MoveNextLine"],
"OnCell",
FrontEndExecute @ FrontEndToken[nb, "MovePrevious"]
FrontEndExecute @ FrontEndToken[nb, "MoveNext"];
]
];
KeyBindings`SelectUpCell[] := Module[{nb, content, cell},
nb = SelectedNotebook[];
FrontEndExecute @ FrontEndToken[nb, "MovePreviousLine"];
SelectionMove[nb, All, Cell];
cell = SelectedCells[nb][[1]];
If[SelectionMove[nb, All, CellGroup] === $Failed,
SelectionMove[cell, All, Cell];
];
If[Last @ SelectedCells[nb] =!= cell,
SelectionMove[cell, All, Cell];
];
];
KeyBindings`SelectDownCell[] := Module[{nb, content, cell},
nb = SelectedNotebook[];
FrontEndExecute @ FrontEndToken[nb, "MoveNextLine"];
SelectionMove[nb, All, Cell];
cell = SelectedCells[nb][[1]];
If[SelectionMove[nb, All, CellGroup] === $Failed,
SelectionMove[cell, All, Cell];
];
If[First @ SelectedCells[nb] =!= cell,
SelectionMove[cell, All, Cell];
];
];
KeyBindings`DeleteCell[] := Module[{nb},
nb = SelectedNotebook[];
Switch["CellSelectionType" /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb],
"ContentSelection",
SelectionMove[nb, All, Cell];
NotebookDelete[nb],
"BelowCell" | "AboveCell",
KeyBindings`SelectUpCell[];
NotebookDelete[nb],
"OnCell" | "CellRangeSelection",
NotebookDelete[nb]
]
];
(* I suppose this should be DeleteDownCell or really DeleteNextCell
according to the naming scheme *)
KeyBindings`DeleteCellDown[] := Module[{nb},
nb = SelectedNotebook[];
Switch["CellSelectionType" /. FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb],
"ContentSelection",
SelectionMove[nb, All, Cell];
NotebookDelete[nb],
"BelowCell" | "AboveCell",
KeyBindings`SelectDownCell[];
NotebookDelete[nb],
"OnCell" | "CellRangeSelection",
NotebookDelete[nb]
]
];
(* Takes the current selection, prints it in a new window along with
the TraceView (see top of this file) of the expression. Mostly works *)
KeyBindings`TraceView[] := (
Module[{selection, window},
selection = NotebookRead[SelectedNotebook[]];
window = CreateWindow[];
NotebookWrite[window, selection];
FrontEndExecute @ FrontEndToken[window, "MoveNextLine"];
NotebookWrite[window,
ToBoxes @ (TraceView @@ MakeExpression @ selection)];
FrontEndExecute @ FrontEndToken[window, "MoveNextLine"];
FrontEndExecute @ FrontEndToken[window, "MovePreviousLine"];
FrontEndExecute @ FrontEndToken[window, "MoveNextLine"]
]
);
(* Replaces the current selection with the MaTeX image of it. Unfinished *)
KeyBindings`MaTeX[] := (
Needs["MaTeX`"];
);
(* This has a bug. It does not work when highlighting a function with a
name of length 1. Eg: f[x,y], put cursor right of right bracket then Ctrl +
Shfit + Left and the selection will only go up to the x, not the left bracket.
Not sure exactly what the fix for this is *)
(* Also, because "ExpandSelection" doesnt work the same in a text cell
as in a code cell (for some reason) this doesnt work in a code cell. I
could put a check in to fix that at some point
save selection location
highlight cell and get its type
if it is text cell
then instead of using expand selection just read in everything
to the left and find the last space then highlight up to
there (that probably will work) *)
(* Also this didnt work in this case
bob[jeff_]
place the cursor between the last f of jeff and the _. Now try to Ctrl +
Shift + Left or Ctrl + Left, you will see that it doesnt work *)
KeyBindings`SelectLeftPrevious[] := (
If[
$ActiveSideOfSelection === Neither,
$ActiveSideOfSelection = Left
];
Quiet @ Module[{nb, range, prevChar, range2},
nb = SelectedNotebook[];
range = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
If[
range[[1]] =!= range[[2]],
FrontEndExecute @ FrontEndToken[nb, "MovePrevious"]
];
FrontEndExecute @ FrontEndToken[nb, "SelectPrevious"];
prevChar = NotebookRead[nb];
(*Print@prevChar;*)
Which[
(* Is it a backtick or period *)
prevChar === "`" || prevChar === ".",
(* Then do this *)
(*Print@"backtick or period";*)
FrontEndExecute @ FrontEndToken[nb, "SelectPreviousWord"],
(* Is it a commma *)
prevChar === ",",
(* Then do this *)
(*Print@"comma";*)
KeyBindings`SelectLeftWord[],
(* Is it a word *)
MatchQ[prevChar,
Except["]" | "}" | ")" | "\[RightAssociation]" | ">" | "\"" |
"\[RightDoubleBracket]", _String]],
(* If yes then do this *)
(*Print@"word";*)
FrontEndExecute @ FrontEndToken[nb, "MoveNext"];
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"];
If[
NotebookRead[nb] == ".",
FrontEndExecute @ FrontEndToken[nb, "MovePrevious"];
FrontEndExecute @ FrontEndToken[nb, "SelectPreviousWord"]
];
If[
NotebookRead[nb] == " ",
FrontEndExecute @ FrontEndToken[nb, "SelectPreviousWord"]
],
(* Is it a ] or \[RightDoubleBracket] *)
prevChar === "]" || prevChar === "\[RightDoubleBracket]",
(* If yes then do this *)
(*Print@"] or \[RightDoubleBracket]";*)
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"];
FrontEndExecute @ FrontEndToken[nb, "MovePrevious"];
FrontEndExecute @ FrontEndToken[nb, "SelectNext"];
If[NotebookRead[nb] === "[",
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"],
FrontEndExecute @ FrontEndToken[nb, "MoveNext"];
FrontEndExecute @ FrontEndToken[nb, "MoveNextWord"]
],
(* Is it a box thing *)
MatchQ[prevChar, Except[_String]],
(* If yes then do this *)
(*Print@"box thing";*)
Null (* So MMA doesnt get mad on startup *),
(* Then it must be one of } ) \[RightAssociation] > "*)
True,
(*Print@"one of } ) \[RightAssociation] > \"";*)
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"];
If[
MatchQ[NotebookRead[nb], "*)" | "|>"],
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"]
]
];
range2 =
"CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
SelectionMove[nb, All, Character, range[[2]] - range2 [[1]]]
]
);
KeyBindings`SelectRightNext[] := (
If[
$ActiveSideOfSelection === Neither,
$ActiveSideOfSelection = Right
];
Quiet @ Module[{nb, range, nextChar, range2},
nb = SelectedNotebook[];
range = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
If[
range[[1]] =!= range[[2]],
FrontEndExecute @ FrontEndToken[nb, "MoveNext"]
];
FrontEndExecute @ FrontEndToken[nb, "SelectNext"];
nextChar = NotebookRead[nb];
(*Print@nextChar;*)
Which[
(* Is it a backtick or period *)
nextChar === "`" || nextChar === ".",
(* Then do this *)
(*Print@"backtick or period";*)
FrontEndExecute @ FrontEndToken[nb, "SelectNextWord"],
(* Is it a commma a space or an indenting newline *)
nextChar === "," || nextChar === " " || nextChar === "\[IndentingNewLine]",
(* Then do this *)
(*Print@"comma space or indenting newline";*)
KeyBindings`SelectRightWord[],
(* Is it a word *)
MatchQ[nextChar,
Except["[" | "{" | "(" | "\[LeftAssociation]" | "<" | "\"" |
"\[LeftDoubleBracket]", _String]],
(* If yes then do this *)
(*Print@"word";*)
FrontEndExecute @ FrontEndToken[nb, "MoveNext"];
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"],
(* Is it a [ or \[LeftDoubleBracket] *)
nextChar === "[" || nextChar === "\[LeftDoubleBracket]",
(* If yes then do this *)
(*Print@"[ or \[LeftDoubleBracket]";*)
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"];
FrontEndExecute @ FrontEndToken[nb, "MoveNext"];
KeyBindings`SelectLeftWord[],
(* Is it a box thing *)
MatchQ[nextChar, Except[_String]],
(* If yes then do this *)
(*Print@"box thing";*)
Null (* So MMA doesnt get mad on startup *),
(* Then it must be one of { ( \[LeftAssociation] < " *)
True,
(*Print@"one of { ( \[LeftAssociation] < \"";*)
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"];
If[
MatchQ[NotebookRead[nb], "(*" | "<|"],
FrontEndExecute @ FrontEndToken[nb, "ExpandSelection"]
]
];
range2 = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
SelectionMove[nb, Before, CellContents, AutoScroll -> False];
SelectionMove[nb, Next, Character, range[[1]], AutoScroll -> False];
SelectionMove[nb, All, Character, range2[[2]] - range [[1]], AutoScroll -> False]
]
);
KeyBindings`MoveLeftWord[] := (
$ActiveSideOfSelection = Neither;
If[
NotebookRead[SelectedNotebook[]] =!= {},
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "MovePrevious"]
];
KeyBindings`SelectLeftPrevious[];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "MovePrevious"]
);
KeyBindings`MoveRightWord[] := (
$ActiveSideOfSelection = Neither;
If[
NotebookRead[SelectedNotebook[]] =!= {},
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "MoveNext"]
];
KeyBindings`SelectRightNext[];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "MoveNext"]
);
(* Not being used because it doesnt work the way I want it to *)
KeyBindings`OnControlShiftLeft[] := (
Module[{nb, range, range2},
nb = SelectedNotebook[];
range = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "SelectPrevious"];
range2 = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "SelectNext"];
If[
range2[[2]] - range2[[1]] > range[[2]] - range[[1]],
(* The selection got bigger therefore the active side is left *)
KeyBindings`SelectLeftPrevious[],
(* The selection got smaller therefore the active side is right *)
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "SelectNext"];
KeyBindings`SelectLeftPrevious[];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "MovePrevious"];
range2 = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
SelectionMove[nb, Before, CellContents, AutoScroll -> False];
SelectionMove[nb, Next, Character, range[[1]], AutoScroll -> False];
SelectionMove[nb, All, Character, range2[[2]] - range[[1]], AutoScroll -> False]
];
]
);
(* Not being used because it doesnt work the way I want it to *)
KeyBindings`OnControlShiftRight[] := (
Module[{nb, range, range2},
nb = SelectedNotebook[];
range = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "SelectNext"];
range2 = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "SelectPrevious"];
If[
range2[[2]] - range2[[1]] > range[[2]] - range[[1]],
(* The selection got bigger therefore the active side is right *)
KeyBindings`SelectRightPrevious[],
(* The selection got smaller therefore the active side is left *)
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "SelectPrevious"];
KeyBindings`SelectRightNext[];
FrontEndExecute @ FrontEndToken[SelectedNotebook[], "MoveNext"];
range2 = "CharacterRange" /.
FrontEndExecute @ FrontEnd`UndocumentedGetSelectionPacket[nb];
SelectionMove[nb, All, Character, range[[2]] - range2[[1]], AutoScroll -> False]
];
]
);
@@resource KeyEventTranslations
(* Modifiers can be "Shift", "Control", "Command", "Option"
For Macintosh: "Command" = Command Key, "Option" = Option Key
For X11: "Command" = Mod1, "Option" = Mod2
For Windows: "Command" = Alt, "Option" = Alt
*)
(* Have made changes around lines 12, 44, and 94, and in several other places *)
(* Here is how to call code in a file. Assuming test.m is in the appropriate
directory and has NotebookWrite[SelectedNotebook[], "bob"] in it (for example)
and nothing else, adding this item will make Ctrl + Left print bob in the notebook:
Item[
KeyEvent["Left", Modifiers -> {Control}],
KernelExecute @ Get["/home/tanner/.Mathematica/SystemFiles/FrontEnd/TextResources/X/test.m"],
MenuEvaluator -> Automatic
],
*)
(* IMPORTANT NOTE: KeyEvent and MenuKey (MenuSetup.tr's KeyEvent
equivalent) both can do seemingly arbitrary keys, like j J or /. Thus
Vim mode is possible(!). It seems like the only difference between
KeyEventTranslations and MenuSetup in terms of use is that MenuSetup
also adds the thing to the menu while the former is invisible (but
still there). Oh and MenuSetup has precedence. *)
(* Strange note: MMA can't seem to detect Shift + Tab or Control +
Shift + Tab for some reason. Guess I can't use them for my keybindings
then. *)
(* NotebookEventActions would be incredibly useful for cross
platforming this code if not for this problem: if you have a setting
for Ctrl + j in here, it gets triggered, not j. This means bindings
for Ctrl + j using NotebookEventActions don't work, because they are
really just bindings for j that check if Ctrl is pressed. So they
work but would require modification of the KeyEventTranslations.tr
file, at which point why bother with NotebookEventActions. *)
(* I've also put this in my init.m file:
SetOptions[SelectedNotebook[],
NotebookEventActions -> {{"KeyDown", "\t"} :>
KeyBindings`OnTab[]}];
*)
EventTranslations[{
(* Here are my own bindings *)
Item[
KeyEvent["Left", Modifiers -> {Control}],
KernelExecute @ KeyBindings`MoveLeftWord[],
MenuEvaluator -> Automatic
],
(*
Item[
KeyEvent["Left", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`OnControlShiftLeft[],
MenuEvaluator -> Automatic
],
*)
Item[
KeyEvent["Left", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`SelectLeftPrevious[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["Right", Modifiers -> {Control}],
KernelExecute @ KeyBindings`MoveRightWord[],
MenuEvaluator -> Automatic
],
(*
Item[
KeyEvent["Right", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`OnControlShiftRight[],
MenuEvaluator -> Automatic
],
*)
Item[
KeyEvent["Right", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`SelectRightNext[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["r", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`DeleteCellDown[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["r", Modifiers -> {Control}],
KernelExecute @ KeyBindings`DeleteCell[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["[", Modifiers -> {}],
KernelExecute @ KeyBindings`OnOpenBracket[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["{", Modifiers -> {}],
KernelExecute @ KeyBindings`OnOpenBrace[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["(", Modifiers -> {}],
KernelExecute @ KeyBindings`OnOpenParenthese[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["\"", Modifiers -> {}],
KernelExecute @ KeyBindings`OnQuotation[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["<", Modifiers -> {}],
KernelExecute @ KeyBindings`OnLessThan[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["Backspace", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`Desurround[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["[", Modifiers -> {Command}],
KernelExecute @ NotebookWrite[InputNotebook[], "\[LeftDoubleBracket]"],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["]", Modifiers -> {Command}],
KernelExecute @ NotebookWrite[InputNotebook[], "\[RightDoubleBracket]"],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["<", Modifiers -> {Command}],
KernelExecute @ NotebookWrite[InputNotebook[], "\[LeftAssociation]"],
MenuEvaluator -> Automatic
],
Item[
KeyEvent[">", Modifiers -> {Command}],
KernelExecute @ NotebookWrite[InputNotebook[], "\[RightAssociation]"],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["Up", Modifiers -> {Control}],
KernelExecute @ KeyBindings`OnControlUp[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["Down", Modifiers -> {Control}],
KernelExecute @ KeyBindings`OnControlDown[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["Up", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`SelectUpCell[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["Down", Modifiers -> {Control, Shift}],
KernelExecute @ KeyBindings`SelectDownCell[],
MenuEvaluator -> Automatic
],
Item[
KeyEvent["Return", Modifiers -> {Shift}],
KernelExecute @ KeyBindings`OnShiftReturn[],
MenuEvaluator -> Automatic
],
(* Commented out because they clash with my bindings *)
(*
Item[KeyEvent[".", Modifiers -> {Command}], "Tab"],
Item[KeyEvent[",", Modifiers -> {Command}], "MovePreviousPlaceHolder"],
Item[KeyEvent[".", Modifiers -> {Control, Command}], "MoveNextExpression"],
Item[KeyEvent[",", Modifiers -> {Control, Command}], "MovePreviousExpression"],
*)
(* Evaluation *)
Item[KeyEvent["Enter"], "EvaluateCells"],
Item[KeyEvent["KeypadEnter"], "EvaluateCells"],
(* Commented out because it clashes with my bindings *)
(* Item[KeyEvent["Return", Modifiers -> {Shift}], "HandleShiftReturn"], *)
Item[KeyEvent["KeypadEnter", Modifiers -> {Shift}], "EvaluateNextCell"],
Item[KeyEvent["Enter", Modifiers -> {Shift}], "EvaluateNextCell"],
Item[KeyEvent["Return", Modifiers -> {Shift, Control}], Evaluate[All]],
Item[KeyEvent["Return", Modifiers -> {Option}], "SimilarCellBelow"],
Item[KeyEvent[",", Modifiers->{Command}], FrontEnd`EvaluatorInterrupt[Automatic]],
Item[KeyEvent["Escape"], "ShortNameDelimiter"],
(* Cursor control *)
Item[KeyEvent["Up"], "MovePreviousLine"],
Item[KeyEvent["Down"], "MoveNextLine"],
Item[KeyEvent["Left"], "MovePrevious"],
Item[KeyEvent["Right"], "MoveNext"],
(* Commenting these out because they clash with my modifications *)
(*
Item[KeyEvent["Right", Modifiers -> {Control}], "MoveNextWord"],
Item[KeyEvent["Left", Modifiers -> {Control}], "MovePreviousWord"],
*)
Item[KeyEvent["End"], "MoveLineEnd"],
Item[KeyEvent["Home"], "MoveLineBeginning"],
(* Selection *)
Item[KeyEvent["Right", Modifiers -> {Shift}], "SelectNext"],
Item[KeyEvent["Left", Modifiers -> {Shift}], "SelectPrevious"],
(* Commenting these out because they interfere with my modifications *)
(*
Item[KeyEvent["Right", Modifiers -> {Control, Shift}], "SelectNextWord"],
Item[KeyEvent["Left", Modifiers -> {Control, Shift}], "SelectPreviousWord"],
*)
Item[KeyEvent["Down", Modifiers -> {Shift}], "SelectNextLine"],
Item[KeyEvent["Up", Modifiers -> {Shift}], "SelectPreviousLine"],
Item[KeyEvent["Home", Modifiers -> {Shift}], "SelectLineBeginning"],
Item[KeyEvent["End", Modifiers -> {Shift}], "SelectLineEnd"],
(* Ok I think I modified this line as well *)
Item[KeyEvent[".", Modifiers -> {Control}], "NewRow"],
Item[KeyEvent["KeypadDecimal", Modifiers -> {Control}], "ExpandSelection"],
(* Notebook window control *)
(* Commenting these two out because they clash with my bindings *)
(*
Item[KeyEvent["Up", Modifiers -> {Control}], "ScrollLineUp"],
Item[KeyEvent["Down", Modifiers -> {Control}], "ScrollLineDown"],
*)
Item[KeyEvent["PageUp"], "ScrollPageUp"],
Item[KeyEvent["PageDown"], "ScrollPageDown"],
Item[KeyEvent["Prior"], "ScrollPageUp"],
Item[KeyEvent["Next"], "ScrollPageDown"],
Item[KeyEvent["Home", Modifiers -> {Control}],
FrontEndExecute[{
FrontEnd`SelectionMove[FrontEnd`InputNotebook[], Before, Notebook],
FrontEnd`FrontEndToken[FrontEnd`InputNotebook[], "ScrollNotebookStart"]
}]],
Item[KeyEvent["End", Modifiers -> {Control}],
FrontEndExecute[{
FrontEnd`SelectionMove[FrontEnd`InputNotebook[], After, Notebook],
FrontEnd`FrontEndToken[FrontEnd`InputNotebook[], "ScrollNotebookEnd"]
}]],
Item[KeyEvent["Left", Modifiers->{Command}], "HyperlinkGoBack"],
Item[KeyEvent["Right", Modifiers->{Command}], "HyperlinkGoForward"],
(* Input *)
Item[KeyEvent["Return"], "Linebreak"],
Item[KeyEvent["Tab"], "Tab"],
Item[KeyEvent["Backspace"], "DeletePrevious"],
Item[KeyEvent["Delete"], "DeleteNext"],
Item[KeyEvent["Backspace", Modifiers->{Control}], "DeletePreviousWord"],
Item[KeyEvent["Delete", Modifiers->{Control}], "DeleteNextWord"],
(* Typesetting input *)
Item[KeyEvent["6", Modifiers -> {Control}], "Superscript"],
Item[KeyEvent["Keypad6", Modifiers -> {Control}], "Superscript"],
Item[KeyEvent["^", Modifiers -> {Control}], "Superscript"],
Item[KeyEvent["-", Modifiers -> {Control}], "Subscript"],
Item[KeyEvent["KeypadSubtract", Modifiers -> {Control}], "Subscript"],
Item[KeyEvent["_", Modifiers ->{Control}], "Subscript"],
Item[KeyEvent["/", Modifiers -> {Control}], "Fraction"],
Item[KeyEvent["KeypadDivide", Modifiers -> {Control}], "Fraction"],
Item[KeyEvent["2", Modifiers -> {Control}], "Radical"],
Item[KeyEvent["Keypad2", Modifiers -> {Control}], "Radical"],
Item[KeyEvent["@", Modifiers -> {Control}], "Radical"],
Item[KeyEvent["7", Modifiers -> {Control}], "Above"],
Item[KeyEvent["&", Modifiers -> {Control}], "Above"],
Item[KeyEvent["Keypad7", Modifiers -> {Control}], "Above"],
Item[KeyEvent["$", Modifiers -> {Control}], "Below"],
Item[KeyEvent["4", Modifiers -> {Control}], "Below"],
Item[KeyEvent["Keypad4", Modifiers -> {Control}], "Below"],
Item[KeyEvent[",", Modifiers -> {Control}], "NewColumn"],
(* It looks like I may have modified the below Item as well *)
Item[KeyEvent["Return", Modifiers -> {Control}], "ExpandSelection"],
(*Here I have commented these out in case they interfere with some of my built in key bindings *)
(*
Item[KeyEvent["9", Modifiers -> {Control}], "CreateInlineCell"],
Item[KeyEvent["(", Modifiers -> {Control}], "CreateInlineCell"],
Item[KeyEvent["Keypad9", Modifiers -> {Control}], "CreateInlineCell"],
Item[KeyEvent[")", Modifiers -> {Control}], "MoveNextCell"],
Item[KeyEvent["0", Modifiers -> {Control}], "MoveNextCell"],
Item[KeyEvent["Keypad0", Modifiers -> {Control}], "MoveNextCell"],
*)
Item[KeyEvent["5", Modifiers -> {Control}, CellClass -> BoxFormData], "Otherscript"],
Item[KeyEvent["Keypad5", Modifiers -> {Control}, CellClass -> BoxFormData], "Otherscript"],
Item[KeyEvent["%", Modifiers -> {Control}, CellClass -> BoxFormData], "Otherscript"],
Item[KeyEvent["Left", Modifiers->{Command}, CellClass -> BoxFormData], "NudgeLeft"],
Item[KeyEvent["Right", Modifiers->{Command}, CellClass -> BoxFormData], "NudgeRight"],
Item[KeyEvent["PageUp", Modifiers-> {Control}, CellClass -> BoxFormData], "PreviousFunctionTemplate"],
Item[KeyEvent["PageDown", Modifiers-> {Control}, CellClass -> BoxFormData], "NextFunctionTemplate"],
(* These are used for 2-d expression (Ctrl + Shift + 6 or Ctrl + /) navigation *)
(* Typesetting motion commands *)
Item[KeyEvent[" ", Modifiers -> {Control}], "MoveExpressionEnd"],
(* I am commenting out the three below keybindings so they don'the interfere with my own *)
(* Item[KeyEvent["Tab", Modifiers -> {Shift}], "MovePreviousPlaceHolder"], *)
Item[KeyEvent["Tab", Modifiers -> {Control}, CellClass -> BoxFormData], "MoveNextExpression"],
Item[KeyEvent["Tab", Modifiers -> {Control, Shift}, CellClass -> BoxFormData], "MovePreviousExpression"],
(* Drawing tool commands *)
Item[KeyEvent["o", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["Select"]]],
(* Reassigned to Rectangle in v8; I doubt anyone knows "r" does anything. Double-click is easier. *)
(* Item[KeyEvent["r", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["Reshape"]]],*)
Item[KeyEvent["p", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawPoint"]]],
Item[KeyEvent["c", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawCircle"]]],
Item[KeyEvent["d", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawDisk"]]],
Item[KeyEvent["f", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawFreehand"]]],
Item[KeyEvent["a", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawArrow"]]],
Item[KeyEvent["l", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawLine"]]],
Item[KeyEvent["b", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawBox"]]],
(* "q" for Rectangle deprecated in v8 but preserved for "backward compatibilty" for one version *)
Item[KeyEvent["q", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawRectangle"]]],
Item[KeyEvent["r", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawRectangle"]]],
Item[KeyEvent["s", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawPolyline"]]],
Item[KeyEvent["g", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["DrawPolygon"]]],
Item[KeyEvent["t", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["PlaceText"]]],
Item[KeyEvent["m", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["PlaceMath"]]],
Item[KeyEvent["i", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["SampleColor"]]],
Item[KeyEvent[".", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["GetCoordinates"]]],
Item[KeyEvent["e", CellClass->BoxFormData, BoxClass->GraphEdit2D], FrontEndExecute[Select2DTool["SampleStyle"]]],
Item[KeyEvent["o", CellClass->BoxFormData, BoxClass->GraphEdit3D], FrontEndExecute[Select3DTool["Select"]]],
Item[KeyEvent["i", CellClass->BoxFormData, BoxClass->GraphEdit3D], FrontEndExecute[Select3DTool["SampleColor"]]],
Item[KeyEvent["v", CellClass->BoxFormData, BoxClass->GraphEdit3D], FrontEndExecute[Select3DTool["AdjustView"]]],
Item[KeyEvent["m", CellClass->BoxFormData, BoxClass->GraphEdit3D], FrontEndExecute[Select3DTool["AdjustLights"]]],
(* Grouping commands *)
Item[KeyEvent["g", Modifiers -> {Control, Shift}], "CellGroup"],
Item[KeyEvent["u", Modifiers -> {Control, Shift}], "CellUngroup"],
Item[KeyEvent["g", Modifiers -> {Control, Shift}, CellClass->BoxFormData, BoxClass->GraphEdit2D], "Group"],
Item[KeyEvent["u", Modifiers -> {Control, Shift}, CellClass->BoxFormData, BoxClass->GraphEdit2D], "Ungroup"],
(* Miscellaneous menu commands *)
Item[KeyEvent["Cut"], "Cut"],
Item[KeyEvent["Copy"], "Copy"],
Item[KeyEvent["Paste"], Paste[After]],
Item[KeyEvent["Undo"], "Undo"],
Item[KeyEvent["Redo"], "Redo"],
Item[KeyEvent["z", Modifiers -> {Control, Shift}], "Redo"],
Item[KeyEvent["Help"], "SelectionHelpDialog"],
Item[KeyEvent["Insert", Modifiers -> {Shift}], Paste[After]],
Item[KeyEvent["Insert", Modifiers -> {Control}], "Copy"],
Item[KeyEvent["Delete", Modifiers -> {Shift}], "Cut"],
Item[KeyEvent["F1", Modifiers->{Shift}], SelectionHelpDialog[False]],
Item[KeyEvent["F2"], FrontEnd`CompleteSelection[True]]
}]
(* My changes are around 96, 150, 179, 438, 475, and 672 which is where
most of the Macros are implemented *)
Menu["Mathematica",
{
Menu["&File",
{
Menu["&New",
{
MenuItem["&Notebook", "New", MenuKey["n", Modifiers->{"Control"}]],
MenuItem["St&yled Notebook...", FrontEndExecute[{FrontEnd`NotebookOpen[FrontEnd`FindFileOnPath["StylesheetChooser.nb", "PalettePath"]]}]],
MenuItem["&Presenter Notebook...", FrontEndExecute[{FrontEnd`NotebookOpen[FrontEnd`FindFileOnPath["PresenterNotebookChooser.nb", "PalettePath"]]}]],
Delimiter,
Menu["Pro&grammatic Notebook",
{
MenuItem["Te&mplate Notebook", KernelExecute[NotebookTemplating`CreateTemplateNotebook[]], MenuEvaluator->"System", Method -> "Queued"],
MenuItem["Testing Notebook", KernelExecute[Block[{$ContextPath}, Needs["MUnit`"]; MUnit`PaletteNewTestNotebook[]]], MenuEvaluator->"System"]
}],
Menu["Package/&Script",
{
MenuItem["Wolfram Language &Package (.wl)", "NewPackage"],
MenuItem["WolframS&cript Script (.wls)", "NewScript"]
}],
Menu["&Repository Item",
{
MenuItem["&Demonstrations Project Notebook", KernelExecute[FrontEnd`Private`PutDemonstrationsTemplate[]], MenuEvaluator -> Automatic],
MenuItem["Data &Repository Item", KernelExecute[CreateNotebook["DataResource"]], MenuEvaluator -> Automatic, Method -> "Queued"],
MenuItem["&Function Repository Item", KernelExecute[CreateNotebook["FunctionResource"]], MenuEvaluator -> Automatic, Method -> "Queued"]
}],
MenuItem["&Text File (.txt)", "NewText"],
Delimiter,
MenuItem["&Chat Session...", "NewChat"]
}],
MenuItem["Open", "MenuListOpenItems", MenuAnchor->True],
MenuItem["&Close", "Close", MenuKey["w", Modifiers->{"Control"}]],
MenuItem["Save", "MenuListSaveItems", MenuAnchor->True],
MenuItem["Publish to Cloud...", KernelExecute[NotebookTools`OpenCloudPublishDialog[InputNotebook[]]], MenuEvaluator -> "System", Method -> "Queued"],
MenuItem["Save Se&lection As...", "SelectionSaveSpecial", RemoveMask->{"NoLocalFileAccess"}],
MenuItem["Re&vert...", "Revert"],
Delimiter,
MenuItem["Preview for Wolfram Pla&yer", "CDFPreview", RemoveMask->{"NoLocalFileAccess"}],
Delimiter,
MenuItem["&Install...", FrontEndExecute[{FrontEnd`NotebookOpen[
FrontEnd`FindFileOnPath["InstallDialog.nb", "PrivatePathsSystemResources"]]}], RemoveMask->{"NoLocalFileAccess"}],
Delimiter,
MenuItem["Send &To...", "NotebookMail", RemoveMask->{"NoLocalFileAccess"}],
Delimiter,
Menu["Printin&g Settings",
{
MenuItem["Page &Setup...", "SystemPrintOptionsDialog"],
MenuItem["Printing &Options...", "PrintOptionsDialog"],
MenuItem["&Headers and Footers...", KernelExecute[FE`headersFootersDialog[]], MenuEvaluator -> "System"],
MenuItem["Show Page &Breaks", ShowPageBreaks->Toggle, Scope->NotebookDefault],
Delimiter,
Menu["&Printing Environment",
{
MenuItem["Styles", "MenuListPrintingStyleEnvironments", MenuAnchor->True]
}]
}],
MenuItem["&Print...", "PrintDialog", MenuKey["p", Modifiers->{"Control"}]],
MenuItem["Print Previe&w...", "PrintPreviewDialog"],
Delimiter,
MenuItem["First Favorite File", "MenuListNotebooksMenu", MenuAnchor->True],
Delimiter,
MenuItem["E&xit", "FrontEndQuit"]
}],
Menu["&Edit",
{
MenuItem["&Undo", "Undo", MenuKey["z", Modifiers->{"Control"}]],
MenuItem["Re&do", "Redo", MenuKey["y", Modifiers->{"Control"}]],
Delimiter,
MenuItem["Cu&t", "Cut", MenuKey["x", Modifiers->{"Control"}]],
MenuItem["&Copy", "Copy", MenuKey["c", Modifiers->{"Control"}]],
Menu["Cop&y As",
{
MenuItem["Plain &Text", FrontEnd`CopySpecial["PlainText"], MenuKey["C", Modifiers->{"Control", "Shift"}]],
MenuItem["&Input Text", FrontEnd`CopySpecial["InputText"]],
MenuItem["&LaTeX",
KernelExecute[ToExpression["FrontEnd`CopyAsTeX[]"]],
MenuEvaluator -> "System"],
MenuItem["M&athML",
KernelExecute[ToExpression["FrontEnd`CopyAsMathML[]"]],
MenuEvaluator -> "System"],
Delimiter,
MenuItem["Cell &Object", FrontEnd`CopySpecial["CellObject"]],
MenuItem["&Cell Expression", FrontEnd`CopySpecial["CellExpression"]],
MenuItem["Notebook Ob&ject", FrontEnd`CopySpecial["NotebookObject"]],
MenuItem["&Notebook Expression", FrontEnd`CopySpecial["NotebookExpression"]],
Delimiter,
MenuItem["&Bitmap", FrontEnd`CopySpecial["MGF"]],
MenuItem["&Metafile", FrontEnd`CopySpecial["EMF"]]
}],
MenuItem["&Paste", FrontEnd`Paste[Automatic], MenuKey["v", Modifiers->{"Control"}]],
MenuItem["Clea&r\tDelete", "Clear"],
Delimiter,
(* I have also made a change here *)
(* This is typically on Ctrl + . but I changed it to Ctrl + Return *)
MenuItem["E&xtend Selection", "ExpandSelection", MenuKey["Return", Modifiers->{"Control"}]],
MenuItem["Select &All", "SelectAll", MenuKey["a", Modifiers->{"Control"}]],
MenuItem["Check &Balance", "Balance", MenuKey["B", Modifiers->{"Control", "Shift"}]],
Delimiter,
MenuItem["Un/Iconi&ze Selection", KernelExecute[FE`iconizeSelectionToggle[]], MenuKey["'", Modifiers->{"Control","Option"}], MenuEvaluator -> Automatic, Method -> "Queued"],
MenuItem["Un/C&omment Selection", KernelExecute[FE`toggleComment[]], MenuKey["/", Modifiers->{"Command"}], MenuEvaluator -> "System", Method -> "Queued"],
MenuItem["Complete Se&lection", FrontEnd`CompleteSelection[True], MenuKey["k", Modifiers->{"Control"}]],
MenuItem["&Make Template", "TemplateSelection", MenuKey["K", Modifiers->{"Control", "Shift"}]],
MenuItem["Chec&k Spelling...", "FindNextMisspelling", MenuKey[";", Modifiers->{"Command"}]],
Delimiter,
MenuItem["&Find...", KernelExecute[If[CurrentValue["PluginEnabled"], FrontEndTokenExecute[InputNotebook[], "FindExpression"], FrontEndTokenExecute["SelectionSetFindEx"];FrontEnd`DialogOpen["Find.nb", True]]], MenuEvaluator -> "System", MenuKey["f", Modifiers->{"Control"}]],
MenuItem["&Enter Selection", "SelectionSetFind", MenuKey["e", Modifiers->{"Control"}]],
MenuItem["Find &Next", "FindNextMatch", MenuKey["F3", Modifiers->{}]],
MenuItem["Find Pre&vious", "FindPreviousMatch", MenuKey["F3", Modifiers->{"Shift"}]],
Delimiter,
MenuItem["Preference&s...", "PreferencesDialog"]
}],
Menu["&Insert",
{
MenuItem["&Input from Above", FrontEnd`DuplicatePreviousInput[After], MenuKey["l", Modifiers->{"Control"}]],
MenuItem["&Output from Above", FrontEnd`DuplicatePreviousOutput[After], MenuKey["L", Modifiers->{"Control", "Shift"}]],
Delimiter,
MenuItem["Cell with Same St&yle", "SimilarCellBelow", MenuKey["Return", Modifiers->{"Command"}]],
Delimiter,
MenuItem["Inline Free-form Input",
KernelExecute[AlphaIntegration`LinguisticAssistant[InputNotebook[]]],
MenuKey["=", Modifiers->{"Control"}], MenuEvaluator -> "Local"],
Delimiter,
MenuItem["&Special Character...", FrontEndExecute[{FrontEnd`NotebookOpen["SpecialCharacters.nb"]}]],
MenuItem["&Color...", "ColorSelectorDialog"],
Menu["Citatio&n",
{
MenuItem["Bibliographical &Reference...", "InsertBibReference"],
MenuItem["Bibliographical &Note...", "InsertBibNote"],
MenuItem["&Edit Bibliographical Note...", "EditBibNote"],
Delimiter,
MenuItem["Set / Change Citation &Style...", "SetCitationStyle"],
MenuItem["Set / Change Note S&tyle...", "SetBibNoteStyle"],
MenuItem["Re&build Bibliography and Notes", "RebuildBibAndNotes"]
}, RemoveMask->{"NoLocalFileAccess"}],
Menu["&Typesetting",
{
MenuItem["&End Subexpression", "MoveExpressionEnd", MenuKey[" ", Modifiers->{"Control"}]],
Delimiter,
MenuItem["&Superscript", "Superscript", MenuKey["6", Modifiers->{"Control"}]],
MenuItem["Subs&cript", "Subscript", MenuKey["-", Modifiers->{"Control"}]],
MenuItem["&Above", "Above", MenuKey["7", Modifiers->{"Control"}]],
MenuItem["&Below", "Below", MenuKey["4", Modifiers->{"Control"}]],
MenuItem["&Opposite Position", "Otherscript", MenuKey["5", Modifiers->{"Control"}]],
Delimiter,
(* These mess up some of my keybindings so I am commenting them out *)
(* MenuItem["Matching []", "InsertMatchingBrackets", MenuKey["]", Modifiers->{"Command"}]],
MenuItem["Matching {}", "InsertMatchingBraces", MenuKey["}", Modifiers->{"Command"}]],
MenuItem["Matching ()", "InsertMatchingParentheses", MenuKey[")", Modifiers->{"Command"}]],
Delimiter, *)
MenuItem["&Fraction", "Fraction", MenuKey["/", Modifiers->{"Control"}]],
MenuItem["&Radical", "Radical", MenuKey["2", Modifiers->{"Control"}]],
Delimiter,
(* I have commandeered these menu items for my own key bindings *)
(* I have also commented out some stuff at lines 469-472 *)
(*MenuItem["S&tart Inline Cell", "CreateInlineCell", MenuKey["9", Modifiers->{"Control"}]],*)
(*MenuItem["End &Inline Cell", "MoveNextCell", MenuKey["0", Modifiers->{"Control"}]],*)
MenuItem["Add Fra&me", FrontEndExecute[{
FrontEnd`NotebookApply[FrontEnd`InputNotebook[],
BoxData[FrameBox["\[SelectionPlaceholder]"]]]}]],
Delimiter,
MenuItem["Nudge &Left\tAlt+Left", "NudgeLeft"],
MenuItem["Nudge Ri&ght\tAlt+Right", "NudgeRight"],
MenuItem["Nudge &Down", "NudgeDown", MenuKey["Down", Modifiers->{"Command"}]],
MenuItem["Nudge &Up", "NudgeUp", MenuKey["Up", Modifiers->{"Command"}]],
MenuItem["Remove Ad&justments", "RemoveAdjustments"]
}],
Menu["Table/&Matrix",
{
MenuItem["&New...", "CreateGridBoxDialog"],
Delimiter,
(* I also made a change to this one *)
MenuItem["Add &Row", "NewColumn", MenuKey[".", Modifiers->{"Control"}]],
MenuItem["Add &Column", "NewRow", MenuKey[",", Modifiers->{"Control"}]],
Delimiter,
MenuItem["&Make Spanning", "MakeSelectionSpan"],
MenuItem["&Split Spanning", "MakeSelectionNotSpan"]
}],
Menu["Ho&rizontal Line",
{
MenuItem["N&one", CellFrame->Inherited, Scope->SelectionCell],
Delimiter,
MenuItem["&Thin Line Above", CellFrame->{{0,0},{0,0.5}}, Scope->SelectionCell],
MenuItem["&Medium Line Above", CellFrame->{{0,0},{0,2}}, Scope->SelectionCell],
MenuItem["T&hick Line Above", CellFrame->{{0,0},{0,3}}, Scope->SelectionCell],
Delimiter,
MenuItem["Th&in Line Below", CellFrame->{{0,0},{0.5,0}}, Scope->SelectionCell],
MenuItem["Me&dium Line Below", CellFrame->{{0,0},{2,0}}, Scope->SelectionCell],
MenuItem["Thi&ck Line Below", CellFrame->{{0,0},{3,0}}, Scope->SelectionCell],
Delimiter,
MenuItem["Paste Thi&n Line Object", FrontEndExecute[{
FrontEnd`NotebookWrite[FrontEnd`InputNotebook[],
Cell[" ", "Text",
Editable->False,
Selectable->False,
CellElementSpacings->{"CellMinHeight"->1},
ShowCellBracket->False,
CellMargins->{{0, 0}, {1, 1}},
CellSize->{Inherited, 3},
CellFrame->{{0,0},{0,0.5}},
CellFrameMargins->0,
CellFrameColor->RGBColor[0, 0, 1]],
After]
}]],
MenuItem["&Paste Medium Line Object", FrontEndExecute[{
FrontEnd`NotebookWrite[FrontEnd`InputNotebook[],
Cell[" ", "Text",
Editable->False,
Selectable->False,
CellElementSpacings->{"CellMinHeight"->1},
ShowCellBracket->False,
CellMargins->{{0, 0}, {1, 1}},
CellSize->{Inherited, 4},
CellFrame->{{0,0},{0,2}},
CellFrameMargins->0,
CellFrameColor->RGBColor[0, 0, 1]], After]
}]],
MenuItem["Paste Thic&k Line Object", FrontEndExecute[{
FrontEnd`NotebookWrite[FrontEnd`InputNotebook[],
Cell[" ", "Text",
Editable->False,
Selectable->False,
CellElementSpacings->{"CellMinHeight"->1},
ShowCellBracket->False,
CellMargins->{{0, 0}, {1, 1}},
CellSize->{Inherited, 5},
CellFrame->{{0,0},{0,3}},
CellFrameMargins->0,
CellFrameColor->RGBColor[0, 0, 1]], After]
}]]
}],
MenuItem["&File Path...", "FileNameDialog", RemoveMask->{"NoLocalFileAccess"}],
Delimiter,
Menu["&Picture",
{
MenuItem["From &File...", "ImportPictures"],
MenuItem["New &Graphic", "InsertNewGraphic", MenuKey["1", Modifiers->{"Control"}]]
}],
MenuItem["Fi&le...", "Import", RemoveMask->{"NoLocalFileAccess"}],
Delimiter,
MenuItem["&Hyperlink...", "CreateHyperlinkDialog", MenuKey["H", Modifiers->{"Control", "Shift"}]],
MenuItem["&Automatic Numbering...", "CreateCounterBoxDialog"],
Delimiter,
MenuItem["Page &Break", "InsertSplitBreak"]
}],
Menu["Fo&rmat",
{
Menu["&Style",
{
LinkedItems[{
MenuItem["Start Cell Style Names", "MenuListStyles", MenuAnchor->True]
}],
Delimiter,
MenuItem["&Other...", "StyleOther", MenuKey["0", Modifiers->{"Command"}]]
}],
MenuItem["Clear Fo&rmatting", "ClearCellOptions", MenuKey[" ", Modifiers->{"Control", "Shift"}]],
Delimiter,
Menu["St&ylesheet",
{
LinkedItems[{
MenuItem["Styles", "MenuListStyleDefinitions", MenuAnchor->True]
}]
}],
Menu["Screen &Environment",
{
LinkedItems[{
MenuItem["Styles", "MenuListScreenStyleEnvironments", MenuAnchor->True]
}]
}],
MenuItem["Edit Sty&lesheet...", "EditStyleDefinitions"],
Delimiter,
MenuItem["Option &Inspector...", "OptionsDialog", Scope->Selection, MenuKey["O", Modifiers->{"Control", "Shift"}]],
Delimiter,
MenuItem["&Font...", "FontPanel"],
Menu["Fa&ce",
{
MenuItem["&Plain", "PlainFont"],
MenuItem["&Bold", FontWeight->Toggle, MenuKey["b", Modifiers->{"Control"}]],
MenuItem["&Italic", FontSlant->Toggle, MenuKey["i", Modifiers->{"Control"}]],
MenuItem["&Underline", FrontEnd`FontVariationsUnderline->Toggle, MenuKey["u", Modifiers->{"Control"}]]
}],
Menu["Si&ze",
{
MenuItem["&Larger", FontSize->Larger, MenuKey["=", Modifiers->{"Command"}]],
MenuItem["&Smaller", FontSize->Smaller, MenuKey["-", Modifiers->{"Command"}]],
Delimiter,
LinkedItems[{
MenuItem["&9 Point", FontSize->9],
MenuItem["1&0 Point", FontSize->10],
MenuItem["&12 Point", FontSize->12],
MenuItem["1&4 Point", FontSize->14],
MenuItem["1&6 Point", FontSize->16],
MenuItem["1&8 Point", FontSize->18],
MenuItem["&24 Point", FontSize->24],
MenuItem["&36 Point", FontSize->36],
MenuItem["&72 Point", FontSize->72]
}],
Delimiter,
MenuItem["&Other...", "FontSizeDialog"]
}],
Menu["Te&xt Color",
{
MenuItem["Palette...", "FontColorDialog"],
Delimiter,
LinkedItems[{
MenuItem["Black", FontColor->GrayLevel[0]],
MenuItem["Gray", FontColor->GrayLevel[0.5]],
MenuItem["White", FontColor->GrayLevel[1]],
Delimiter,
MenuItem["Blue", FontColor->RGBColor[0, 0, 1]],
MenuItem["Brown", FontColor->RGBColor[0.6, 0.4, 0.2]],
MenuItem["Cyan", FontColor->RGBColor[0, 1, 1]],
MenuItem["Green", FontColor->RGBColor[0, 1, 0]],
MenuItem["Magenta", FontColor->RGBColor[1, 0, 1]],
MenuItem["Orange", FontColor->RGBColor[1, 0.5, 0]],
MenuItem["Pink", FontColor->RGBColor[1, 0.5, 0.5]],
MenuItem["Purple", FontColor->RGBColor[0.5, 0, 0.5]],
MenuItem["Red", FontColor->RGBColor[1, 0, 0]],
MenuItem["Yellow", FontColor->RGBColor[1, 1, 0]]
}]
}],
Menu["Back&ground Color",
{
MenuItem["Palette...", "BackgroundDialog"],
Delimiter,
LinkedItems[{
MenuItem["None", Background->None],
Delimiter,
MenuItem["Black", Background->GrayLevel[0]],
MenuItem["Gray", Background->GrayLevel[0.5]],
MenuItem["Light Gray", Background->GrayLevel[0.85]],
MenuItem["White", Background->GrayLevel[1]],
Delimiter,
MenuItem["Light Blue", Background->RGBColor[0.87, 0.94, 1]],
MenuItem["Light Brown", Background->RGBColor[0.94, 0.91, 0.88]],
MenuItem["Light Cyan", Background->RGBColor[0.9, 1, 1]],
MenuItem["Light Green", Background->RGBColor[0.88, 1, 0.88]],
MenuItem["Light Magenta",Background->RGBColor[1, 0.9, 1]],
MenuItem["Light Orange",Background->RGBColor[1, 0.9, 0.8]],
MenuItem["Light Pink", Background->RGBColor[1, 0.925, 0.925]],
MenuItem["Light Purple",Background->RGBColor[0.94, 0.88, 0.94]],
MenuItem["Light Red", Background->RGBColor[1, 0.85, 0.85]],
MenuItem["Light Yellow",Background->RGBColor[1, 1, 0.85]],
Delimiter,
MenuItem["Orange", Background->RGBColor[1, 0.5, 0]],
MenuItem["Pink", Background->RGBColor[1, 0.5, 0.5]],
MenuItem["Yellow", Background->RGBColor[1, 1, 0]]
}]
}],
Menu["Cell &Dingbat",
{
LinkedItems[{
MenuItem["None", CellDingbat->None, Scope->SelectionCell],
Delimiter,
MenuItem["Filled Square", CellDingbat->"\[FilledSquare]", Scope->SelectionCell],
MenuItem["Gray Square", CellDingbat->"\[GraySquare]", Scope->SelectionCell],
MenuItem["Empty Square", CellDingbat->"\[EmptySquare]", Scope->SelectionCell],
MenuItem["Dotted Square", CellDingbat->"\[DottedSquare]", Scope->SelectionCell],
MenuItem["Filled Small Square", CellDingbat->"\[FilledSmallSquare]", Scope->SelectionCell],
MenuItem["Empty Small Square", CellDingbat->"\[EmptySmallSquare]", Scope->SelectionCell],
Delimiter,
MenuItem["Filled Circle", CellDingbat->"\[FilledCircle]", Scope->SelectionCell],
MenuItem["Gray Circle", CellDingbat->"\[GrayCircle]", Scope->SelectionCell],
MenuItem["Empty Circle", CellDingbat->"\[EmptyCircle]", Scope->SelectionCell],
MenuItem["Filled Small Circle", CellDingbat->"\[FilledSmallCircle]", Scope->SelectionCell],
MenuItem["Empty Small Circle", CellDingbat->"\[EmptySmallCircle]", Scope->SelectionCell],
Delimiter,
MenuItem["Filled Diamond", CellDingbat->"\[FilledDiamond]", Scope->SelectionCell],
MenuItem["Empty Diamond", CellDingbat->"\[EmptyDiamond]", Scope->SelectionCell],
MenuItem["Filled Up Triangle", CellDingbat->"\[FilledUpTriangle]", Scope->SelectionCell],
MenuItem["Empty Up Triangle", CellDingbat->"\[EmptyUpTriangle]", Scope->SelectionCell],
MenuItem["Filled Down Triangle",CellDingbat->"\[FilledDownTriangle]", Scope->SelectionCell],
MenuItem["Empty Down Triangle", CellDingbat->"\[EmptyDownTriangle]", Scope->SelectionCell],
Delimiter,
MenuItem["Watch", CellDingbat->"\[WatchIcon]", Scope->SelectionCell],
MenuItem["Filled Star", CellDingbat->"\[FivePointedStar]", Scope->SelectionCell],
MenuItem["Happy Smiley", CellDingbat->"\[HappySmiley]", Scope->SelectionCell],
MenuItem["Neutral Smiley", CellDingbat->"\[NeutralSmiley]", Scope->SelectionCell],
MenuItem["Sad Smiley", CellDingbat->"\[SadSmiley]", Scope->SelectionCell],
MenuItem["Light Bulb", CellDingbat->"\[LightBulb]", Scope->SelectionCell],
MenuItem["Wolf", CellDingbat->"\[Wolf]", Scope->SelectionCell],
Delimiter,
MenuItem["Club Suit", CellDingbat->"\[ClubSuit]", Scope->SelectionCell],
MenuItem["Diamond Suit", CellDingbat->"\[DiamondSuit]", Scope->SelectionCell],
MenuItem["Heart Suit", CellDingbat->"\[HeartSuit]", Scope->SelectionCell],
MenuItem["Spade Suit", CellDingbat->"\[SpadeSuit]", Scope->SelectionCell]
}]
}],
Delimiter,
Menu["Text &Alignment",
{
LinkedItems[{
MenuItem["Align &Left", TextAlignment->Left, Scope->SelectionCell],
MenuItem["Align at &25%", TextAlignment->-0.5, Scope->SelectionCell],
MenuItem["Align &Center", TextAlignment->Center, Scope->SelectionCell],
MenuItem["Align at &75%", TextAlignment->0.5, Scope->SelectionCell],
MenuItem["Align &Right", TextAlignment->Right, Scope->SelectionCell],
MenuItem["On &AlignmentMarker", TextAlignment->AlignmentMarker, Scope->SelectionCell]
}]
}],
Menu["Text &Justification",
{
LinkedItems[{
MenuItem["&None", TextJustification->0.0, Scope->SelectionCell],
MenuItem["&25%", TextJustification->0.25, Scope->SelectionCell],
MenuItem["&50%", TextJustification->0.5, Scope->SelectionCell],
MenuItem["&75%", TextJustification->0.75, Scope->SelectionCell],
MenuItem["&Full", TextJustification->1.0, Scope->SelectionCell]
}]
}],
Menu["&Word Wrapping",
{
LinkedItems[{
MenuItem["&Don't Word Wrap", PageWidth->Infinity, Scope->SelectionCell],
MenuItem["&Wrap at Paper Width", PageWidth->PaperWidth, Scope->SelectionCell],
MenuItem["W&rap at Window Width", PageWidth->WindowWidth, Scope->SelectionCell]
}]
}]
}],
Menu["&Cell",
{
Menu["&Convert To",
{
MenuItem["&InputForm", "SelectionConvert"->InputForm, MenuKey["I", Modifiers->{"Control", "Shift"}]],
(* I am removing this because it conflicts with my keybindings *)
(* MenuItem["&Raw InputForm", "SelectionConvert"->RawInputForm, MenuKey["R", Modifiers->{"Control", "Shift"}]], *)
MenuItem["&OutputForm", "SelectionConvert"->OutputForm],
MenuItem["First Convert to BoxForm", "MenuListConvertFormatTypes", MenuAnchor->True],
Delimiter,
MenuItem["&Bitmap", "SelectionConvert"->"Bitmap"],
Delimiter,
MenuItem["&Text Display", "SelectionDisplayAs"->TextForm],
MenuItem["I&nputForm Display", "SelectionDisplayAs"->InputForm],
MenuItem["First Display As BoxForm", "MenuListDisplayAsFormatTypes", MenuAnchor->True]
}],
Delimiter,
Menu["Cell &Properties",
{
MenuItem["&Open", CellOpen->Toggle, Scope->SelectionCell],
MenuItem["&Editable", Editable->Toggle, Scope->SelectionCell],
MenuItem["E&valuatable", Evaluatable->Toggle, Scope->SelectionCell],
MenuItem["&Deployed", Deployed->Toggle, Scope->SelectionCell],
Delimiter,
MenuItem["&Initialization Cell", InitializationCell->Toggle, Scope->SelectionCell, MenuKey["8", Modifiers->{"Control"}]],
MenuItem["Initialization Group", FrontEnd`InitializationGroup->Toggle, Scope->SelectionCell]
}],
Menu["Cell &Tags",
{
MenuItem["&Add/Remove Cell Tags...", "CellTagsEditDialog", MenuKey["j", Modifiers->{"Control"}]],
Menu["&Find Cell Tag",
{
MenuItem["Start CellTags Listing", "MenuListCellTags", MenuAnchor->True]
}],
MenuItem["&Show Cell Tags", ShowCellTags->Toggle, Scope->NotebookDefault],
MenuItem["Cell Tags from &In/Out Names", "CellLabelsToTags"]
}],
Menu["&Grouping",
{
MenuItem["&Group Cells/Group Together\tCtrl+Shift+G", "CellGroup"],
MenuItem["&Ungroup Cells/Group Normally\tCtrl+Shift+U", "CellUngroup"],
Delimiter,
LinkedItems[{
MenuItem["&Manual Grouping", CellGrouping->Manual, Scope->NotebookDefault],
MenuItem["&Automatic Grouping", CellGrouping->Automatic, Scope->NotebookDefault]
}],
Delimiter,
(*I have commented these out so that they don't interfere with my custom key bindings*)
(*MenuItem["&Open All Subgroups", "SelectionOpenAllGroups", MenuKey["{", Modifiers->{"Control"}]],*)
(*MenuItem["&Close All Subgroups", "SelectionCloseAllGroups", MenuKey["}", Modifiers->{"Control"}]],*)
MenuItem["Close U&nselected Cells", "SelectionCloseUnselectedCells"],
MenuItem["O&pen/Close Group", "OpenCloseGroup", MenuKey["'", Modifiers->{"Control"}]]
}],
Delimiter,
MenuItem["Di&vide Cell", "CellSplit", MenuKey["D", Modifiers->{"Control", "Shift"}]],
MenuItem["&Merge Cells", "CellMerge", MenuKey["M", Modifiers->{"Control", "Shift"}]],
Delimiter,
MenuItem["&Notebook History...",
FrontEndExecute[{FrontEnd`NotebookOpen[
FrontEnd`FindFileOnPath["HistoryOverview.nb", "PrivatePathsSystemResources"]]}]],
Delimiter,
MenuItem["De&lete All Output", "DeleteGeneratedCells"],
Delimiter,
MenuItem["S&how Expression", "ToggleShowExpression", MenuKey["E", Modifiers->{"Control", "Shift"}]]
}],
Menu["&Graphics",
{
MenuItem["&New Graphic", "InsertNewGraphic", MenuKey["1", Modifiers->{"Control"}]],
MenuItem["&Drawing Tools",
FrontEndExecute[{FrontEnd`NotebookOpen[
FrontEnd`FindFileOnPath["DrawingTools.nb", "PrivatePathsSystemResources"]]}],
MenuKey["d", Modifiers->{"Control"}]],
Delimiter,
MenuItem["Alignment &Guides Enabled", AlignmentGuidesEnabled->Toggle, Scope->GlobalPreferences],
Delimiter,
MenuItem["Group", "Group"],
MenuItem["Ungroup", "Ungroup"],
Delimiter,
MenuItem["Move to Front", "MoveToFront"],
MenuItem["Move to Back", "MoveToBack"],
MenuItem["Move Forward", "MoveForward"],
MenuItem["Move Backward", "MoveBackward"],
Delimiter,
MenuItem["Align Left Sides", "AlignLeftSides"],
MenuItem["Align Centers Vertically", "AlignCentersVertically"],
MenuItem["Align Right Sides", "AlignRightSides"],
Delimiter,
MenuItem["Align Bottoms", "AlignBottoms"],
MenuItem["Align Centers Horizontally", "AlignCentersHorizontally"],
MenuItem["Align Tops", "AlignTops"],
Delimiter,
MenuItem["Distribute Left Sides", "DistributeLeftSides"],
MenuItem["Distribute Centers Horizontally", "DistributeCentersHorizontally"],
MenuItem["Distribute Right Sides", "DistributeRightSides"],
MenuItem["Distribute Space Horizontally", "DistributeSpaceHorizontally"],
Delimiter,
MenuItem["Distribute Tops", "DistributeTops"],
MenuItem["Distribute Centers Vertically", "DistributeCentersVertically"],
MenuItem["Distribute Bottoms", "DistributeBottoms"],
MenuItem["Distribute Space Vertically", "DistributeSpaceVertically"]
}],
Menu["E&valuation",
{
MenuItem["&Evaluate Cells\tShift+Enter", "EvaluateCells"(* key in KeyEventTranslations.tr *)],
MenuItem["Evaluate in &Place", FrontEnd`Evaluate[All], MenuKey["Return", Modifiers->{"Control", "Shift"}]],
MenuItem["E&valuate in Subsession", "SubsessionEvaluateCells", MenuKey["F7", Modifiers->{}]],
Delimiter,
MenuItem["Evaluate N&otebook", "EvaluateNotebook"],
MenuItem["Evaluate Initiali&zation Cells", "EvaluateInitialization"],
Delimiter,
MenuItem["Dynamic &Updating Enabled", "ToggleDynamicUpdating"],
MenuItem["Convert Dynamic to &Literal",
FrontEndExecute[{FrontEnd`NotebookDynamicToLiteral[
FrontEnd`NotebookSelection[FrontEnd`InputNotebook[]]]}]],
Delimiter,
MenuItem["&Debugger", FrontEnd`DebuggerSettingsDebuggerEnabled->Toggle, Scope->GlobalPreferences],
Menu["De&bugger Controls",
{
MenuItem["&Halt", "EvaluatorHalt", MenuKey["Break", Modifiers->{"Control"}]],
MenuItem["&Continue", "DebuggerContinue", MenuKey["F5", Modifiers->{}]],
MenuItem["&Step", "DebuggerStep", MenuKey["F10", Modifiers->{}]],
MenuItem["Step &In", "DebuggerStepIn", MenuKey["F11", Modifiers->{}]],
MenuItem["Step &Out", "DebuggerStepOut", MenuKey["F11", Modifiers->{"Shift"}]],
MenuItem["&Finish", "DebuggerFinish", MenuKey["F", Modifiers->{"Control", "Shift"}]],
Delimiter,
MenuItem["Toggle &Breakpoint", "DebuggerToggleBreakpoint", MenuKey["F9", Modifiers->{}]],
Delimiter,
MenuItem["Show &Debugger Tools Window", FrontEnd`DebuggerSettingsShowTools->Toggle, Scope->GlobalPreferences],
MenuItem["Show Stac&k Window", FrontEnd`DebuggerSettingsShowStack->Toggle, Scope->GlobalPreferences],
MenuItem["Show Breakpoi&nts Window", FrontEnd`DebuggerSettingsShowBreakpoints->Toggle, Scope->GlobalPreferences]
}],
Delimiter,
MenuItem["&Abort Evaluation", FrontEnd`EvaluatorAbort[Automatic], MenuKey[".", Modifiers->{"Command"}]],
MenuItem["&Remove from Evaluation Queue", "RemoveFromEvaluationQueue", MenuKey[".", Modifiers->{"Command", "Shift"}]],
MenuItem["Find Currentl&y Evaluating Cell", "FindEvaluatingCell"],
Delimiter,
MenuItem["Kernel Con&figuration Options...", "ModifyEvaluatorNames", RemoveMask->{"NoLocalFileAccess"}],
MenuItem["Parallel Kernel Confi&guration...", FrontEndExecute[{
FrontEnd`SetOptions[FrontEnd`$FrontEnd, FrontEnd`PreferencesSettings -> {"Page" -> "Parallel"}],
FrontEnd`FrontEndToken["PreferencesDialog"]}]],
MenuItem["Parallel &Kernel Status...", KernelExecute[Parallel`Palette`menuStatus[]], MenuEvaluator -> Automatic],
Delimiter,
Menu["Defaul&t Kernel",
{
MenuItem["First Default Kernel", "MenuListGlobalEvaluators", MenuAnchor->True]
}, RemoveMask->{"NoLocalFileAccess"}],
Menu["&Notebook's Kernel",
{
MenuItem["First Notebook's Kernel", "MenuListNotebookEvaluators", MenuAnchor->True]
}, RemoveMask->{"NoLocalFileAccess"}],
Menu["Notebook's Default &Context",
{
MenuItem["&Global`", CellContext->"Global`", Scope->NotebookDefault],
MenuItem["&Other...", "CellContextDialog"],
Delimiter,
MenuItem["Unique to This &Notebook", CellContext->Notebook, Scope->NotebookDefault],
MenuItem["Unique to Each &Cell Group", CellContext->CellGroup, Scope->NotebookDefault]
}],
Delimiter,
Menu["&Start Kernel",
{
MenuItem["First Start Kernel", "MenuListStartEvaluators", MenuAnchor->True]
}],
Menu["&Quit Kernel",
{
MenuItem["First Quit Kernel", "MenuListQuitEvaluators", MenuAnchor->True]
}]
}],
Menu["&Palettes",
{
MenuItem["First Favorite Palette", "MenuListPalettesMenu", MenuAnchor->True]
}],
Menu["&Window",
{
Menu["&Magnification",
{
MenuItem["&50%", Magnification->0.50, Scope->NotebookDefault],
MenuItem["&75%", Magnification->0.75, Scope->NotebookDefault],
MenuItem["&100%", Magnification->1.00, Scope->NotebookDefault],
MenuItem["1&25%", Magnification->1.25, Scope->NotebookDefault],
MenuItem["15&0%", Magnification->1.50, Scope->NotebookDefault],
MenuItem["200&%", Magnification->2.00, Scope->NotebookDefault],
MenuItem["&300%", Magnification->3.00, Scope->NotebookDefault]
}],
Menu["&Toolbar",
{
MenuItem["&Ruler", ToggleOptionListElement[{"WindowToolbars", "RulerBar"}], Scope->NotebookDefault],
MenuItem["F&ormatting", ToggleOptionListElement[{"WindowToolbars", "EditBar"}], Scope->NotebookDefault],
MenuItem["T&emplating", KernelExecute[NotebookTemplating`CreateTemplateNotebook[InputNotebook[]]], MenuEvaluator -> "System"],
MenuItem["Test&ing", KernelExecute[Block[{$ContextPath}, Needs["MUnit`"]; MUnit`addDockedCellConvertNotebook[]]], MenuEvaluator -> "System"]
}],
Delimiter,
MenuItem["Handwriting Input", "HandwritingInput"],
MenuItem["Wolfram Cloud Activity Monitor", "WolframCloudActivityMonitor"],
MenuItem["Chat Settings", "ChatServicesMonitor"],
Delimiter,
Menu["Arrange Windows",
{
MenuItem["&Stack", "StackWindows"],
MenuItem["Tile &Horizontally", "TileWindowsWide"],
MenuItem["Tile &Vertically", "TileWindowsTall"]
}],
MenuItem["&Bring All to Front", "AllWindowsFront", MenuKey["F11", Modifiers->{}]],
MenuItem["&Close Other Windows", "CloseOthers"],
MenuItem["&Full Screen", FrontEndExecute[FrontEnd`Value[FEPrivate`NotebookToggleFullScreen[]]], MenuKey["F12", Modifiers->{}]],
Delimiter,
MenuItem["Start Windows Listing", "MenuListWindows", MenuAnchor->True]
}],
HelpMenu["&Help",
{
MenuItem["Wolfram &Documentation", "OpenHelpLink"],
MenuItem["&Find Selected Function", FrontEnd`SelectionHelpDialog[True], MenuKey["F1", Modifiers->{}]],
Delimiter,
MenuItem["W&olfram Account Settings...", "WolframCloudAccountSettings"],
MenuItem["Wolfram Cloud Account &Management", "MenuListWolframCloudAccountMenu", MenuAnchor->True],
Delimiter,
MenuItem["&Wolfram Website...", KernelExecute[
FE`hyperlinkCoded["http://www.wolfram.com", "source=menubar"]], MenuEvaluator -> "System"],
MenuItem["Demons&trations...", FrontEndExecute[{
FrontEnd`NotebookLocate[{URL["http://demonstrations.wolfram.com"], None}]}]],
Delimiter,
MenuItem["&Internet && Mail Settings...", FrontEndExecute[{
FrontEnd`SetOptions[FrontEnd`$FrontEnd, FrontEnd`PreferencesSettings -> {"Page" -> "InternetConnectivity"}],
FrontEnd`FrontEndToken["PreferencesDialog"]}]],
MenuItem["S&ystem Information...", FrontEndExecute[FrontEnd`NotebookOpen[FrontEnd`FindFileOnPath["SystemInformation.nbp", "PrivatePathsTextResources"]]]],
MenuItem["&Give Feedback...", KernelExecute[
FE`hyperlinkCoded["http://www.wolfram.com/support/contact/email", "source=menubar", "topic=feedback"]], MenuEvaluator -> "System"],
MenuItem["&Register Software...", KernelExecute[
FE`hyperlinkCoded["https://user.wolfram.com/portal/ProductRegistration", "source=menubar", "topic=register"]], MenuEvaluator -> "System"],
MenuItem["&Enter Activation Key...", KernelExecute[SetOptions[
FrontEnd`DialogOpen["ActivationDialog.nb"], TaggingRules -> {
"ActivationState" -> "Online", "ErrorMessage" -> None, "Unsecured" -> False, "Reactivate" -> True}]], MenuEvaluator -> "System"],
Delimiter,
MenuItem["Why the &Beep?...", "ExplainBeepDialog"],
MenuItem["Why the &Coloring?...", FrontEndExecute[{FrontEnd`NotebookOpen[
FrontEnd`FindFileOnPath["WhyTheColoring.nb", "PrivatePathsSystemResources"]]}]],
Delimiter,
MenuItem["Welcome &Screen...", "WelcomeDialog"],
MenuItem["&About Mathematica...", "AboutBoxDialog"]
}],
Menu["&Macros",
{
MenuItem[
"Re&loadResources",
KernelExecute @ KeyBindings`ReloadResources[],
MenuEvaluator -> Automatic
],
MenuItem[
"&Reverse",
KernelExecute @ KeyBindings`Reverse[],
MenuEvaluator -> Automatic
],
Menu["&Column",
{
MenuItem[
"&Column",
KernelExecute @ KeyBindings`Column[],
MenuEvaluator -> Automatic
],
MenuItem[
"&Recursive",
KernelExecute @ KeyBindings`ColumnRecursive[],
MenuEvaluator -> Automatic
]
}],
MenuItem[
"Reset&Selection",
KernelExecute @ KeyBindings`ResetSelection[],
MenuEvaluator -> Automatic
],
MenuItem[
"&TraceView",
KernelExecute @ KeyBindings`TraceView[],
MenuEvaluator -> Automatic
],
MenuItem[
"&MaTeX",
KernelExecute @ KeyBindings`MaTeX[],
MenuEvaluator -> Automatic
],
MenuItem[
"&Docs Lookup",
KernelExecute @ KeyBindings`OpenCurrentTextInDocumentation[],
MenuKey["t", Modifiers -> {"Control"}],
MenuEvaluator -> Automatic
],
MenuItem[
"Toggle $S&hiftReturnMode",
KernelExecute @ KeyBindings`ToggleShiftReturnMode[],
MenuEvaluator -> Automatic
],
MenuItem[
"Open &File Embedder",
KernelExecute @ KeyBindings`OpenFileEmbedder[],
MenuEvaluator -> Automatic
]
}]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment