Example #1
0
    public string GetHelpText()
    {
        StringBuilder builder = new StringBuilder();

        builder.AppendLine("# Settings properties");
        builder.AppendLine();
        builder.AppendLine("- First col legend: C - loads from config on start, T - from temp settings, [EMPTY] - only from config");
        builder.AppendLine("- Store here in config:           xml: <item name=\"name\" value=\"value\"/>");
        builder.AppendLine("- Make it store in temp settings: xml: <item name=\"name\"/>");
        builder.AppendLine("- [:<filter>] using example:      xml: <item name=\"name:*.cs;*.txt\" value=\"value for cs/txt file\"/>");
        builder.AppendLine("- Set property by command dialog: name value (autocomplete supported by `Tab` or `Ctrl+Space`)");
        builder.AppendLine("- Clear if several nodes allowed: xml: <item name=\"name\" value=\"\"/>");
        builder.AppendLine();
        TextTable table = new TextTable().SetMaxColWidth(33);

        Properties.AddHeadTo(table);
        table.AddLine();
        bool first = true;

        Properties.Property prev = null;
        foreach (Properties.Property property in properties)
        {
            if (!first)
            {
                table.NewRow();
            }
            first = false;
            if (prev != null && prev.Type != property.Type)
            {
                if (prev.GetHelpTypeText(table))
                {
                    table.NewRow();
                }
            }
            property.GetHelpText(this, table);
            prev = property;
        }
        builder.Append(table);
        builder.AppendLine();
        builder.Append(EncodingPair.GetEncodingsText());
        return(builder.ToString());
    }
