コード例 #1
0
ファイル: VimUtil.cs プロジェクト: zhutoulwz/VsVim
        internal static CommandBinding CreateComplexNormalBinding(
            string name,
            Func <KeyInput, bool> predicate,
            KeyRemapMode remapMode = null,
            CommandFlags flags     = CommandFlags.None)
        {
            var remapModeOption = FSharpOption.CreateForReference(remapMode);
            Func <KeyInput, BindResult <NormalCommand> > func = null;

            func = keyInput =>
            {
                if (predicate(keyInput))
                {
                    var data = new BindData <NormalCommand>(
                        remapModeOption,
                        func.ToFSharpFunc());
                    return(BindResult <NormalCommand> .NewNeedMoreInput(data));
                }

                return(BindResult <NormalCommand> .NewComplete(NormalCommand.NewPutAfterCaret(false)));
            };

            var bindData = new BindData <NormalCommand>(
                remapModeOption,
                func.ToFSharpFunc());
            var bindDataStorage = BindDataStorage <NormalCommand> .NewSimple(bindData);

            return(CommandBinding.NewComplexNormalBinding(
                       KeyNotationUtil.StringToKeyInputSet(name),
                       flags,
                       bindDataStorage));
        }
コード例 #2
0
ファイル: VimUtil.cs プロジェクト: zhutoulwz/VsVim
 internal static CommandBinding CreateNormalBinding(
     string name           = "default",
     CommandFlags flags    = CommandFlags.None,
     NormalCommand command = null)
 {
     command = command ?? NormalCommand.NewPutAfterCaret(false);
     return(CommandBinding.NewNormalBinding(KeyNotationUtil.StringToKeyInputSet(name), flags, command));
 }
コード例 #3
0
ファイル: VimUtil.cs プロジェクト: zhutoulwz/VsVim
 internal static Command CreateNormalCommand(
     NormalCommand command   = null,
     CommandData commandData = null)
 {
     command     = command ?? NormalCommand.NewPutAfterCaret(false);
     commandData = commandData ?? new CommandData(FSharpOption <int> .None, FSharpOption <RegisterName> .None);
     return(Command.NewNormalCommand(command, commandData));
 }
コード例 #4
0
ファイル: VimUtil.cs プロジェクト: zhutoulwz/VsVim
        internal static CommandBinding CreateComplexNormalBinding(
            string name,
            Action <KeyInput> action,
            CommandFlags flags = CommandFlags.None)
        {
            Func <KeyInput, BindResult <NormalCommand> > func = keyInput =>
            {
                action(keyInput);
                return(BindResult <NormalCommand> .NewComplete(NormalCommand.NewPutAfterCaret(false)));
            };

            var bindData = new BindData <NormalCommand>(
                FSharpOption <KeyRemapMode> .None,
                func.ToFSharpFunc());
            var bindDataStorage = BindDataStorage <NormalCommand> .NewSimple(bindData);

            return(CommandBinding.NewComplexNormalBinding(
                       KeyNotationUtil.StringToKeyInputSet(name),
                       flags,
                       bindDataStorage));
        }