protected boolean execute(
        @NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
      int raw = cmd.getRawCount();
      int cnt = cmd.getCount();
      if (raw == 0) {
        int lines = EditorHelper.getScreenHeight(editor);

        return CommandGroups.getInstance().getMotion().scrollLine(editor, lines);
      } else {
        return CommandGroups.getInstance()
            .getMotion()
            .scrollLineToFirstScreenLine(editor, raw, cnt, true);
      }
    }
Esempio n. 2
0
  @NotNull
  private String getRange(Editor editor, @NotNull Command cmd) {
    String initText = "";
    if (CommandState.getInstance(editor).getMode() == CommandState.Mode.VISUAL) {
      initText = "'<,'>";
    } else if (cmd.getRawCount() > 0) {
      if (cmd.getCount() == 1) {
        initText = ".";
      } else {
        initText = ".,.+" + (cmd.getCount() - 1);
      }
    }

    return initText;
  }
Esempio n. 3
0
 public boolean execute(
     @NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
   final Argument argument = cmd.getArgument();
   return argument != null
       && VimPlugin.getChange().insertRegister(editor, context, argument.getCharacter());
 }
Esempio n. 4
0
 protected boolean execute(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
   return CommandGroups.getInstance().getCopy().yankLine(editor, cmd.getCount());
 }
 protected boolean execute(Editor editor, DataContext context, Command cmd) {
   return CommandGroups.getInstance()
       .getMotion()
       .toggleVisual(
           editor, cmd.getCount(), cmd.getRawCount(), CommandState.SubMode.VISUAL_CHARACTER);
 }