public VisualMode(TextEditorData editor) : base(editor)
        {
            // visual mode keys
            CommandMap.Add("d", new CutSelectionCommand(editor));
            CommandMap.Add("x", new CutSelectionCommand(editor));
            CommandMap.Add("y", new YankSelectionCommand(editor));
            CommandMap.Add("Y", new YankSelectionCommand(editor));
            CommandMap.Add(">", new IndentSelectionCommand(editor));
            CommandMap.Add("<", new RemoveIndentSelectionCommand(editor));
            CommandMap.Add("c", new ChangeSelectionCommand(editor));
            CommandMap.Add("w", new WordCommand(editor));
            CommandMap.Add("e", new WordEndCommand(editor));
            CommandMap.Add("b", new WordBackCommand(editor));
            CommandMap.Add("gg", new GoToFirstLineCommand(editor));
            CommandMap.Add("G", new GoToLineCommand(editor));
            CommandMap.Add("f", new FindSelectionCommand(editor, 0));
            CommandMap.Add("t", new FindSelectionCommand(editor, -1));
            CommandMap.Add("p", new PasteSelectionCommand(editor));
            CommandMap.Add("F", new FindPreviousSelectionCommand(editor, 0));
            CommandMap.Add("T", new FindPreviousSelectionCommand(editor, 1));


            // function key remaps
            SpecialKeyCommandMap.Add(SpecialKey.Delete, new CutSelectionCommand(editor));
        }
示例#2
0
 /// <summary>
 ///     Заполняет карту комманд (для вызова пользователя)
 ///     Командный лист не содержит служебных комманд!
 /// </summary>
 private void FillCommandMap()
 {
     foreach (var command in Commands)
     {
         CommandMap.Add(command.Name, command);
     }
 }
示例#3
0
文件: Commands.cs 项目: fog-bank/mojp
        public Command(MainViewModel viewModel, string name)
        {
            ViewModel = viewModel;
            Name      = name;

            CommandMap.Add(name, this);
        }
示例#4
0
        public NormalMode(TextEditorData editor) : base(editor)
        {
            // normal mode commands
            CommandMap.Add("0", new FirstColumnCommand(editor));
            CommandMap.Add("a", new AppendCommand(editor));
            CommandMap.Add("A", new AppendEndCommand(editor));
            CommandMap.Add("b", new WordBackCommand(editor));
            CommandMap.Add("cc", new ChangeLineCommand(editor));
            CommandMap.Add("ci'", new ChangeInsideSingleQuotesCommand(editor));
            CommandMap.Add("ci\"", new ChangeInsideDoubleQuotesCommand(editor));
            CommandMap.Add("ci(", new ChangeInsideParenthesesCommand(editor));
            CommandMap.Add("ci{", new ChangeInsideBracesCommand(editor));
            CommandMap.Add("ci[", new ChangeInsideBracketsCommand(editor));
            CommandMap.Add("cw", new ChangeWordCommand(editor));
            CommandMap.Add("c$", new ChangeToEndCommand(editor));
            CommandMap.Add("C", new ChangeToEndCommand(editor));
            CommandMap.Add("dd", new DeleteLineCommand(editor));
            CommandMap.Add("dw", new DeleteWordCommand(editor));
            CommandMap.Add("d$", new DeleteLineEndCommand(editor));
            CommandMap.Add("D", new DeleteLineEndCommand(editor));
            CommandMap.Add("f", new FindCommand(editor));
            CommandMap.Add("F", new FindPreviousCommand(editor));
            CommandMap.Add("gg", new GoToLineCommand(editor));
            CommandMap.Add("gd", new GoToDeclarationCommand(editor));
            CommandMap.Add("gt", new GoToNextDocumentCommand(editor));
            CommandMap.Add("gT", new GoToPreviousDocumentCommand(editor));
            CommandMap.Add("G", new GoToLineCommand(editor));
            CommandMap.Add("i", new InsertCommand(editor));
            CommandMap.Add("I", new InsertLineStartCommand(editor));
            CommandMap.Add("J", new JoinCommand(editor));
            CommandMap.Add("n", new SearchNextCommand(editor));
            CommandMap.Add("N", new SearchPreviousCommand(editor));
            CommandMap.Add("o", new OpenBelowCommand(editor));
            CommandMap.Add("O", new OpenAboveCommand(editor));
            CommandMap.Add("p", new PasteAppendCommand(editor));
            CommandMap.Add("P", new PasteInsertCommand(editor));
            CommandMap.Add("r", new ReplaceCommand(editor));
            CommandMap.Add("u", new UndoCommand(editor));
            CommandMap.Add("v", new VisualCommand(editor));
            CommandMap.Add("V", new VisualLineCommand(editor));
            CommandMap.Add("w", new WordCommand(editor));
            CommandMap.Add("x", new DeleteCharacterCommand(editor));
            CommandMap.Add("yy", new YankLineCommand(editor));
            CommandMap.Add("Y", new YankLineCommand(editor));
            CommandMap.Add("zz", new RecenterCommand(editor));
            CommandMap.Add("/", new SearchCommand(editor));
            CommandMap.Add(">", new IndentCommand(editor));
            CommandMap.Add(">>", new IndentOnceCommand(editor));
            CommandMap.Add("<", new RemoveIndentCommand(editor));
            CommandMap.Add("<<", new RemoveIndentOnceCommand(editor));
            CommandMap.Add("%", new MatchingBraceCommand(editor));
            CommandMap.Add("e", new WordEndCommand(editor));
            CommandMap.Add("R", new ReplaceModeCommand(editor));

            // remaps
            //KeyMap.Add("Delete", DeleteCharacter);
        }
        public VisualMode(TextEditorData editor) : base(editor)
        {
            // visual mode keys
            CommandMap.Add("d", new CutSelectionCommand(editor));
            CommandMap.Add("x", new CutSelectionCommand(editor));
            CommandMap.Add("y", new YankSelectionCommand(editor));
            CommandMap.Add("Y", new YankSelectionCommand(editor));
            CommandMap.Add(">", new IndentSelectionCommand(editor));
            CommandMap.Add("<", new RemoveIndentSelectionCommand(editor));
            CommandMap.Add("c", new ChangeSelectionCommand(editor));
            CommandMap.Add("w", new WordCommand(editor));
            CommandMap.Add("e", new WordEndCommand(editor));
            CommandMap.Add("b", new WordBackCommand(editor));
            CommandMap.Add("G", new GoToLineCommand(editor));

            // function key remaps
            //KeyMap.Add("Delete", SelectionCut);
        }