Example #2
0
    public static Buffer NewViHelpBuffer(Settings settings, Commander commander)
    {
        List <StyleRange> ranges  = new List <StyleRange>();
        StringBuilder     builder = new StringBuilder();

        AddHead(builder, "Vi-mode");
        builder.AppendLine("# Common");
        builder.AppendLine();
        AddViMode(builder, settings);
        builder.AppendLine("- Parameters \"" + settings.viMapSource.name + "\" and \"" + settings.viMapResult.name + "\"");
        builder.AppendLine("  uses for mapping another keyboard layout to vi commands");
        builder.AppendLine("  For expample see base config by `Shift+F12`");
        builder.AppendLine("- There are no vi macroses implemented,");
        builder.AppendLine("  use simple `Ctrl+q`(begin), `Ctrl+q`(end), `Ctrl+Q`(execute)");
        builder.AppendLine("- Usualy you can use `\\` instead leader `,` (both works at the same time)");
        builder.AppendLine();
        builder.AppendLine("# Vi modes");
        builder.AppendLine();
        builder.AppendLine("- Input (equals to default editor mode)");
        builder.AppendLine("  Enter from Normal: `i`, `a`, `c`, `s`, `A`, `C`");
        builder.AppendLine("- Normal");
        builder.AppendLine("  Enter from Input, Visual, Lines visual: `Ctrl+[`");
        builder.AppendLine("- Visual");
        builder.AppendLine("  Enter from Normal, Lines visual: `v`");
        builder.AppendLine("- Lines visual");
        builder.AppendLine("  Enter from Normal, Lines visual: `V`");
        builder.AppendLine();
        builder.AppendLine("# Normal mode");
        builder.AppendLine();
        {
            TextTable table = new TextTable().SetMaxColWidth(40);
            table.Add(" Leader actions").NewRow();
            table.AddLine();
            table.Add(" ,b").Add("Show tab list, inside:\n  `Enter` - Select tab\n  `dd`- Close tab\n  `Ctrl+[` - Exit tab list").NewRow();
            table.Add(" ,g").Add("Show text nodes list, inside:\n  `Enter` - Jump to node\n  `Ctrl+[` - Exit tab list").NewRow();
            table.Add(" ,n").Add("Open/close file tree, inside:\n  `o` - open\n  `O` - open without switch\n  `dd` - delete file").NewRow();
            table.Add(" ,N").Add("Open/close file tree with current file").NewRow();
            table.Add(" ,s").Add("Save file").NewRow();
            table.Add(" ,r").Add("Reload file").NewRow();
            table.Add(" ,c").Add("Open/close shell command results").NewRow();
            table.Add(" ,f").Add("Open/close find results").NewRow();
            table.AddLine();
            table.Add(" Commands").NewRow();
            table.AddLine();
            table.Add(" :").Add("Open command dialog, inside:\n  `Ctrl+f` - normal mode inside dialog\n  `Ctrl+[` - close dialog\n  Full command list can be found in\n  input mode help - `F1` or `:help`").NewRow();
            table.AddLine();
            table.Add(" Moves").NewRow();
            table.AddLine();
            table.Add(" h").Add("Move left").NewRow();
            table.Add(" j").Add("Move down").NewRow();
            table.Add(" k").Add("Move up").NewRow();
            table.Add(" l").Add("Move right").NewRow();
            table.Add(" Ctrl+h").Add("Scroll left").NewRow();
            table.Add(" Ctrl+j").Add("Scroll down").NewRow();
            table.Add(" Ctrl+k").Add("Scroll up").NewRow();
            table.Add(" Ctrl+l").Add("Scroll right").NewRow();
            table.Add(" Ctrl+Shift+j").Add("Add new cursor bottom").NewRow();
            table.Add(" Ctrl+Shift+k").Add("Add new cursor up").NewRow();
            table.Add(" Ctrl+f").Add("Page down").NewRow();
            table.Add(" Ctrl+b").Add("Page up").NewRow();
            table.Add(" w").Add("Move next word start").NewRow();
            table.Add(" W").Add("Move next word start, with punctuation").NewRow();
            table.Add(" e").Add("Move word end").NewRow();
            table.Add(" E").Add("Move word end, with punctuation").NewRow();
            table.Add(" b").Add("Move word left").NewRow();
            table.Add(" B").Add("Move word left, ignore punctuation").NewRow();
            table.Add(" ^").Add("Move to line start").NewRow();
            table.Add(" $").Add("Move to line end").NewRow();
            table.Add(" 0").Add("Move to line start without indentation").NewRow();
            table.Add(" gg").Add("Move to document start").NewRow();
            table.Add(" G").Add("Move to document end").NewRow();
            table.Add(" <number>G").Add("Move to line number").NewRow();
            table.Add(" %").Add("Move to bracket under cursor pair").NewRow();
            table.Add(" Ctrl+]").Add("f12Command (navigate to)").NewRow();
            table.Add(" Ctrl+o").Add("Go to previous place").NewRow();
            table.Add(" Ctrl+i").Add("Return back").NewRow();
            table.Add(" g]").Add("shiftF12Command (all usages/definitions)").NewRow();
            table.AddLine();
            table.Add(" Actions").NewRow();
            table.AddLine();
            table.Add(" i").Add("Switch to input at left").NewRow();
            table.Add(" a").Add("Switch to input at right").NewRow();
            table.Add(" I").Add("Switch to input at line start").NewRow();
            table.Add(" A").Add("Switch to input at line end").NewRow();
            table.Add(" c<move>").Add("Remove and switch to input").NewRow();
            table.Add(" d<move>").Add("Remove").NewRow();
            table.Add(" x").Add("Remove char").NewRow();
            table.Add(" s").Add("Remove char and switch to input").NewRow();
            table.Add(" ~").Add("Switch char upper/lowercase").NewRow();
            table.Add(" y<move>").Add("Copy").NewRow();
            table.Add(" yy").Add("Copy line").NewRow();
            table.Add(" p").Add("Past").NewRow();
            table.Add(" P").Add("Past before").NewRow();
            table.Add(" .").Add("Repeat last action").NewRow();
            table.Add(" u").Add("Undo").NewRow();
            table.Add(" Ctrl+r").Add("Redo").NewRow();
            table.Add(" dd").Add("Remove line").NewRow();
            table.Add(" cc").Add("Remove line and switch to input").NewRow();
            table.Add(" o").Add("New line and switch to input").NewRow();
            table.Add(" O").Add("New line before and switch to input").NewRow();
            table.Add(" C").Add("Remove to line end and switch to input").NewRow();
            table.Add(" D").Add("Remove to line end").NewRow();
            table.Add(" <<").Add("Indent left").NewRow();
            table.Add(" >>").Add("Indent right").NewRow();
            table.Add(" /").Add("Open find dialog, inside:\n  `Ctrl+f` - normal mode inside dialog\n  `Ctrl+[` - close dialog").NewRow();
            table.Add(" ?").Add("Open find backward dialog").NewRow();
            table.Add(" Ctrl+/").Add("Open find dialog\n  with resetted options").NewRow();
            table.Add(" Ctrl+?").Add("Open find backward dialog\n  with resetted options").NewRow();
            table.Add(" *").Add("Put word or selection into\n  find register and find next").NewRow();
            table.Add(" #").Add("Put word or selection into\n  find register and find prev").NewRow();
            table.Add(" n").Add("Find next").NewRow();
            table.Add(" N").Add("Find previous").NewRow();
            table.Add(" <space><symbol><showed_symbols>").Add("Jump where you look:\n  <symbol> - symbol, what you look,\n  <showed_symbols> - symbols,  \nshowed after <symbol> entered").NewRow();
            table.Add(" ,<space><symbol><showed_symbols>").Add("Jump with new cursor").NewRow();
            table.Add(" Gv").Add("Recover last selection").NewRow();
            table.AddLine();
            table.Add(" Text objects").NewRow();
            table.AddLine();
            table.Add(" <action>i<object>").Add("Apply action to text object").NewRow();
            table.Add(" w").Add("Word").NewRow();
            table.Add(" W").Add("Word with punctuation").NewRow();
            table.Add(" {, }, (, ), [, ]").Add("Text inside brackets").NewRow();
            table.Add(" \"").Add("Text inside quotes").NewRow();
            table.Add(" '").Add("Text inside single quotes").NewRow();
            table.AddLine();
            table.Add(" Regisers").NewRow();
            table.AddLine();
            table.Add(" \"<register><y|yy|p|P|<action>>").Add("Common form,\n  uses `\"0` if `\"<register>` unspecified").NewRow();
            table.Add(" \"0").Add("Default, don't need to be specified").NewRow();
            table.Add(" \"*, \"-").Add("System clipboard").NewRow();
            table.Add(" \"a - \"z").Add("Innder registers").NewRow();
            table.Add(" \"A - \"Z").Add("The same registers with accumulation").NewRow();
            table.Add(" \"/").Add("Find register (readonly)").NewRow();
            table.Add(" \":").Add("Last command (readonly)").NewRow();
            table.Add(" \".").Add("Last input text (readonly)").NewRow();
            table.Add(" \"%").Add("File path (readonly)").NewRow();
            table.AddLine();
            table.Add(" Bookmarks").NewRow();
            table.AddLine();
            table.Add(" m<a-z>").Add("Add bookmark inside current file").NewRow();
            table.Add(" m<A-Z>").Add("Add global bookmark").NewRow();
            table.Add(" `<a-zA-Z>").Add("Move to bookmark").NewRow();
            table.Add(" '<a-zA-Z>").Add("Move to bookmark line indented start").NewRow();
            builder.Append(table);
        }
        builder.AppendLine();
        builder.AppendLine("# Visual mode");
        builder.AppendLine();
        builder.AppendLine("(Only not equal to normal mode key sequences)");
        builder.AppendLine();
        {
            TextTable table = new TextTable().SetMaxColWidth(40);
            table.Add(" Actions").NewRow();
            table.AddLine();
            table.Add(" <").Add("Indent left").NewRow();
            table.Add(" >").Add("Indent right").NewRow();
            table.Add(" I").Add("Switch to input at selection start").NewRow();
            table.Add(" A").Add("Switch to input at selection end").NewRow();
            table.AddLine();
            table.Add(" Moves").NewRow();
            table.AddLine();
            table.Add(" o").Add("Switch anchor and caret of selection").NewRow();
            table.Add(" U").Add("Uppercase selection").NewRow();
            table.Add(" u").Add("Lowercase selection").NewRow();
            builder.Append(table);
        }
        builder.AppendLine();
        builder.AppendLine("Also don't foget for input mode shortcuts, that hasn't vi-mode analouges:");
        builder.AppendLine("  `Ctrl+E` - switch betwean frames");
        builder.AppendLine("  `Ctrl+D` - select next text");
        builder.AppendLine("  `Ctrl+Shift+O` - open previous files");
        builder.AppendLine("  `Ctrl+Shift+G` - open previous directoriesk");
        builder.AppendLine("  `Ctrl+P` - open file incremental search");
        builder.AppendLine("  e.t.c, use `Ctrl+Shift+P` or menu to learn more (context-depenent)");
        builder.AppendLine();
        builder.AppendLine("# Omnicomplition");
        builder.AppendLine();
        builder.AppendLine("  `Ctrl+n` - move selection down");
        builder.AppendLine("  `Ctrl+p` - move selection up");
        builder.AppendLine("  `Ctrl+j` - move selection down (works in incremental search dialogs)");
        builder.AppendLine("  `Ctrl+k` - move selection up (works in incremental search dialogs)");
        Buffer buffer = new Buffer(null, "Vi-help.twh", SettingsMode.Help);

        buffer.tags = BufferTag.Other;
        buffer.Controller.isReadonly = true;
        buffer.Controller.InitText(builder.ToString());
        buffer.Controller.Lines.ranges = ranges;
        return(buffer);
    }