#if PLUGIN_TUTORIAL #define RegisterTutorialSection(NAME, DESC, STRING)\ String NAME##_string = STRING;\ void CMD_##NAME() {\ Buffer *buffer = CreateBuffer(SysAllocator, GetUniqueBufferName(ProjectFolder, #NAME), NAME##_string.len * 4 + 4096);\ buffer->temp = true;\ RawAppend(buffer, NAME##_string);\ buffer->dirty = false;\ Open(buffer->name);\ } RegisterCommand(CMD_##NAME, "", DESC); RegisterTutorialSection(EnterTheTutorial, "The guide to sailing the text", R"==( Hello sailor! -------------------------------- I see you have entered the unknown text waters of the internet. Before we set sail, right click: :CoolText ...and watch the waters stir. )=="); RegisterTutorialSection(CoolText, "Coolest text inside the coolest tutorial", R"==( The text can lead you into interesting places -------------------------------- Do not be afraid. Try these too: :MakeFontLarger :MakeFontSmaller Make the letters huge. Then make them tiny again. and then ... -------------------------------- :GoToNextSectionOfTheTutorial! )=="); RegisterTutorialSection(GoToNextSectionOfTheTutorial, "Yes!", R"==( Special words listen to keys too: Ctrl-+ Ctrl-- Even right click has a twin: Ctrl-Q F12 Put your caret here and try: :Prev :New (beware, you may never return! Hint: Take a look at the bar on the bottom) :HowToFindCommands )=="); RegisterTutorialSection(HowToFindCommands, "Tutorial on finding the commands", R"==( Open the map: :ShowCommands (Ctrl-Shift-P) Type a few letters. Press (Enter) to choose. These special words are not magical You can easily find them and use. ------------------------------- HowToBindCommandsToKeys ------------------------------- )=="); RegisterTutorialSection(HowToBindCommandsToKeys, "how to bind commands to keys", R"==( We will start easy. Try selecting and executing the lines below: :Set DrawLineNumbers 0 :Set TextColor ffaa0000 Make it normal again: :Set DrawLineNumbers 1 :Set TextColor ff21201d And of course this setup also works for keys: :Set MakeFontLarger 'ctrl-t' See the map for this: :OpenConfigOptions )=="); void InitTutorial() { CMD_EnterTheTutorial(); } #endif