示例#6
0
        /// <summary>
        /// Adds command to the controller command table
        /// </summary>
        /// <param name="command">Command object</param>
        public void AddCommand(ICommand command)
        {
            if (command != null)
            {
                foreach (CommandId commandId in command.CommandIds)
                {
                    Dictionary <int, ICommand> idToCommandMap = null;

                    if (!CommandMap.TryGetValue(commandId.Group, out idToCommandMap))
                    {
                        idToCommandMap = new Dictionary <int, ICommand>();
                        CommandMap.Add(commandId.Group, idToCommandMap);
                    }

                    if (!idToCommandMap.ContainsKey(commandId.Id))
                    {
                        idToCommandMap.Add(commandId.Id, command);
                    }
                }
            }
        }
示例#7
0
 public override void AddCommands(CommandMap map)
 {
     commandMap.Add(map);
 }
        public NormalMode(TextEditorData editor) : base(editor)
        {
            // normal mode commands
            CommandMap.Add("a", new AppendCommand(editor));
            CommandMap.Add("A", new AppendEndCommand(editor));
            CommandMap.Add("b", new WordBackCommand(editor));
            CommandMap.Add("cc", new ChangeLineCommand(editor));
            CommandMap.Add("ci'", new ChangeCommand(editor, TextObject.InnerQuotedString, '\''));
            CommandMap.Add("ci\"", new ChangeCommand(editor, TextObject.InnerQuotedString, '\"'));
            CommandMap.Add("ci(", new ChangeInnerBlock(editor, '(', ')'));
            CommandMap.Add("ci)", new ChangeInnerBlock(editor, '(', ')'));
            CommandMap.Add("ci{", new ChangeInnerBlock(editor, '{', '}'));
            CommandMap.Add("ci}", new ChangeInnerBlock(editor, '{', '}'));
            CommandMap.Add("ci[", new ChangeInnerBlock(editor, '[', ']'));
            CommandMap.Add("ci]", new ChangeInnerBlock(editor, '[', ']'));
            CommandMap.Add("ci<", new ChangeInnerBlock(editor, '<', '>'));
            CommandMap.Add("ci>", new ChangeInnerBlock(editor, '<', '>'));
            CommandMap.Add("ca(", new ChangeCommand(editor, TextObject.Block, '(', ')'));
            CommandMap.Add("ca)", new ChangeCommand(editor, TextObject.Block, '(', ')'));
            CommandMap.Add("cab", new ChangeCommand(editor, TextObject.Block, '(', ')'));
            CommandMap.Add("ca{", new ChangeCommand(editor, TextObject.Block, '{', '}'));
            CommandMap.Add("ca}", new ChangeCommand(editor, TextObject.Block, '{', '}'));
            CommandMap.Add("caB", new ChangeCommand(editor, TextObject.Block, '{', '}'));
            CommandMap.Add("ca[", new ChangeCommand(editor, TextObject.Block, '[', ']'));
            CommandMap.Add("ca]", new ChangeCommand(editor, TextObject.Block, '[', ']'));
            CommandMap.Add("ca<", new ChangeCommand(editor, TextObject.Block, '<', '>'));
            CommandMap.Add("ca>", new ChangeCommand(editor, TextObject.Block, '<', '>'));
            CommandMap.Add("ca'", new ChangeCommand(editor, TextObject.QuotedString, '\''));
            CommandMap.Add("ca\"", new ChangeCommand(editor, TextObject.QuotedString, '\"'));
            CommandMap.Add("ca`", new ChangeCommand(editor, TextObject.QuotedString, '`'));
            CommandMap.Add("di[", new DeleteInnerBlock(editor, '[', ']'));
            CommandMap.Add("di]", new DeleteInnerBlock(editor, '[', ']'));
            CommandMap.Add("di'", new DeleteCommand(editor, TextObject.InnerQuotedString, '\''));
            CommandMap.Add("di\"", new DeleteCommand(editor, TextObject.InnerQuotedString, '"'));
            CommandMap.Add("di(", new DeleteInnerBlock(editor, '(', ')'));
            CommandMap.Add("di)", new DeleteInnerBlock(editor, '(', ')'));
            CommandMap.Add("di{", new DeleteInnerBlock(editor, '{', '}'));
            CommandMap.Add("di}", new DeleteInnerBlock(editor, '{', '}'));
            CommandMap.Add("di<", new DeleteInnerBlock(editor, '<', '>'));
            CommandMap.Add("di>", new DeleteInnerBlock(editor, '<', '>'));
            CommandMap.Add("cw", new ChangeWordCommand(editor));
            CommandMap.Add("ce", new ChangeWordEndCommand(editor));
            CommandMap.Add("dt", new DeleteToCharCommand(editor, 0));
            CommandMap.Add("df", new DeleteToCharCommand(editor, 1));
            CommandMap.Add("ct", new ChangeToCharCommand(editor, 0));
            CommandMap.Add("cf", new ChangeToCharCommand(editor, 1));
            CommandMap.Add("c$", new ChangeToEndCommand(editor));
            CommandMap.Add("C", new ChangeToEndCommand(editor));
            CommandMap.Add("dd", new DeleteLineCommand(editor));
            CommandMap.Add("dw", new DeleteWordCommand(editor));
            CommandMap.Add("de", new DeleteWordEndCommand(editor));
            CommandMap.Add("d$", new DeleteLineEndCommand(editor));
            CommandMap.Add("D", new DeleteLineEndCommand(editor));
            CommandMap.Add("f", new FindCommand(editor, 0));
            CommandMap.Add("F", new FindPreviousCommand(editor, 0));
            CommandMap.Add("t", new FindCommand(editor, -1));
            CommandMap.Add("T", new FindPreviousCommand(editor, 1));
            CommandMap.Add("gg", new GoToFirstLineCommand(editor));
            CommandMap.Add("gd", new GoToDeclarationCommand(editor));
            CommandMap.Add("gt", new GoToNextDocumentCommand(editor));
            CommandMap.Add("gT", new GoToPreviousDocumentCommand(editor));
            CommandMap.Add("G", new GoToLineCommand(editor));
            CommandMap.Add("i", new InsertCommand(editor));
            CommandMap.Add("I", new InsertLineStartCommand(editor));
            CommandMap.Add("J", new JoinCommand(editor));
            CommandMap.Add("n", new SearchNextCommand(editor));
            CommandMap.Add("N", new SearchPreviousCommand(editor));
            CommandMap.Add("o", new OpenBelowCommand(editor));
            CommandMap.Add("O", new OpenAboveCommand(editor));
            CommandMap.Add("p", new PasteAppendCommand(editor));
            CommandMap.Add("P", new PasteInsertCommand(editor));
            CommandMap.Add("r", new ReplaceCommand(editor));
            CommandMap.Add("s", new ChangeCharacterCommand(editor));
            CommandMap.Add("S", new ChangeLineCommand(editor));
            CommandMap.Add("u", new UndoCommand(editor));
            CommandMap.Add("v", new VisualCommand(editor));
            CommandMap.Add("V", new VisualLineCommand(editor));
            CommandMap.Add("w", new WordCommand(editor));
            CommandMap.Add("x", new DeleteCharacterCommand(editor));
            CommandMap.Add("X", new DeletePreviousCharacterCommand(editor));
            CommandMap.Add("yy", new YankLineCommand(editor));
            CommandMap.Add("Y", new YankLineCommand(editor));
            CommandMap.Add("zz", new RecenterCommand(editor));
            CommandMap.Add("/", new SearchCommand(editor));
            CommandMap.Add(">", new IndentCommand(editor));
            CommandMap.Add(">>", new IndentOnceCommand(editor));
            CommandMap.Add("<", new RemoveIndentCommand(editor));
            CommandMap.Add("<<", new RemoveIndentOnceCommand(editor));
            CommandMap.Add("%", new MatchingBraceCommand(editor));
            CommandMap.Add("e", new WordEndCommand(editor));
            CommandMap.Add("R", new ReplaceModeCommand(editor));
            CommandMap.Add("*", new SearchForwardCommand(editor));
            CommandMap.Add("~", new SwapCaseCommand(editor));


            // remaps
            SpecialKeyCommandMap.Add(SpecialKey.Delete, new DeleteCharacterCommand(editor));
        }