mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-02-28 02:45:59 +01:00
Intergrate changes for MAIA branch
This commit is contained in:
parent
f203381737
commit
e44c36b992
src/com/maddyhome/idea/vim
KeyHandler.javaVimPlugin.javaVimTypedActionHandler.java
action
ExEntryAction.javaPassThruDelegateAction.javaPassThruDelegateEditorAction.java
change
RedoAction.javaRepeatChangeAction.javaRepeatExCommandAction.javaUndoAction.java
change
ChangeCaseLowerMotionAction.javaChangeCaseLowerVisualAction.javaChangeCaseToggleCharacterAction.javaChangeCaseToggleMotionAction.javaChangeCaseToggleVisualAction.javaChangeCaseUpperMotionAction.javaChangeCaseUpperVisualAction.javaChangeCharacterAction.javaChangeCharactersAction.javaChangeEndOfLineAction.javaChangeLastGlobalSearchReplaceAction.javaChangeLastSearchReplaceAction.javaChangeLineAction.javaChangeMotionAction.javaChangeNumberDecAction.javaChangeNumberIncAction.javaChangeReplaceAction.javaChangeVisualAction.javaChangeVisualCharacterAction.javaChangeVisualLinesAction.javaChangeVisualLinesEndAction.javaFilterCountLinesAction.javaFilterMotionAction.javaFilterVisualLinesAction.java
delete
DeleteCharacterAction.javaDeleteCharacterLeftAction.javaDeleteCharacterRightAction.javaDeleteEndOfLineAction.javaDeleteJoinLinesAction.javaDeleteJoinLinesSpacesAction.javaDeleteJoinVisualLinesAction.javaDeleteJoinVisualLinesSpacesAction.javaDeleteLineAction.javaDeleteMotionAction.javaDeleteVisualAction.javaDeleteVisualLinesAction.javaDeleteVisualLinesEndAction.java
insert
InsertAfterCursorAction.javaInsertAfterLineEndAction.javaInsertAtPreviousInsertAction.javaInsertBeforeCursorAction.javaInsertBeforeFirstNonBlankAction.javaInsertCharacterAboveCursorAction.javaInsertCharacterBelowCursorAction.javaInsertDeleteInsertedTextAction.javaInsertDeletePreviousWordAction.javaInsertEnterAction.javaInsertExitModeAction.javaInsertHelpAction.javaInsertInsertAction.javaInsertLineStartAction.javaInsertNewLineAboveAction.javaInsertNewLineBelowAction.javaInsertPreviousInsertAction.javaInsertPreviousInsertExitAction.javaInsertRegisterAction.javaInsertSingleCommandAction.javaVisualBlockAppendAction.javaVisualBlockInsertAction.java
shift
copy
PutTextAfterCursorAction.javaPutTextAfterCursorActionMoveCursor.javaPutTextAfterCursorNoIndentAction.javaPutTextBeforeCursorAction.javaPutTextBeforeCursorActionMoveCursor.javaPutTextBeforeCursorNoIndentAction.javaPutVisualTextAction.javaPutVisualTextMoveCursorAction.javaPutVisualTextNoIndentAction.javaSelectRegisterAction.javaYankLineAction.javaYankMotionAction.javaYankVisualAction.javaYankVisualLinesAction.java
ex
file
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2004 Rick Maddy
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -22,44 +22,43 @@ package com.maddyhome.idea.vim;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataConstants;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.group.RegisterGroup;
|
||||
import com.maddyhome.idea.vim.group.ChangeGroup;
|
||||
import com.maddyhome.idea.vim.helper.DelegateCommandListener;
|
||||
import com.maddyhome.idea.vim.helper.DigraphSequence;
|
||||
import com.maddyhome.idea.vim.helper.RunnableHelper;
|
||||
import com.maddyhome.idea.vim.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import com.maddyhome.idea.vim.helper.RunnableHelper;
|
||||
import com.maddyhome.idea.vim.key.ArgumentNode;
|
||||
import com.maddyhome.idea.vim.key.BranchNode;
|
||||
import com.maddyhome.idea.vim.key.CommandNode;
|
||||
import com.maddyhome.idea.vim.key.KeyParser;
|
||||
import com.maddyhome.idea.vim.key.Node;
|
||||
import com.maddyhome.idea.vim.key.ParentNode;
|
||||
import com.maddyhome.idea.vim.option.Options;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* This handlers every keystroke that the user can argType except those that are still valid hotkeys for various
|
||||
* Idea actions. This is a singleton.
|
||||
* This handlers every keystroke that the user can argType except those that are still valid hotkeys for various Idea
|
||||
* actions. This is a singleton.
|
||||
*/
|
||||
public class KeyHandler
|
||||
{
|
||||
/**
|
||||
* Returns a reference to the singleton instance of this class
|
||||
*
|
||||
* @return A reference to the singleton
|
||||
*/
|
||||
public static KeyHandler getInstance()
|
||||
@ -78,11 +77,12 @@ public class KeyHandler
|
||||
*/
|
||||
private KeyHandler()
|
||||
{
|
||||
reset();
|
||||
reset(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the original key handler
|
||||
*
|
||||
* @param origHandler The original key handler
|
||||
*/
|
||||
public void setOriginalHandler(TypedActionHandler origHandler)
|
||||
@ -92,6 +92,7 @@ public class KeyHandler
|
||||
|
||||
/**
|
||||
* Gets the original key handler
|
||||
*
|
||||
* @return The orginal key handler
|
||||
*/
|
||||
public TypedActionHandler getOriginalHandler()
|
||||
@ -100,299 +101,351 @@ public class KeyHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent
|
||||
* here for processing.
|
||||
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for
|
||||
* processing.
|
||||
*
|
||||
* @param editor The editor the key was typed into
|
||||
* @param key The keystroke typed by the user
|
||||
* @param context The data context
|
||||
*/
|
||||
public void handleKey(Editor editor, KeyStroke key, DataContext context)
|
||||
{
|
||||
boolean isRecording = CommandState.getInstance().isRecording();
|
||||
logger.debug("handleKey " + key);
|
||||
CommandState editorState = CommandState.getInstance(editor);
|
||||
boolean isRecording = editorState.isRecording();
|
||||
boolean shouldRecord = true;
|
||||
// If this is a "regular" character keystroke, get the character
|
||||
char chKey = key.getKeyChar() == KeyEvent.CHAR_UNDEFINED ? 0 : key.getKeyChar();
|
||||
|
||||
if ((CommandState.getInstance().getMode() == CommandState.MODE_COMMAND || mode == STATE_COMMAND) &&
|
||||
(key.getKeyCode() == KeyEvent.VK_ESCAPE ||
|
||||
(key.getKeyCode() == KeyEvent.VK_C && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0) ||
|
||||
(key.getKeyCode() == '[' && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0)))
|
||||
for (int loop = 0; loop < 2; loop++)
|
||||
{
|
||||
if (mode != STATE_COMMAND && count == 0 && currentArg == Argument.NONE && currentCmd.size() == 0 &&
|
||||
CommandGroups.getInstance().getRegister().getCurrentRegister() == RegisterGroup.REGISTER_DEFAULT)
|
||||
// If this is a "regular" character keystroke, get the character
|
||||
char chKey = key.getKeyChar() == KeyEvent.CHAR_UNDEFINED ? 0 : key.getKeyChar();
|
||||
|
||||
if ((editorState.getMode() == CommandState.MODE_COMMAND || mode == STATE_COMMAND) &&
|
||||
(key.getKeyCode() == KeyEvent.VK_ESCAPE ||
|
||||
(key.getKeyCode() == KeyEvent.VK_C && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0) ||
|
||||
(key.getKeyCode() == '[' && (key.getModifiers() & KeyEvent.CTRL_MASK) != 0)))
|
||||
{
|
||||
if (key.getKeyCode() == KeyEvent.VK_ESCAPE)
|
||||
if (mode != STATE_COMMAND && count == 0 && currentArg == Argument.NONE && currentCmd.size() == 0 &&
|
||||
CommandGroups.getInstance().getRegister().getCurrentRegister() == RegisterGroup.REGISTER_DEFAULT)
|
||||
{
|
||||
KeyHandler.executeAction("VimEditorEscape", context);
|
||||
//getOriginalHandler().execute(editor, key.getKeyChar(), context);
|
||||
if (key.getKeyCode() == KeyEvent.VK_ESCAPE)
|
||||
{
|
||||
KeyHandler.executeAction("VimEditorEscape", context);
|
||||
//getOriginalHandler().execute(editor, key.getKeyChar(), context);
|
||||
}
|
||||
VimPlugin.indicateError();
|
||||
}
|
||||
VimPlugin.indicateError();
|
||||
}
|
||||
|
||||
reset();
|
||||
}
|
||||
// At this point the user must be typing in a command. Most commands can be preceeded by a number. Let's
|
||||
// check if a number can be entered at this point, and if so, did the user send us a digit.
|
||||
else if ((CommandState.getInstance().getMode() == CommandState.MODE_COMMAND ||
|
||||
CommandState.getInstance().getMode() == CommandState.MODE_VISUAL) &&
|
||||
mode == STATE_NEW_COMMAND && currentArg != Argument.CHARACTER && currentArg != Argument.DIGRAPH && Character.isDigit(chKey) &&
|
||||
(count != 0 || chKey != '0'))
|
||||
{
|
||||
// Update the count
|
||||
count = count * 10 + (chKey - '0');
|
||||
}
|
||||
// Pressing delete while entering a count "removes" the last digit entered
|
||||
else if ((CommandState.getInstance().getMode() == CommandState.MODE_COMMAND ||
|
||||
CommandState.getInstance().getMode() == CommandState.MODE_VISUAL) &&
|
||||
mode == STATE_NEW_COMMAND && currentArg != Argument.CHARACTER && currentArg != Argument.DIGRAPH &&
|
||||
key.getKeyCode() == KeyEvent.VK_DELETE && count != 0)
|
||||
{
|
||||
// "Remove" the last digit sent to us
|
||||
count /= 10;
|
||||
}
|
||||
// If we got this far the user is entering a command or supplying an argument to an entered command.
|
||||
// First let's check to see if we are at the point of expecting a single character argument to a command.
|
||||
else if (currentArg == Argument.CHARACTER)
|
||||
{
|
||||
// We are expecting a character argument - is this a regular character the user typed?
|
||||
// Some special keys can be handled as character arguments - let's check for them here.
|
||||
if (chKey == 0)
|
||||
reset(editor);
|
||||
}
|
||||
// At this point the user must be typing in a command. Most commands can be preceeded by a number. Let's
|
||||
// check if a number can be entered at this point, and if so, did the user send us a digit.
|
||||
else if ((editorState.getMode() == CommandState.MODE_COMMAND ||
|
||||
editorState.getMode() == CommandState.MODE_VISUAL) &&
|
||||
mode == STATE_NEW_COMMAND && currentArg != Argument.CHARACTER && currentArg != Argument.DIGRAPH &&
|
||||
Character.isDigit(chKey) &&
|
||||
(count != 0 || chKey != '0'))
|
||||
{
|
||||
switch (key.getKeyCode())
|
||||
// Update the count
|
||||
count = count * 10 + (chKey - '0');
|
||||
logger.debug("count now " + count);
|
||||
}
|
||||
// Pressing delete while entering a count "removes" the last digit entered
|
||||
else if ((editorState.getMode() == CommandState.MODE_COMMAND ||
|
||||
editorState.getMode() == CommandState.MODE_VISUAL) &&
|
||||
mode == STATE_NEW_COMMAND && currentArg != Argument.CHARACTER && currentArg != Argument.DIGRAPH &&
|
||||
key.getKeyCode() == KeyEvent.VK_DELETE && count != 0)
|
||||
{
|
||||
// "Remove" the last digit sent to us
|
||||
count /= 10;
|
||||
logger.debug("count now " + count);
|
||||
}
|
||||
// If we got this far the user is entering a command or supplying an argument to an entered command.
|
||||
// First let's check to see if we are at the point of expecting a single character argument to a command.
|
||||
else if (currentArg == Argument.CHARACTER)
|
||||
{
|
||||
logger.debug("currentArg is Character");
|
||||
// We are expecting a character argument - is this a regular character the user typed?
|
||||
// Some special keys can be handled as character arguments - let's check for them here.
|
||||
if (chKey == 0)
|
||||
{
|
||||
case KeyEvent.VK_ENTER:
|
||||
chKey = '\n';
|
||||
break;
|
||||
switch (key.getKeyCode())
|
||||
{
|
||||
case KeyEvent.VK_TAB:
|
||||
chKey = '\t';
|
||||
break;
|
||||
case KeyEvent.VK_ENTER:
|
||||
chKey = '\n';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (chKey != 0)
|
||||
{
|
||||
// Create the character argument, add it to the current command, and signal we are ready to process
|
||||
// the command
|
||||
Argument arg = new Argument(chKey);
|
||||
Command cmd = currentCmd.peek();
|
||||
cmd.setArgument(arg);
|
||||
mode = STATE_READY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Oops - this isn't a valid character argument
|
||||
mode = STATE_BAD_COMMAND;
|
||||
}
|
||||
}
|
||||
|
||||
if (chKey != 0)
|
||||
{
|
||||
// Create the character argument, add it to the current command, and signal we are ready to process
|
||||
// the command
|
||||
Argument arg = new Argument(chKey);
|
||||
Command cmd = (Command)currentCmd.peek();
|
||||
cmd.setArgument(arg);
|
||||
mode = STATE_READY;
|
||||
}
|
||||
// If we are this far - sheesh, then the user must be entering a command or a non-single-character argument
|
||||
// to an entered command. Let's figure out which it is
|
||||
else
|
||||
{
|
||||
// Oops - this isn't a valid character argument
|
||||
mode = STATE_ERROR;
|
||||
}
|
||||
}
|
||||
// If we are this far - sheesh, then the user must be entering a command or a non-single-character argument
|
||||
// to an entered command. Let's figure out which it is
|
||||
else
|
||||
{
|
||||
// For debugging purposes we track the keys entered for this command
|
||||
keys.add(key);
|
||||
logger.debug("keys now " + keys);
|
||||
|
||||
// Ask the key/action tree if this is an appropriate key at this point in the command and if so,
|
||||
// return the node matching this keystroke
|
||||
Node node = currentNode.getChild(key);
|
||||
|
||||
if (digraph == null && !(node instanceof CommandNode) && DigraphSequence.isDigraphStart(key))
|
||||
{
|
||||
digraph = new DigraphSequence();
|
||||
}
|
||||
if (digraph != null)
|
||||
{
|
||||
int res = digraph.processKey(key, editor, context);
|
||||
switch (res)
|
||||
// For debugging purposes we track the keys entered for this command
|
||||
keys.add(key);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
case DigraphSequence.RES_OK:
|
||||
break;
|
||||
case DigraphSequence.RES_BAD:
|
||||
digraph = null;
|
||||
break;
|
||||
case DigraphSequence.RES_DONE:
|
||||
if (currentArg == Argument.DIGRAPH)
|
||||
logger.debug("keys now " + keys);
|
||||
}
|
||||
|
||||
// Ask the key/action tree if this is an appropriate key at this point in the command and if so,
|
||||
// return the node matching this keystroke
|
||||
Node node = editorState.getCurrentNode().getChild(key);
|
||||
|
||||
if (digraph == null && !(node instanceof CommandNode) && DigraphSequence.isDigraphStart(key))
|
||||
{
|
||||
digraph = new DigraphSequence();
|
||||
}
|
||||
if (digraph != null)
|
||||
{
|
||||
DigraphSequence.DigraphResult res = digraph.processKey(key, editor, context);
|
||||
switch (res.getResult())
|
||||
{
|
||||
case DigraphSequence.DigraphResult.RES_OK:
|
||||
return;
|
||||
case DigraphSequence.DigraphResult.RES_BAD:
|
||||
digraph = null;
|
||||
return;
|
||||
case DigraphSequence.DigraphResult.RES_DONE:
|
||||
if (currentArg == Argument.DIGRAPH)
|
||||
{
|
||||
currentArg = Argument.CHARACTER;
|
||||
}
|
||||
key = res.getStroke();
|
||||
digraph = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
logger.debug("digraph done");
|
||||
}
|
||||
|
||||
// If this is a branch node we have entered only part of a multikey command
|
||||
if (node instanceof BranchNode)
|
||||
{
|
||||
logger.debug("branch node");
|
||||
BranchNode bnode = (BranchNode)node;
|
||||
// Flag that we aren't allowing any more count digits (unless it's OK)
|
||||
if ((bnode.getFlags() & Command.FLAG_ALLOW_MID_COUNT) == 0)
|
||||
{
|
||||
mode = STATE_COMMAND;
|
||||
}
|
||||
editorState.setCurrentNode(bnode);
|
||||
|
||||
ArgumentNode arg = (ArgumentNode)((BranchNode)editorState.getCurrentNode()).getArgumentNode();
|
||||
if (arg != null)
|
||||
{
|
||||
if (editorState.isRecording() && (arg.getFlags() & Command.FLAG_NO_ARG_RECORDING) != 0)
|
||||
{
|
||||
currentArg = Argument.CHARACTER;
|
||||
handleKey(editor, KeyStroke.getKeyStroke(' '), context);
|
||||
}
|
||||
digraph = null;
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is a branch node we have entered only part of a multikey command
|
||||
if (node instanceof BranchNode)
|
||||
{
|
||||
// Flag that we aren't allowing any more count digits
|
||||
mode = STATE_COMMAND;
|
||||
currentNode = (BranchNode)node;
|
||||
if (CommandState.getInstance().isRecording())
|
||||
{
|
||||
ArgumentNode arg = (ArgumentNode)((BranchNode)currentNode).getArgumentNode();
|
||||
if (arg != null && (arg.getFlags() & Command.FLAG_NO_ARG_RECORDING) != 0)
|
||||
{
|
||||
handleKey(editor, KeyStroke.getKeyStroke(' '), context);
|
||||
if (arg.getArgType() == Argument.EX_STRING)
|
||||
{
|
||||
CommandGroups.getInstance().getProcess().startSearchCommand(editor, context, count, chKey);
|
||||
mode = STATE_NEW_COMMAND;
|
||||
currentArg = Argument.EX_STRING;
|
||||
editorState.pushState(CommandState.MODE_EX_ENTRY, 0, KeyParser.MAPPING_CMD_LINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If this is a command node the user has entered a valid key sequence of a know command
|
||||
else if (node instanceof CommandNode)
|
||||
{
|
||||
// If all does well we are ready to process this command
|
||||
mode = STATE_READY;
|
||||
CommandNode cmdNode = (CommandNode)node;
|
||||
// Did we just get the completed sequence for a motion command argument?
|
||||
if (currentArg == Argument.MOTION)
|
||||
// If this is a command node the user has entered a valid key sequence of a known command
|
||||
else if (node instanceof CommandNode)
|
||||
{
|
||||
// We have been expecting a motion argument - is this one?
|
||||
if (cmdNode.getCmdType() == Command.MOTION)
|
||||
logger.debug("command node");
|
||||
// If all does well we are ready to process this command
|
||||
mode = STATE_READY;
|
||||
CommandNode cmdNode = (CommandNode)node;
|
||||
// Did we just get the completed sequence for a motion command argument?
|
||||
if (currentArg == Argument.MOTION)
|
||||
{
|
||||
// Create the motion command and add it to the stack
|
||||
Command cmd = new Command(count, cmdNode.getAction(), cmdNode.getCmdType(), cmdNode.getFlags());
|
||||
cmd.setKeys(keys);
|
||||
currentCmd.push(cmd);
|
||||
// We have been expecting a motion argument - is this one?
|
||||
if (cmdNode.getCmdType() == Command.MOTION)
|
||||
{
|
||||
// Create the motion command and add it to the stack
|
||||
Command cmd = new Command(count, cmdNode.getActionId(), cmdNode.getAction(),
|
||||
cmdNode.getCmdType(), cmdNode.getFlags());
|
||||
cmd.setKeys(keys);
|
||||
currentCmd.push(cmd);
|
||||
}
|
||||
else if (cmdNode.getCmdType() == Command.RESET)
|
||||
{
|
||||
currentCmd.clear();
|
||||
Command cmd = new Command(1, cmdNode.getActionId(), cmdNode.getAction(),
|
||||
cmdNode.getCmdType(), cmdNode.getFlags());
|
||||
cmd.setKeys(keys);
|
||||
currentCmd.push(cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Oops - this wasn't a motion command. The user goofed and typed something else
|
||||
mode = STATE_BAD_COMMAND;
|
||||
}
|
||||
}
|
||||
else if (cmdNode.getCmdType() == Command.RESET)
|
||||
else if (currentArg == Argument.EX_STRING && (cmdNode.getFlags() & Command.FLAG_COMPLETE_EX) != 0)
|
||||
{
|
||||
currentCmd.clear();
|
||||
Command cmd = new Command(1, cmdNode.getAction(), cmdNode.getCmdType(), cmdNode.getFlags());
|
||||
cmd.setKeys(keys);
|
||||
currentCmd.push(cmd);
|
||||
String text = CommandGroups.getInstance().getProcess().endSearchCommand(editor, context);
|
||||
Argument arg = new Argument(text);
|
||||
Command cmd = currentCmd.peek();
|
||||
cmd.setArgument(arg);
|
||||
CommandState.getInstance(editor).popState();
|
||||
}
|
||||
// The user entered a valid command that doesn't take any arguments
|
||||
else
|
||||
{
|
||||
// Oops - this wasn't a motion command. The user goofed and typed something else
|
||||
mode = STATE_ERROR;
|
||||
// Create the command and add it to the stack
|
||||
Command cmd = new Command(count, cmdNode.getActionId(), cmdNode.getAction(),
|
||||
cmdNode.getCmdType(), cmdNode.getFlags());
|
||||
cmd.setKeys(keys);
|
||||
currentCmd.push(cmd);
|
||||
|
||||
// This is a sanity check that the command has a valid action. This should only fail if the
|
||||
// programmer made a typo or forgot to add the action to the plugin.xml file
|
||||
if (cmd.getAction() == null)
|
||||
{
|
||||
logger.error("NULL action for keys '" + keys + "'");
|
||||
mode = STATE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The user entered a valid command that doesn't take any arguments
|
||||
else
|
||||
// If this is an argument node then the last keystroke was not part of the current command but should
|
||||
// be the first keystroke of the current command's argument
|
||||
else if (node instanceof ArgumentNode)
|
||||
{
|
||||
// Create the command and add it to the stack
|
||||
Command cmd = new Command(count, cmdNode.getAction(), cmdNode.getCmdType(), cmdNode.getFlags());
|
||||
logger.debug("argument node");
|
||||
// Create a new command based on what the user has typed so far, excluding this keystroke.
|
||||
ArgumentNode arg = (ArgumentNode)node;
|
||||
Command cmd = new Command(count, arg.getActionId(), arg.getAction(), arg.getCmdType(), arg.getFlags());
|
||||
cmd.setKeys(keys);
|
||||
currentCmd.push(cmd);
|
||||
|
||||
// This is a sanity check that the command has a valid action. This should only fail if the
|
||||
// programmer made a typo or forgot to add the action to the plugin.xml file
|
||||
if (cmd.getAction() == null)
|
||||
// What type of argument does this command expect?
|
||||
switch (arg.getArgType())
|
||||
{
|
||||
logger.error("NULL action for keys '" + keys + "'");
|
||||
mode = STATE_ERROR;
|
||||
case Argument.DIGRAPH:
|
||||
//digraphState = 0;
|
||||
digraph = new DigraphSequence();
|
||||
// No break - fall through
|
||||
case Argument.CHARACTER:
|
||||
case Argument.MOTION:
|
||||
mode = STATE_NEW_COMMAND;
|
||||
currentArg = arg.getArgType();
|
||||
// Is the current command an operator? If so set the state to only accept "operator pending"
|
||||
// commands
|
||||
if ((arg.getFlags() & Command.FLAG_OP_PEND) != 0)
|
||||
{
|
||||
//CommandState.getInstance().setMappingMode(KeyParser.MAPPING_OP_PEND);
|
||||
editorState.pushState(editorState.getMode(), editorState.getSubMode(),
|
||||
KeyParser.MAPPING_OP_PEND);
|
||||
}
|
||||
break;
|
||||
case Argument.EX_STRING:
|
||||
/*
|
||||
mode = STATE_NEW_COMMAND;
|
||||
currentArg = arg.getArgType();
|
||||
editorState.pushState(CommandState.MODE_EX_ENTRY, 0, KeyParser.MAPPING_CMD_LINE);
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
// Oops - we aren't expecting any other type of argument
|
||||
mode = STATE_ERROR;
|
||||
}
|
||||
|
||||
// If the current keystroke is really the first character of an argument the user needs to enter,
|
||||
// recursively go back and handle this keystroke again with all the state properly updated to
|
||||
// handle the argument
|
||||
if (currentArg != Argument.NONE)
|
||||
{
|
||||
partialReset(editor);
|
||||
boolean saveRecording = isRecording;
|
||||
handleKey(editor, key, context);
|
||||
isRecording = saveRecording;
|
||||
shouldRecord = false; // Prevent this from getting recorded twice
|
||||
}
|
||||
}
|
||||
}
|
||||
// If this is an argument node then the last keystroke was not part of the current command but should
|
||||
// be the first keystroke of the current command's argument
|
||||
else if (node instanceof ArgumentNode)
|
||||
{
|
||||
// Create a new command based on what the user has typed so far, excluding this keystroke.
|
||||
ArgumentNode arg = (ArgumentNode)node;
|
||||
Command cmd = new Command(count, arg.getAction(), arg.getCmdType(), arg.getFlags());
|
||||
cmd.setKeys(keys);
|
||||
currentCmd.push(cmd);
|
||||
// What argType of argument does this command expect?
|
||||
switch (arg.getArgType())
|
||||
{
|
||||
case Argument.DIGRAPH:
|
||||
//digraphState = 0;
|
||||
digraph = new DigraphSequence();
|
||||
// No break - fall through
|
||||
case Argument.CHARACTER:
|
||||
case Argument.MOTION:
|
||||
mode = STATE_NEW_COMMAND;
|
||||
currentArg = arg.getArgType();
|
||||
// Is the current command an operator? If so set the state to only accept "operator pending"
|
||||
// commands
|
||||
if ((arg.getFlags() & Command.FLAG_OP_PEND) != 0)
|
||||
{
|
||||
//CommandState.getInstance().setMappingMode(KeyParser.MAPPING_OP_PEND);
|
||||
CommandState state = CommandState.getInstance();
|
||||
CommandState.getInstance().pushState(state.getMode(), state.getSubMode(),
|
||||
KeyParser.MAPPING_OP_PEND);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Oops - we aren't expecting any other argType of argument
|
||||
mode = STATE_ERROR;
|
||||
}
|
||||
|
||||
// If the current keystroke is really the first character of an argument the user needs to enter,
|
||||
// recursively go back and handle this keystroke again with all the state properly updated to
|
||||
// handle the argument
|
||||
if (currentArg != Argument.NONE)
|
||||
{
|
||||
partialReset();
|
||||
boolean saveRecording = isRecording;
|
||||
handleKey(editor, key, context);
|
||||
isRecording = saveRecording;
|
||||
shouldRecord = false; // Prevent this from getting recorded twice
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug("checking for digraph");
|
||||
logger.debug("lastWasBS=" + lastWasBS);
|
||||
logger.debug("lastChar=" + lastChar);
|
||||
if (lastWasBS && lastChar != 0 && Options.getInstance().isSet("digraph"))
|
||||
{
|
||||
char dig = CommandGroups.getInstance().getDigraph().getDigraph(lastChar, key.getKeyChar());
|
||||
logger.debug("dig=" + dig);
|
||||
key = KeyStroke.getKeyStroke(dig);
|
||||
}
|
||||
|
||||
/* TODO - text change
|
||||
if (textChangeListener != null)
|
||||
{
|
||||
textChangeListener.complete();
|
||||
textChangeListener = null;
|
||||
}
|
||||
*/
|
||||
|
||||
// If we are in insert/replace mode send this key in for processing
|
||||
if (CommandState.getInstance().getMode() == CommandState.MODE_INSERT ||
|
||||
CommandState.getInstance().getMode() == CommandState.MODE_REPLACE)
|
||||
{
|
||||
if (!CommandGroups.getInstance().getChange().processKey(editor, context, key))
|
||||
{
|
||||
shouldRecord = false;
|
||||
}
|
||||
}
|
||||
else if (CommandState.getInstance().getMappingMode() == KeyParser.MAPPING_CMD_LINE)
|
||||
{
|
||||
if (!CommandGroups.getInstance().getProcess().processExKey(editor, context, key, true))
|
||||
{
|
||||
shouldRecord = false;
|
||||
}
|
||||
}
|
||||
// If we get here then the user has entered an unrecognized series of keystrokes
|
||||
else
|
||||
{
|
||||
mode = STATE_ERROR;
|
||||
}
|
||||
logger.debug("checking for digraph");
|
||||
logger.debug("lastWasBS=" + lastWasBS);
|
||||
logger.debug("lastChar=" + lastChar);
|
||||
if (lastWasBS && lastChar != 0 && Options.getInstance().isSet("digraph"))
|
||||
{
|
||||
char dig = CommandGroups.getInstance().getDigraph().getDigraph(lastChar, key.getKeyChar());
|
||||
logger.debug("dig=" + dig);
|
||||
key = KeyStroke.getKeyStroke(dig);
|
||||
}
|
||||
|
||||
lastChar = key.getKeyChar();
|
||||
partialReset();
|
||||
// If we are in insert/replace mode send this key in for processing
|
||||
if (editorState.getMode() == CommandState.MODE_INSERT ||
|
||||
editorState.getMode() == CommandState.MODE_REPLACE)
|
||||
{
|
||||
if (!CommandGroups.getInstance().getChange().processKey(editor, context, key))
|
||||
{
|
||||
shouldRecord = false;
|
||||
}
|
||||
}
|
||||
else if (editorState.getMappingMode() == KeyParser.MAPPING_CMD_LINE)
|
||||
{
|
||||
if (!CommandGroups.getInstance().getProcess().processExKey(editor, context, key, true))
|
||||
{
|
||||
shouldRecord = false;
|
||||
}
|
||||
}
|
||||
// If we get here then the user has entered an unrecognized series of keystrokes
|
||||
else
|
||||
{
|
||||
mode = STATE_BAD_COMMAND;
|
||||
}
|
||||
|
||||
lastChar = key.getKeyChar();
|
||||
partialReset(editor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Do we have a fully entere command at this point? If so, lets execute it
|
||||
// Do we have a fully entered command at this point? If so, lets execute it
|
||||
if (mode == STATE_READY)
|
||||
{
|
||||
DelegateCommandListener.getInstance().setRunnable(null);
|
||||
// Let's go through the command stack and merge it all into one command. At this time there should never
|
||||
// be more than two commands on the stack - one is the actual command and the other would be a motion
|
||||
// command argument needed by the first command
|
||||
Command cmd = (Command)currentCmd.pop();
|
||||
Command cmd = currentCmd.pop();
|
||||
while (currentCmd.size() > 0)
|
||||
{
|
||||
Command top = (Command)currentCmd.pop();
|
||||
Command top = currentCmd.pop();
|
||||
top.setArgument(new Argument(cmd));
|
||||
cmd = top;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("cmd=" + cmd);
|
||||
}
|
||||
// If we have a command and a motion command argument, both could possibly have their own counts. We
|
||||
// need to adjust the counts so the motion gets the product of both counts and the command's count gets
|
||||
// reset. Example 3c2w (change 2 words, three times) becomes c6w (change 6 words)
|
||||
Argument arg = cmd.getArgument();
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("arg=" + arg);
|
||||
}
|
||||
if (arg != null && arg.getType() == Argument.MOTION)
|
||||
{
|
||||
Command mot = arg.getMotion();
|
||||
@ -404,42 +457,48 @@ public class KeyHandler
|
||||
}
|
||||
|
||||
// If we were in "operator pending" mode, reset back to normal mode.
|
||||
if (CommandState.getInstance().getMappingMode() == KeyParser.MAPPING_OP_PEND)
|
||||
if (editorState.getMappingMode() == KeyParser.MAPPING_OP_PEND)
|
||||
{
|
||||
//CommandState.getInstance().setMappingMode(KeyParser.MAPPING_NORMAL);
|
||||
CommandState.getInstance().popState();
|
||||
editorState.popState();
|
||||
}
|
||||
|
||||
// Save off the command we are about to execute
|
||||
CommandState.getInstance().setCommand(cmd);
|
||||
editorState.setCommand(cmd);
|
||||
|
||||
lastWasBS = ((cmd.getFlags() & Command.FLAG_IS_BACKSPACE) != 0);
|
||||
logger.debug("lastWasBS=" + lastWasBS);
|
||||
|
||||
if (!editor.getDocument().isWritable() && !cmd.isReadType())
|
||||
{
|
||||
editor.getDocument().fireReadOnlyModificationAttempt();
|
||||
VimPlugin.indicateError();
|
||||
reset();
|
||||
}
|
||||
else
|
||||
Project project = EditorData.getProject(editor);
|
||||
if (cmd.isReadType() || EditorHelper.canEdit(project, editor))
|
||||
{
|
||||
Runnable action = new ActionRunner(editor, context, cmd, key);
|
||||
if (cmd.isWriteType())
|
||||
{
|
||||
RunnableHelper.runWriteCommand((Project)context.getData(DataConstants.PROJECT), action);
|
||||
RunnableHelper.runWriteCommand(project, action, cmd.getActionId(), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
RunnableHelper.runReadCommand((Project)context.getData(DataConstants.PROJECT), action);
|
||||
RunnableHelper.runReadCommand(project, action, cmd.getActionId(), null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.info("write command on read-only file");
|
||||
VimPlugin.indicateError();
|
||||
reset(editor);
|
||||
}
|
||||
}
|
||||
else if (mode == STATE_BAD_COMMAND)
|
||||
{
|
||||
VimPlugin.indicateError();
|
||||
reset(editor);
|
||||
}
|
||||
// We had some sort of error so reset the handler and let the user know (beep)
|
||||
else if (mode == STATE_ERROR)
|
||||
{
|
||||
VimPlugin.indicateError();
|
||||
fullReset();
|
||||
fullReset(editor);
|
||||
}
|
||||
else if (isRecording && shouldRecord)
|
||||
{
|
||||
@ -449,6 +508,7 @@ public class KeyHandler
|
||||
|
||||
/**
|
||||
* Execute an action by name
|
||||
*
|
||||
* @param name The name of the action to execute
|
||||
* @param context The context to run it in
|
||||
*/
|
||||
@ -469,39 +529,52 @@ public class KeyHandler
|
||||
|
||||
/**
|
||||
* Execute an action
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @param context The context to run it in
|
||||
*/
|
||||
public static void executeAction(AnAction action, DataContext context)
|
||||
{
|
||||
logger.debug("executing action " + action);
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("executing action " + action);
|
||||
}
|
||||
|
||||
// Hopefully all the arguments are sufficient. So far they all seem to work OK.
|
||||
// We don't have a specific InputEvent so that is null
|
||||
// What is "place"? Leave it the empty string for now.
|
||||
// Is the template presentation sufficient?
|
||||
// What are the modifiers? Is zero OK?
|
||||
action.actionPerformed(new AnActionEvent(null, context, "", action.getTemplatePresentation(), 0));
|
||||
action.actionPerformed(new AnActionEvent(
|
||||
null,
|
||||
context,
|
||||
"",
|
||||
action.getTemplatePresentation(),
|
||||
ActionManager.getInstance(), // API change - don't merge
|
||||
0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Partially resets the state of this handler. Resets the command count, clears the key list, resets the
|
||||
* key tree node to the root for the current mode we are in.
|
||||
* Partially resets the state of this handler. Resets the command count, clears the key list, resets the key tree
|
||||
* node to the root for the current mode we are in.
|
||||
* @param editor The editor to reset.
|
||||
*/
|
||||
private void partialReset()
|
||||
private void partialReset(Editor editor)
|
||||
{
|
||||
count = 0;
|
||||
keys = new ArrayList();
|
||||
currentNode = KeyParser.getInstance().getKeyRoot(CommandState.getInstance().getMappingMode());
|
||||
keys = new ArrayList<KeyStroke>();
|
||||
CommandState editorState = CommandState.getInstance(editor);
|
||||
editorState.setCurrentNode(KeyParser.getInstance().getKeyRoot(editorState.getMappingMode()));
|
||||
logger.debug("partialReset");
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the state of this handler. Does a partial reset then resets the mode, the command, and the argument
|
||||
* @param editor The editor to reset.
|
||||
*/
|
||||
public void reset()
|
||||
public void reset(Editor editor)
|
||||
{
|
||||
partialReset();
|
||||
partialReset(editor);
|
||||
mode = STATE_NEW_COMMAND;
|
||||
currentCmd.clear();
|
||||
currentArg = Argument.NONE;
|
||||
@ -512,18 +585,20 @@ public class KeyHandler
|
||||
/**
|
||||
* Completely resets the state of this handler. Resets the command mode to normal, resets, and clears the selected
|
||||
* register.
|
||||
* @param editor The editor to reset.
|
||||
*/
|
||||
public void fullReset()
|
||||
public void fullReset(Editor editor)
|
||||
{
|
||||
CommandState.getInstance().reset();
|
||||
reset();
|
||||
CommandState.getInstance(editor).reset();
|
||||
reset(editor);
|
||||
lastChar = 0;
|
||||
lastWasBS = false;
|
||||
CommandGroups.getInstance().getRegister().resetRegister();
|
||||
DelegateCommandListener.getInstance().setRunnable(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to run commands
|
||||
* This was used as an experiment to execute actions as a runnable.
|
||||
*/
|
||||
static class ActionRunner implements Runnable
|
||||
{
|
||||
@ -537,53 +612,16 @@ public class KeyHandler
|
||||
|
||||
public void run()
|
||||
{
|
||||
boolean wasRecording = CommandState.getInstance().isRecording();
|
||||
|
||||
/* TODO - text change
|
||||
if (textChangeListener != null)
|
||||
{
|
||||
textChangeListener.complete();
|
||||
}
|
||||
|
||||
textChangeListener = ((cmd.getFlags() & Command.FLAG_SAVE_CHANGES) != 0) ?
|
||||
new ChangeGroup.TextChangeListener(editor, context) : null;
|
||||
if (textChangeListener != null)
|
||||
{
|
||||
logger.debug("save changes");
|
||||
editor.getDocument().addDocumentListener(textChangeListener);
|
||||
}
|
||||
*/
|
||||
CommandState editorState = CommandState.getInstance(editor);
|
||||
boolean wasRecording = editorState.isRecording();
|
||||
|
||||
executeAction(cmd.getAction(), context);
|
||||
if (CommandState.getInstance().getMode() == CommandState.MODE_INSERT ||
|
||||
CommandState.getInstance().getMode() == CommandState.MODE_REPLACE)
|
||||
if (editorState.getMode() == CommandState.MODE_INSERT ||
|
||||
editorState.getMode() == CommandState.MODE_REPLACE)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().processCommand(editor, context, cmd);
|
||||
}
|
||||
|
||||
/*
|
||||
if (listener != null)
|
||||
{
|
||||
logger.debug("complete");
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
ApplicationManager.getApplication().invokeLater(
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
// TODO - I can't get this to run late enough - it's getting removed before any
|
||||
// change events.
|
||||
editor.getDocument().removeDocumentListener(listener);
|
||||
listener.complete();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
// Now that the command has been executed let's clean up a few things.
|
||||
|
||||
// By default the "empty" register is used by all commands so we want to reset whatever the last register
|
||||
@ -597,15 +635,15 @@ public class KeyHandler
|
||||
// mode we were in. This handles commands in those modes that temporarily allow us to execute normal
|
||||
// mode commands. An exception is if this command should leave us in the temporary mode such as
|
||||
// "select register"
|
||||
if (CommandState.getInstance().getSubMode() == CommandState.SUBMODE_SINGLE_COMMAND &&
|
||||
if (editorState.getSubMode() == CommandState.SUBMODE_SINGLE_COMMAND &&
|
||||
(cmd.getFlags() & Command.FLAG_EXPECT_MORE) == 0)
|
||||
{
|
||||
CommandState.getInstance().popState();
|
||||
editorState.popState();
|
||||
}
|
||||
|
||||
KeyHandler.getInstance().reset();
|
||||
KeyHandler.getInstance().reset(editor);
|
||||
|
||||
if (wasRecording && CommandState.getInstance().isRecording())
|
||||
if (wasRecording && editorState.isRecording())
|
||||
{
|
||||
CommandGroups.getInstance().getRegister().addKeyStroke(key);
|
||||
}
|
||||
@ -618,16 +656,14 @@ public class KeyHandler
|
||||
}
|
||||
|
||||
private int count;
|
||||
private ArrayList keys;
|
||||
private List<KeyStroke> keys;
|
||||
private int mode;
|
||||
private ParentNode currentNode;
|
||||
private Stack currentCmd = new Stack();
|
||||
private Stack<Command> currentCmd = new Stack<Command>();
|
||||
private int currentArg;
|
||||
private TypedActionHandler origHandler;
|
||||
private DigraphSequence digraph = null;
|
||||
private char lastChar;
|
||||
private boolean lastWasBS;
|
||||
private static ChangeGroup.TextChangeListener textChangeListener = null;
|
||||
|
||||
private static KeyHandler instance;
|
||||
|
||||
@ -635,6 +671,7 @@ public class KeyHandler
|
||||
private static final int STATE_COMMAND = 2;
|
||||
private static final int STATE_READY = 3;
|
||||
private static final int STATE_ERROR = 4;
|
||||
private static final int STATE_BAD_COMMAND = 5;
|
||||
|
||||
private static Logger logger = Logger.getInstance(KeyHandler.class.getName());
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2004 Rick Maddy
|
||||
* Copyright (C) 2003-2008 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -16,10 +18,10 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@ -29,6 +31,10 @@ import com.intellij.openapi.editor.actionSystem.TypedAction;
|
||||
import com.intellij.openapi.editor.event.EditorFactoryAdapter;
|
||||
import com.intellij.openapi.editor.event.EditorFactoryEvent;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
|
||||
import com.intellij.openapi.keymap.impl.KeymapManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
@ -36,7 +42,6 @@ import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.ex.CommandParser;
|
||||
@ -47,55 +52,79 @@ import com.maddyhome.idea.vim.group.MarkGroup;
|
||||
import com.maddyhome.idea.vim.group.MotionGroup;
|
||||
import com.maddyhome.idea.vim.group.SearchGroup;
|
||||
import com.maddyhome.idea.vim.helper.ApiHelper;
|
||||
import com.maddyhome.idea.vim.helper.DelegateCommandListener;
|
||||
import com.maddyhome.idea.vim.helper.DocumentManager;
|
||||
import com.maddyhome.idea.vim.helper.EditorData;
|
||||
import com.maddyhome.idea.vim.key.RegisterActions;
|
||||
import com.maddyhome.idea.vim.option.Options;
|
||||
import com.maddyhome.idea.vim.ui.MorePanel;
|
||||
import com.maddyhome.idea.vim.undo.UndoManager;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.net.URL;
|
||||
import javax.swing.ImageIcon;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This plugin attempts to emulate the keybinding and general functionality of Vim and gVim. See the supplied
|
||||
* documentation for a complete list of supported and unsupported Vim emulation. The code base contains some
|
||||
* debugging output that can be enabled in necessary.
|
||||
*
|
||||
* documentation for a complete list of supported and unsupported Vim emulation. The code base contains some debugging
|
||||
* output that can be enabled in necessary.
|
||||
* <p/>
|
||||
* This is an application level plugin meaning that all open projects will share a common instance of the plugin.
|
||||
* Registers and marks are shared across open projects so you can copy and paste between files of different projects.
|
||||
*
|
||||
* @version 0.1
|
||||
*/
|
||||
public class VimPlugin implements ApplicationComponent, JDOMExternalizable
|
||||
public class VimPlugin implements ApplicationComponent, JDOMExternalizable//, Configurable
|
||||
{
|
||||
|
||||
private static VimPlugin instance;
|
||||
private VimTypedActionHandler vimHandler;
|
||||
private RegisterActions actions;
|
||||
private boolean isBlockCursor = false;
|
||||
private boolean isSmoothScrolling = false;
|
||||
//private ImageIcon icon;
|
||||
//private VimSettingsPanel settingsPanel;
|
||||
//private VimSettings settings;
|
||||
|
||||
private boolean enabled = true;
|
||||
private static Logger LOG = Logger.getInstance(VimPlugin.class.getName());
|
||||
|
||||
/**
|
||||
* Creates the Vim Plugin
|
||||
*/
|
||||
public VimPlugin()
|
||||
{
|
||||
logger.debug("VimPlugin ctr");
|
||||
public VimPlugin() {
|
||||
LOG.debug("VimPlugin ctr");
|
||||
|
||||
/*
|
||||
java.net.URL resource = getClass().getResource("/icons/vim32x32.png");
|
||||
if (resource != null)
|
||||
{
|
||||
icon = new ImageIcon(resource);
|
||||
}
|
||||
*/
|
||||
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static VimPlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplies the name of the plugin
|
||||
*
|
||||
* @return The plugin name
|
||||
*/
|
||||
public String getComponentName()
|
||||
{
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "VimPlugin";
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the Vim Plugin. This plugs the vim key handler into the editor action mananger.
|
||||
*/
|
||||
public void initComponent()
|
||||
{
|
||||
logger.debug("initComponent");
|
||||
// It appears that custom actions listed in plugin.xml are not registered with the ActionManager until
|
||||
// after this method returns :(
|
||||
public void initComponent() {
|
||||
LOG.debug("initComponent");
|
||||
|
||||
EditorActionManager manager = EditorActionManager.getInstance();
|
||||
TypedAction action = manager.getTypedAction();
|
||||
@ -107,61 +136,66 @@ public class VimPlugin implements ApplicationComponent, JDOMExternalizable
|
||||
// Add some listeners so we can handle special events
|
||||
setupListeners();
|
||||
|
||||
logger.debug("done");
|
||||
getActions();
|
||||
|
||||
LOG.debug("done");
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets up some listeners so we can handle various events that occur
|
||||
*/
|
||||
private void setupListeners()
|
||||
{
|
||||
private void setupListeners() {
|
||||
DocumentManager.getInstance().addDocumentListener(new MarkGroup.MarkUpdater());
|
||||
DocumentManager.getInstance().addDocumentListener(new UndoManager.DocumentChangeListener());
|
||||
if (ApiHelper.supportsColorSchemes()) {
|
||||
DocumentManager.getInstance().addDocumentListener(new SearchGroup.DocumentSearchListener());
|
||||
}
|
||||
DocumentManager.getInstance().init();
|
||||
|
||||
EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
|
||||
public void editorCreated(EditorFactoryEvent event)
|
||||
{
|
||||
public void editorCreated(EditorFactoryEvent event) {
|
||||
isBlockCursor = event.getEditor().getSettings().isBlockCursor();
|
||||
isSmoothScrolling = event.getEditor().getSettings().isAnimatedScrolling();
|
||||
|
||||
if (VimPlugin.isEnabled())
|
||||
{
|
||||
event.getEditor().getSettings().setBlockCursor(!CommandState.inInsertMode());
|
||||
if (VimPlugin.isEnabled()) {
|
||||
event.getEditor().getSettings().setBlockCursor(!CommandState.inInsertMode(event.getEditor()));
|
||||
event.getEditor().getSettings().setAnimatedScrolling(false);
|
||||
}
|
||||
|
||||
EditorData.initializeEditor(event.getEditor());
|
||||
//if (EditorData.getVirtualFile(event.getEditor()) == null)
|
||||
//{
|
||||
DocumentManager.getInstance().addListeners(event.getEditor().getDocument());
|
||||
//}
|
||||
}
|
||||
|
||||
public void editorReleased(EditorFactoryEvent event)
|
||||
{
|
||||
public void editorReleased(EditorFactoryEvent event) {
|
||||
EditorData.uninitializeEditor(event.getEditor());
|
||||
event.getEditor().getSettings().setAnimatedScrolling(isSmoothScrolling);
|
||||
DocumentManager.getInstance().removeListeners(event.getEditor().getDocument());
|
||||
}
|
||||
});
|
||||
|
||||
// Since the Vim plugin custom actions aren't available to the call to <code>initComponent()</code>
|
||||
// we need to force the generation of the key map when the first project is opened.
|
||||
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
|
||||
public void projectOpened(Project project)
|
||||
{
|
||||
if (actions == null)
|
||||
{
|
||||
actions = RegisterActions.getInstance();
|
||||
if (VimPlugin.isEnabled())
|
||||
{
|
||||
RegisterActions.getInstance().enable();
|
||||
}
|
||||
CommandParser.getInstance().registerHandlers();
|
||||
public void projectOpened(Project project) {
|
||||
FileEditorManagerListener l = new ChangeGroup.InsertCheck();
|
||||
listeners.add(l);
|
||||
l = new MotionGroup.MotionEditorChange();
|
||||
listeners.add(l);
|
||||
l = new FileGroup.SelectionCheck();
|
||||
listeners.add(l);
|
||||
if (ApiHelper.supportsColorSchemes()) {
|
||||
l = new SearchGroup.EditorSelectionCheck();
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
FileEditorManager.getInstance(project).addFileEditorManagerListener(new ChangeGroup.InsertCheck());
|
||||
FileEditorManager.getInstance(project).addFileEditorManagerListener(new MotionGroup.MotionEditorChange());
|
||||
FileEditorManager.getInstance(project).addFileEditorManagerListener(new MorePanel.MoreEditorChangeListener());
|
||||
FileEditorManager.getInstance(project).addFileEditorManagerListener(new FileGroup.SelectionCheck());
|
||||
if (ApiHelper.supportsColorSchemes())
|
||||
{
|
||||
FileEditorManager.getInstance(project).addFileEditorManagerListener(new SearchGroup.SelectionCheck());
|
||||
for (FileEditorManagerListener listener : listeners) {
|
||||
FileEditorManager.getInstance(project).addFileEditorManagerListener(listener);
|
||||
}
|
||||
|
||||
DocumentManager.getInstance().openProject(project);
|
||||
//DocumentManager.getInstance().openProject(project);
|
||||
|
||||
/*
|
||||
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
|
||||
@ -171,9 +205,14 @@ public class VimPlugin implements ApplicationComponent, JDOMExternalizable
|
||||
*/
|
||||
}
|
||||
|
||||
public void projectClosed(Project project)
|
||||
{
|
||||
DocumentManager.getInstance().closeProject(project);
|
||||
public void projectClosed(Project project) {
|
||||
for (FileEditorManagerListener listener : listeners) {
|
||||
FileEditorManager.getInstance(project).removeFileEditorManagerListener(listener);
|
||||
}
|
||||
|
||||
listeners.clear();
|
||||
|
||||
//DocumentManager.getInstance().closeProject(project);
|
||||
|
||||
/*
|
||||
toolWindows.remove(project);
|
||||
@ -181,108 +220,119 @@ public class VimPlugin implements ApplicationComponent, JDOMExternalizable
|
||||
mgr.unregisterToolWindow("VIM");
|
||||
*/
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupToolWindow(ToolWindow win)
|
||||
{
|
||||
win.setTitle("");
|
||||
URL url = getClass().getClassLoader().getResource("icons/logo.png");
|
||||
ImageIcon icon = new ImageIcon(url);
|
||||
win.setIcon(icon);
|
||||
ArrayList<FileEditorManagerListener> listeners = new ArrayList<FileEditorManagerListener>();
|
||||
});
|
||||
|
||||
CommandProcessor.getInstance().addCommandListener(DelegateCommandListener.getInstance());
|
||||
|
||||
/*
|
||||
win.setType(ToolWindowType.DOCKED, null);
|
||||
if (isEnabled())
|
||||
{
|
||||
win.setAutoHide(false);
|
||||
win.show(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
win.setAutoHide(true);
|
||||
win.hide(null);
|
||||
}
|
||||
ApplicationManager.getApplication().addApplicationListener(new ApplicationAdapter() {
|
||||
public void applicationExiting()
|
||||
{
|
||||
LOG.debug("application exiting");
|
||||
}
|
||||
|
||||
public void writeActionStarted(Object action)
|
||||
{
|
||||
LOG.debug("writeActionStarted=" + action);
|
||||
}
|
||||
|
||||
public void writeActionFinished(Object action)
|
||||
{
|
||||
LOG.debug("writeActionFinished=" + action);
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* This shuts down the Vim plugin. All we need to do is reinstall the original key handler
|
||||
*/
|
||||
public void disposeComponent()
|
||||
{
|
||||
logger.debug("disposeComponent");
|
||||
public void disposeComponent() {
|
||||
LOG.debug("disposeComponent");
|
||||
setEnabled(false);
|
||||
EditorActionManager manager = EditorActionManager.getInstance();
|
||||
TypedAction action = manager.getTypedAction();
|
||||
action.setupHandler(vimHandler.getOriginalTypedHandler());
|
||||
logger.debug("done");
|
||||
LOG.debug("done");
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called by the framework to load custom configuration data. The data is stored in
|
||||
* <code>$HOME/.IntelliJIdea/config/options/other.xml</code> though this is handled by the openAPI.
|
||||
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is
|
||||
* children of this element.
|
||||
*
|
||||
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is children of
|
||||
* this element.
|
||||
* @throws InvalidDataException if any of the configuration data is invalid
|
||||
*/
|
||||
public void readExternal(Element element) throws InvalidDataException
|
||||
{
|
||||
logger.debug("readExternal");
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
LOG.debug("readExternal");
|
||||
|
||||
// Restore whether the plugin is enabled or not
|
||||
Element state = element.getChild("state");
|
||||
if (state != null)
|
||||
{
|
||||
enabled = Boolean.valueOf(state.getAttributeValue("enabled")).booleanValue();
|
||||
if (state != null) {
|
||||
enabled = Boolean.valueOf(state.getAttributeValue("enabled"));
|
||||
}
|
||||
|
||||
CommandGroups.getInstance().readData(element);
|
||||
//KeyParser.getInstance().readData(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called by the framework to store custom configuration data. The data is stored in
|
||||
* <code>$HOME/.IntelliJIdea/config/options/other.xml</code> though this is handled by the openAPI.
|
||||
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is
|
||||
* children of this element.
|
||||
*
|
||||
* @param element The element specific to the Vim Plugin. All the plugin's custom state information is children of
|
||||
* this element.
|
||||
* @throws WriteExternalException if unable to save and of the configuration data
|
||||
*/
|
||||
public void writeExternal(Element element) throws WriteExternalException
|
||||
{
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
LOG.debug("writeExternal");
|
||||
// Save whether the plugin is enabled or not
|
||||
Element elem = new Element("state");
|
||||
elem.setAttribute("enabled", Boolean.toString(enabled));
|
||||
element.addContent(elem);
|
||||
|
||||
CommandGroups.getInstance().saveData(element);
|
||||
//KeyParser.getInstance().saveData(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the user has enabled or disabled the plugin
|
||||
*
|
||||
* @return true if the Vim plugin is enabled, false if not
|
||||
*/
|
||||
public static boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
public static boolean isEnabled() {
|
||||
return getInstance().enabled;
|
||||
}
|
||||
|
||||
public static void setEnabled(boolean set) {
|
||||
if (!set) {
|
||||
getInstance().turnOffPlugin();
|
||||
}
|
||||
|
||||
getInstance().enabled = set;
|
||||
|
||||
if (set) {
|
||||
getInstance().turnOnPlugin();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inidicate to the user that an error has occurred. Just beep.
|
||||
*/
|
||||
public static void indicateError()
|
||||
{
|
||||
if (!Options.getInstance().isSet("visualbell"))
|
||||
{
|
||||
public static void indicateError() {
|
||||
if (!Options.getInstance().isSet("visualbell")) {
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
}
|
||||
}
|
||||
|
||||
public static void showMode(String msg)
|
||||
{
|
||||
public static void showMode(String msg) {
|
||||
showMessage(msg);
|
||||
}
|
||||
|
||||
public static void showMessage(String msg)
|
||||
{
|
||||
public static void showMessage(String msg) {
|
||||
/*
|
||||
for (Iterator iterator = toolWindows.values().iterator(); iterator.hasNext();)
|
||||
{
|
||||
@ -292,86 +342,158 @@ public class VimPlugin implements ApplicationComponent, JDOMExternalizable
|
||||
*/
|
||||
ProjectManager pm = ProjectManager.getInstance();
|
||||
Project[] projs = pm.getOpenProjects();
|
||||
for (int i = 0; i < projs.length; i++)
|
||||
{
|
||||
StatusBar bar = WindowManager.getInstance().getStatusBar(projs[i]);
|
||||
if (msg == null || msg.length() == 0)
|
||||
{
|
||||
for (Project proj : projs) {
|
||||
StatusBar bar = WindowManager.getInstance().getStatusBar(proj);
|
||||
if (msg == null || msg.length() == 0) {
|
||||
bar.setInfo("");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bar.setInfo("VIM - " + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void turnOnPlugin()
|
||||
{
|
||||
KeyHandler.getInstance().fullReset();
|
||||
RegisterActions.getInstance().enable();
|
||||
public void turnOnPlugin() {
|
||||
KeyHandler.getInstance().fullReset(null);
|
||||
//RegisterActions.getInstance().enable();
|
||||
setCursors(true);
|
||||
setSmoothScrolling(false);
|
||||
}
|
||||
|
||||
public static void turnOffPlugin()
|
||||
{
|
||||
KeyHandler.getInstance().fullReset();
|
||||
RegisterActions.getInstance().disable();
|
||||
public void turnOffPlugin() {
|
||||
KeyHandler.getInstance().fullReset(null);
|
||||
//RegisterActions.getInstance().disable();
|
||||
setCursors(isBlockCursor);
|
||||
setSmoothScrolling(isSmoothScrolling);
|
||||
}
|
||||
|
||||
private static void setCursors(boolean isBlock)
|
||||
{
|
||||
private void setCursors(boolean isBlock) {
|
||||
Editor[] editors = EditorFactory.getInstance().getAllEditors();
|
||||
for (int j = 0; j < editors.length; j++)
|
||||
{
|
||||
editors[j].getSettings().setBlockCursor(isBlock);
|
||||
for (Editor editor : editors) {
|
||||
editor.getSettings().setBlockCursor(isBlock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu
|
||||
* option but could also be used as a toolbar item.
|
||||
*/
|
||||
public static class VimPluginToggleAction extends ToggleAction
|
||||
private void setSmoothScrolling(boolean isOn) {
|
||||
Editor[] editors = EditorFactory.getInstance().getAllEditors();
|
||||
for (Editor editor : editors) {
|
||||
editor.getSettings().setAnimatedScrolling(isOn);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public String getDisplayName()
|
||||
{
|
||||
return "Vim";
|
||||
}
|
||||
|
||||
public Icon getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public String getHelpTopic()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public JComponent createComponent()
|
||||
{
|
||||
if (settingsPanel == null)
|
||||
{
|
||||
settingsPanel = new VimSettingsPanel();
|
||||
}
|
||||
|
||||
return settingsPanel.getMainComponent();
|
||||
}
|
||||
|
||||
public boolean isModified()
|
||||
{
|
||||
if (settingsPanel != null)
|
||||
{
|
||||
return settingsPanel.isModified(getSettings());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void apply() throws ConfigurationException
|
||||
{
|
||||
VimSettings set = settingsPanel.getOptions();
|
||||
if (set.isEnabled() != VimPlugin.isEnabled())
|
||||
{
|
||||
VimPlugin.setEnabled(set.isEnabled());
|
||||
}
|
||||
|
||||
KeyParser.getInstance().setChoices(set.getChoices());
|
||||
|
||||
settings = set;
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
if (settingsPanel != null)
|
||||
{
|
||||
settingsPanel.setOptions(getSettings(), KeyParser.getInstance().getConflicts());
|
||||
}
|
||||
}
|
||||
|
||||
public void disposeUIResources()
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public VimSettings getSettings()
|
||||
{
|
||||
if (settings == null)
|
||||
{
|
||||
settings = new VimSettings();
|
||||
settings.setChoices(KeyParser.getInstance().getChoices());
|
||||
}
|
||||
settings.setEnabled(isEnabled());
|
||||
|
||||
return settings;
|
||||
}
|
||||
*/
|
||||
|
||||
private RegisterActions getActions() {
|
||||
if (actions == null) {
|
||||
actions = RegisterActions.getInstance();
|
||||
/*
|
||||
if (VimPlugin.isEnabled())
|
||||
{
|
||||
actions.enable();
|
||||
}
|
||||
*/
|
||||
CommandParser.getInstance().registerHandlers();
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is used to handle the Vim Plugin enabled/disabled toggle. This is most likely used as a menu option
|
||||
* but could also be used as a toolbar item.
|
||||
*/
|
||||
public static class VimPluginToggleAction extends ToggleAction {
|
||||
/**
|
||||
* Indicates if the toggle is on or off
|
||||
*
|
||||
* @param event The event that triggered the action
|
||||
* @return true if the toggle is on, false if off
|
||||
*/
|
||||
public boolean isSelected(AnActionEvent event)
|
||||
{
|
||||
return enabled;
|
||||
public boolean isSelected(AnActionEvent event) {
|
||||
return VimPlugin.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether the toggle should be on or off
|
||||
*
|
||||
* @param event The event that triggered the action
|
||||
* @param b The new state - true is on, false is off
|
||||
* @param b The new state - true is on, false is off
|
||||
*/
|
||||
public void setSelected(AnActionEvent event, boolean b)
|
||||
{
|
||||
if (!b)
|
||||
{
|
||||
turnOffPlugin();
|
||||
}
|
||||
|
||||
enabled = b;
|
||||
|
||||
if (b)
|
||||
{
|
||||
turnOnPlugin();
|
||||
}
|
||||
public void setSelected(AnActionEvent event, boolean b) {
|
||||
VimPlugin.setEnabled(b);
|
||||
}
|
||||
}
|
||||
|
||||
private VimTypedActionHandler vimHandler;
|
||||
private RegisterActions actions;
|
||||
//private static HashMap toolWindows = new HashMap();
|
||||
private MarkGroup.MarkUpdater markUpdater = new MarkGroup.MarkUpdater();
|
||||
private static boolean isBlockCursor = false;
|
||||
|
||||
private static boolean enabled = true;
|
||||
private static Logger logger = Logger.getInstance(VimPlugin.class.getName());
|
||||
}
|
||||
|
@ -1,84 +1,86 @@
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
/**
|
||||
* This handler accepts all regular keystrokes and passes them on to the Vim Key handler
|
||||
*/
|
||||
public class VimTypedActionHandler implements TypedActionHandler
|
||||
{
|
||||
/**
|
||||
* Creates an instance of the key handler
|
||||
* @param origHandler The original key handler
|
||||
*/
|
||||
public VimTypedActionHandler(TypedActionHandler origHandler)
|
||||
{
|
||||
this.origHandler = origHandler;
|
||||
handler = KeyHandler.getInstance();
|
||||
handler.setOriginalHandler(origHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the original key handler
|
||||
* @return The original key handler
|
||||
*/
|
||||
public TypedActionHandler getOriginalTypedHandler()
|
||||
{
|
||||
return origHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* All characters typed into an editor will get sent to this handler. Only letters, numbers, and punctuation
|
||||
* are sent here. Keys like Tab, Enter, Home, Backspace, etc. and all Control-Letter etc. argType keys are not
|
||||
* sent by Idea to this handler.
|
||||
* @param editor The editor the character was typed into
|
||||
* @param charTyped The character that was typed
|
||||
* @param context The data context
|
||||
*/
|
||||
public void execute(Editor editor, char charTyped, DataContext context)
|
||||
{
|
||||
// If the plugin is disabled we simply resend the character to the original handler
|
||||
if (!VimPlugin.isEnabled())
|
||||
{
|
||||
origHandler.execute(editor, charTyped, context);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), context);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private TypedActionHandler origHandler;
|
||||
private KeyHandler handler;
|
||||
|
||||
private static Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
|
||||
}
|
||||
package com.maddyhome.idea.vim;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
/**
|
||||
* This handler accepts all regular keystrokes and passes them on to the Vim Key handler
|
||||
*/
|
||||
public class VimTypedActionHandler implements TypedActionHandler
|
||||
{
|
||||
/**
|
||||
* Creates an instance of the key handler
|
||||
* @param origHandler The original key handler
|
||||
*/
|
||||
public VimTypedActionHandler(TypedActionHandler origHandler)
|
||||
{
|
||||
this.origHandler = origHandler;
|
||||
handler = KeyHandler.getInstance();
|
||||
handler.setOriginalHandler(origHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the original key handler
|
||||
* @return The original key handler
|
||||
*/
|
||||
public TypedActionHandler getOriginalTypedHandler()
|
||||
{
|
||||
return origHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* All characters typed into an editor will get sent to this handler. Only letters, numbers, and punctuation
|
||||
* are sent here. Keys like Tab, Enter, Home, Backspace, etc. and all Control-Letter etc. argType keys are not
|
||||
* sent by Idea to this handler.
|
||||
* @param editor The editor the character was typed into
|
||||
* @param charTyped The character that was typed
|
||||
* @param context The data context
|
||||
*/
|
||||
public void execute(Editor editor, char charTyped, DataContext context)
|
||||
{
|
||||
// If the plugin is disabled we simply resend the character to the original handler
|
||||
if (!VimPlugin.isEnabled())
|
||||
{
|
||||
origHandler.execute(editor, charTyped, context);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), context);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private TypedActionHandler origHandler;
|
||||
private KeyHandler handler;
|
||||
|
||||
private static Logger logger = Logger.getInstance(VimTypedActionHandler.class.getName());
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,13 @@ package com.maddyhome.idea.vim.action;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.ExEntryHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -29,6 +34,16 @@ public class ExEntryAction extends EditorAction
|
||||
{
|
||||
public ExEntryAction()
|
||||
{
|
||||
super(new ExEntryHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getProcess().startExCommand(editor, context, cmd);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
package com.maddyhome.idea.vim.action;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.KeyHandler;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
public class PassThruDelegateAction extends AbstractDelegateAction
|
||||
{
|
||||
public PassThruDelegateAction(KeyStroke stroke)
|
||||
{
|
||||
this.stroke = stroke;
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent event)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("actionPerformed key=" + stroke);
|
||||
}
|
||||
final Editor editor = event.getData(PlatformDataKeys.EDITOR); // API change - don't merge
|
||||
if (editor == null || !VimPlugin.isEnabled())
|
||||
{
|
||||
getOrigAction().actionPerformed(event);
|
||||
}
|
||||
else if (event.getInputEvent() instanceof KeyEvent)
|
||||
{
|
||||
KeyStroke key = KeyStroke.getKeyStrokeForEvent((KeyEvent)event.getInputEvent());
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("event = KeyEvent: " + key);
|
||||
}
|
||||
KeyHandler.getInstance().handleKey(editor, key, event.getDataContext());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("event is a " + event.getInputEvent().getClass().getName());
|
||||
}
|
||||
KeyHandler.getInstance().handleKey(editor, stroke, event.getDataContext());
|
||||
}
|
||||
}
|
||||
|
||||
private KeyStroke stroke;
|
||||
|
||||
private static Logger logger = Logger.getInstance(PassThruDelegateAction.class.getName());
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.maddyhome.idea.vim.action;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.KeyHandler;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
public class PassThruDelegateEditorAction extends AbstractDelegateEditorAction
|
||||
{
|
||||
public PassThruDelegateEditorAction(KeyStroke stroke, EditorActionHandler origHandler)
|
||||
{
|
||||
super(new MyHandler(stroke, origHandler));
|
||||
}
|
||||
|
||||
private static Logger logger = Logger.getInstance(PassThruDelegateEditorAction.class.getName());
|
||||
|
||||
private static class MyHandler extends EditorActionHandler
|
||||
{
|
||||
public MyHandler(KeyStroke stroke, EditorActionHandler handler)
|
||||
{
|
||||
this.stroke = stroke;
|
||||
this.origHandler = handler;
|
||||
}
|
||||
|
||||
public void execute(Editor editor, DataContext dataContext)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("actionPerformed key=" + stroke);
|
||||
}
|
||||
if (editor == null || !VimPlugin.isEnabled())
|
||||
{
|
||||
origHandler.execute(editor, dataContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("event = KeyEvent: " + stroke);
|
||||
}
|
||||
KeyHandler.getInstance().handleKey(editor, stroke, dataContext);
|
||||
}
|
||||
}
|
||||
|
||||
private KeyStroke stroke;
|
||||
private EditorActionHandler origHandler;
|
||||
}
|
||||
}
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.RedoHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.undo.UndoManager;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,18 @@ public class RedoAction extends EditorAction
|
||||
{
|
||||
public RedoAction()
|
||||
{
|
||||
super(new RedoHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
UndoManager.getInstance().endCommand(editor);
|
||||
boolean res = UndoManager.getInstance().redo(editor, context);
|
||||
UndoManager.getInstance().beginCommand(editor);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,35 @@
|
||||
package com.maddyhome.idea.vim.action.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.RepeatChangeHandler;
|
||||
import com.maddyhome.idea.vim.KeyHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.key.KeyParser;
|
||||
import com.maddyhome.idea.vim.undo.UndoManager;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +37,56 @@ public class RepeatChangeAction extends EditorAction
|
||||
{
|
||||
public RepeatChangeAction()
|
||||
{
|
||||
super(new RepeatChangeHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, Command command)
|
||||
{
|
||||
CommandState state = CommandState.getInstance(editor);
|
||||
Command cmd = state.getLastChangeCommand();
|
||||
if (cmd != null)
|
||||
{
|
||||
if (command.getRawCount() > 0)
|
||||
{
|
||||
cmd.setCount(command.getCount());
|
||||
Argument arg = cmd.getArgument();
|
||||
if (arg != null)
|
||||
{
|
||||
Command mot = arg.getMotion();
|
||||
if (mot != null)
|
||||
{
|
||||
mot.setCount(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Command save = state.getCommand();
|
||||
state.setCommand(cmd);
|
||||
state.pushState(CommandState.MODE_REPEAT, 0, KeyParser.MAPPING_NORMAL);
|
||||
char reg = CommandGroups.getInstance().getRegister().getCurrentRegister();
|
||||
CommandGroups.getInstance().getRegister().selectRegister(state.getLastChangeRegister());
|
||||
try
|
||||
{
|
||||
KeyHandler.executeAction(cmd.getAction(), context);
|
||||
UndoManager.getInstance().endCommand(editor);
|
||||
UndoManager.getInstance().beginCommand(editor);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// oops
|
||||
}
|
||||
state.popState();
|
||||
state.setCommand(save);
|
||||
state.saveLastChangeCommand(cmd);
|
||||
CommandGroups.getInstance().getRegister().selectRegister(reg);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.RepeatExCommandHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.ex.CommandParser;
|
||||
import com.maddyhome.idea.vim.ex.ExException;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,22 @@ public class RepeatExCommandAction extends EditorAction
|
||||
{
|
||||
public RepeatExCommandAction()
|
||||
{
|
||||
super(new RepeatExCommandHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, Command command)
|
||||
{
|
||||
int count = command.getCount();
|
||||
try
|
||||
{
|
||||
return CommandParser.getInstance().processLastCommand(editor, context, count);
|
||||
}
|
||||
catch (ExException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.UndoHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.undo.UndoManager;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,18 @@ public class UndoAction extends EditorAction
|
||||
{
|
||||
public UndoAction()
|
||||
{
|
||||
super(new UndoHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
UndoManager.getInstance().endCommand(editor);
|
||||
boolean res = UndoManager.getInstance().undo(editor, context);
|
||||
UndoManager.getInstance().beginCommand(editor);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCaseLowerMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,14 @@ public class ChangeCaseLowerMotionAction extends EditorAction
|
||||
{
|
||||
public ChangeCaseLowerMotionAction()
|
||||
{
|
||||
super(new ChangeCaseLowerMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_LOWER, argument);
|
||||
}
|
||||
}}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCaseLowerVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,15 @@ public class ChangeCaseLowerVisualAction extends EditorAction
|
||||
{
|
||||
public ChangeCaseLowerVisualAction()
|
||||
{
|
||||
super(new ChangeCaseLowerVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_LOWER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCaseToggleCharacterHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class ChangeCaseToggleCharacterAction extends EditorAction
|
||||
{
|
||||
public ChangeCaseToggleCharacterAction()
|
||||
{
|
||||
super(new ChangeCaseToggleCharacterHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCaseToggleCharacter(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCaseToggleMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,15 @@ public class ChangeCaseToggleMotionAction extends EditorAction
|
||||
{
|
||||
public ChangeCaseToggleMotionAction()
|
||||
{
|
||||
super(new ChangeCaseToggleMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_TOGGLE, argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCaseToggleVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,14 @@ public class ChangeCaseToggleVisualAction extends EditorAction
|
||||
{
|
||||
public ChangeCaseToggleVisualAction()
|
||||
{
|
||||
super(new ChangeCaseToggleVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_TOGGLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCaseUpperMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,15 @@ public class ChangeCaseUpperMotionAction extends EditorAction
|
||||
{
|
||||
public ChangeCaseUpperMotionAction()
|
||||
{
|
||||
super(new ChangeCaseUpperMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCaseMotion(editor, context, count, rawCount,
|
||||
CharacterHelper.CASE_UPPER, argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCaseUpperVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,14 @@ public class ChangeCaseUpperVisualAction extends EditorAction
|
||||
{
|
||||
public ChangeCaseUpperVisualAction()
|
||||
{
|
||||
super(new ChangeCaseUpperVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCaseRange(editor, context, range, CharacterHelper.CASE_UPPER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCharacterHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class ChangeCharacterAction extends EditorAction
|
||||
{
|
||||
public ChangeCharacterAction()
|
||||
{
|
||||
super(new ChangeCharacterHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCharacter(editor, context, count, argument.getCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,45 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeCharactersHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class
|
||||
|
||||
|
||||
ChangeCharactersAction extends EditorAction
|
||||
public class ChangeCharactersAction extends EditorAction
|
||||
{
|
||||
public ChangeCharactersAction()
|
||||
{
|
||||
super(new ChangeCharactersHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCharacters(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeEndOfLineHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class ChangeEndOfLineAction extends EditorAction
|
||||
{
|
||||
public ChangeEndOfLineAction()
|
||||
{
|
||||
super(new ChangeEndOfLineHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeEndOfLine(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeLastGlobalSearchReplaceHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.ex.LineRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,15 @@ public class ChangeLastGlobalSearchReplaceAction extends EditorAction
|
||||
{
|
||||
public ChangeLastGlobalSearchReplaceAction()
|
||||
{
|
||||
super(new ChangeLastGlobalSearchReplaceHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1);
|
||||
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/&");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeLastSearchReplaceHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.ex.LineRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,16 @@ public class ChangeLastSearchReplaceAction extends EditorAction
|
||||
{
|
||||
public ChangeLastSearchReplaceAction()
|
||||
{
|
||||
super(new ChangeLastSearchReplaceHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
int line = EditorHelper.getCurrentLogicalLine(editor);
|
||||
LineRange range = new LineRange(line, line);
|
||||
return CommandGroups.getInstance().getSearch().searchAndReplace(editor, context, range, "s", "//~/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeLineHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class ChangeLineAction extends EditorAction
|
||||
{
|
||||
public ChangeLineAction()
|
||||
{
|
||||
super(new ChangeLineHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeLine(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class ChangeMotionAction extends EditorAction
|
||||
{
|
||||
public ChangeMotionAction()
|
||||
{
|
||||
super(new ChangeMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeMotion(editor, context, count, rawCount, argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ChangeNumberDecAction extends EditorAction
|
||||
{
|
||||
public ChangeNumberDecAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeNumber(editor, context, -count);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ChangeNumberIncAction extends EditorAction
|
||||
{
|
||||
public ChangeNumberIncAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeNumber(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeReplaceHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class ChangeReplaceAction extends EditorAction
|
||||
{
|
||||
public ChangeReplaceAction()
|
||||
{
|
||||
super(new ChangeReplaceHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeReplace(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,15 @@ public class ChangeVisualAction extends EditorAction
|
||||
{
|
||||
public ChangeVisualAction()
|
||||
{
|
||||
super(new ChangeVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
int mode = range.isMultiple() ? Command.FLAG_MOT_BLOCKWISE : Command.FLAG_MOT_INCLUSIVE;
|
||||
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeVisualCharacterHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,15 @@ public class ChangeVisualCharacterAction extends EditorAction
|
||||
{
|
||||
public ChangeVisualCharacterAction()
|
||||
{
|
||||
super(new ChangeVisualCharacterHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().changeCharacterRange(editor, context, range,
|
||||
cmd.getArgument().getCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.ChangeVisualLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,17 @@ public class ChangeVisualLinesAction extends EditorAction
|
||||
{
|
||||
public ChangeVisualLinesAction()
|
||||
{
|
||||
super(new ChangeVisualLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, Command.FLAG_MOT_LINEWISE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ChangeVisualLinesEndAction extends EditorAction
|
||||
{
|
||||
public ChangeVisualLinesEndAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
if (range.isMultiple())
|
||||
{
|
||||
int[] starts = range.getStartOffsets();
|
||||
int[] ends = range.getEndOffsets();
|
||||
for (int i = 0; i < starts.length; i++)
|
||||
{
|
||||
if (ends[i] > starts[i])
|
||||
{
|
||||
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
range = new TextRange(starts, ends);
|
||||
return CommandGroups.getInstance().getChange().changeRange(editor, context, range,
|
||||
Command.FLAG_MOT_BLOCKWISE);
|
||||
}
|
||||
else
|
||||
{
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
return CommandGroups.getInstance().getChange().changeRange(editor, context, range, Command.FLAG_MOT_LINEWISE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.FilterCountLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class FilterCountLinesAction extends EditorAction
|
||||
{
|
||||
public FilterCountLinesAction()
|
||||
{
|
||||
super(new FilterCountLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,33 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.FilterMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.group.MotionGroup;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +35,42 @@ public class FilterMotionAction extends EditorAction
|
||||
{
|
||||
public FilterMotionAction()
|
||||
{
|
||||
super(new FilterMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
TextRange range = MotionGroup.getMotionRange(editor, context, cmd.getCount(), cmd.getRawCount(),
|
||||
cmd.getArgument(), false, false);
|
||||
if (range == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LogicalPosition current = editor.getCaretModel().getLogicalPosition();
|
||||
LogicalPosition start = editor.offsetToLogicalPosition(range.getStartOffset());
|
||||
LogicalPosition end = editor.offsetToLogicalPosition(range.getEndOffset());
|
||||
if (current.line != start.line)
|
||||
{
|
||||
MotionGroup.moveCaret(editor, context, range.getStartOffset());
|
||||
}
|
||||
|
||||
int count;
|
||||
if (start.line < end.line)
|
||||
{
|
||||
count = end.line - start.line + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
count = 1;
|
||||
}
|
||||
|
||||
Command command = new Command(count, null, null, 0, 0);
|
||||
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, command);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.change;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.change.FilterVisualLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,17 @@ public class FilterVisualLinesAction extends EditorAction
|
||||
{
|
||||
public FilterVisualLinesAction()
|
||||
{
|
||||
super(new FilterVisualLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getProcess().startFilterCommand(editor, context, cmd);
|
||||
CommandGroups.getInstance().getMotion().resetVisual(editor);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteCharacterHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class DeleteCharacterAction extends EditorAction
|
||||
{
|
||||
public DeleteCharacterAction()
|
||||
{
|
||||
super(new DeleteCharacterHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteCharacterLeftHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class DeleteCharacterLeftAction extends EditorAction
|
||||
{
|
||||
public DeleteCharacterLeftAction()
|
||||
{
|
||||
super(new DeleteCharacterLeftHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, -count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteCharacterRightHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class DeleteCharacterRightAction extends EditorAction
|
||||
{
|
||||
public DeleteCharacterRightAction()
|
||||
{
|
||||
super(new DeleteCharacterRightHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().deleteCharacter(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteEndOfLineHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class DeleteEndOfLineAction extends EditorAction
|
||||
{
|
||||
public DeleteEndOfLineAction()
|
||||
{
|
||||
super(new DeleteEndOfLineHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().deleteEndOfLine(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteJoinLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,19 @@ public class DeleteJoinLinesAction extends EditorAction
|
||||
{
|
||||
public DeleteJoinLinesAction()
|
||||
{
|
||||
super(new DeleteJoinLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteJoinLinesSpacesHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,19 @@ public class DeleteJoinLinesSpacesAction extends EditorAction
|
||||
{
|
||||
public DeleteJoinLinesSpacesAction()
|
||||
{
|
||||
super(new DeleteJoinLinesSpacesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinLines(editor, context, count, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteJoinVisualLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,19 @@ public class DeleteJoinVisualLinesAction extends EditorAction
|
||||
{
|
||||
public DeleteJoinVisualLinesAction()
|
||||
{
|
||||
super(new DeleteJoinVisualLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteJoinVisualLinesSpacesHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,19 @@ public class DeleteJoinVisualLinesSpacesAction extends EditorAction
|
||||
{
|
||||
public DeleteJoinVisualLinesSpacesAction()
|
||||
{
|
||||
super(new DeleteJoinVisualLinesSpacesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteJoinRange(editor, context, range, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteLineHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class DeleteLineAction extends EditorAction
|
||||
{
|
||||
public DeleteLineAction()
|
||||
{
|
||||
super(new DeleteLineHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().deleteLine(editor, context, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class DeleteMotionAction extends EditorAction
|
||||
{
|
||||
public DeleteMotionAction()
|
||||
{
|
||||
super(new DeleteMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().deleteMotion(editor, context, count, rawCount, argument, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,33 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +35,21 @@ public class DeleteVisualAction extends EditorAction
|
||||
{
|
||||
public DeleteVisualAction()
|
||||
{
|
||||
super(new DeleteVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
int mode = CommandState.getInstance(editor).getSubMode();
|
||||
if (mode == Command.FLAG_MOT_LINEWISE)
|
||||
{
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range, mode, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,33 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.delete.DeleteVisualLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +35,26 @@ public class DeleteVisualLinesAction extends EditorAction
|
||||
{
|
||||
public DeleteVisualLinesAction()
|
||||
{
|
||||
super(new DeleteVisualLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
int mode = CommandState.getInstance(editor).getSubMode();
|
||||
if (mode == Command.FLAG_MOT_BLOCKWISE)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range, mode, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
|
||||
Command.FLAG_MOT_LINEWISE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package com.maddyhome.idea.vim.action.change.delete;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class DeleteVisualLinesEndAction extends EditorAction
|
||||
{
|
||||
public DeleteVisualLinesEndAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
if (range.isMultiple())
|
||||
{
|
||||
int[] starts = range.getStartOffsets();
|
||||
int[] ends = range.getEndOffsets();
|
||||
for (int i = 0; i < starts.length; i++)
|
||||
{
|
||||
if (ends[i] > starts[i])
|
||||
{
|
||||
ends[i] = EditorHelper.getLineEndForOffset(editor, starts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
range = new TextRange(starts, ends);
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
|
||||
Command.FLAG_MOT_BLOCKWISE, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
return CommandGroups.getInstance().getChange().deleteRange(editor, context, range,
|
||||
Command.FLAG_MOT_LINEWISE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertAfterCursorHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class InsertAfterCursorAction extends EditorAction
|
||||
{
|
||||
public InsertAfterCursorAction()
|
||||
{
|
||||
super(new InsertAfterCursorHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertAfterCursor(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertAfterLineEndHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class InsertAfterLineEndAction extends EditorAction
|
||||
{
|
||||
public InsertAfterLineEndAction()
|
||||
{
|
||||
super(new InsertAfterLineEndHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertAfterLineEnd(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertAtPreviousInsertHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class InsertAtPreviousInsertAction extends EditorAction
|
||||
{
|
||||
public InsertAtPreviousInsertAction()
|
||||
{
|
||||
super(new InsertAtPreviousInsertHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertAtPreviousInsert(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertBeforeCursorHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class InsertBeforeCursorAction extends EditorAction
|
||||
{
|
||||
public InsertBeforeCursorAction()
|
||||
{
|
||||
super(new InsertBeforeCursorHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertBeforeCursor(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertBeforeFirstNonBlankHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class InsertBeforeFirstNonBlankAction extends EditorAction
|
||||
{
|
||||
public InsertBeforeFirstNonBlankAction()
|
||||
{
|
||||
super(new InsertBeforeFirstNonBlankHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertBeforeFirstNonBlank(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertCharacterAboveCursorHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,19 @@ public class InsertCharacterAboveCursorAction extends EditorAction
|
||||
{
|
||||
public InsertCharacterAboveCursorAction()
|
||||
{
|
||||
super(new InsertCharacterAboveCursorHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().insertCharacterAroundCursor(editor, context, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertCharacterBelowCursorHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,19 @@ public class InsertCharacterBelowCursorAction extends EditorAction
|
||||
{
|
||||
public InsertCharacterBelowCursorAction()
|
||||
{
|
||||
super(new InsertCharacterBelowCursorHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().insertCharacterAroundCursor(editor, context, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertDeleteInsertedTextHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertDeleteInsertedTextAction extends EditorAction
|
||||
{
|
||||
public InsertDeleteInsertedTextAction()
|
||||
{
|
||||
super(new InsertDeleteInsertedTextHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().insertDeleteInsertedText(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertDeletePreviousWordHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertDeletePreviousWordAction extends EditorAction
|
||||
{
|
||||
public InsertDeletePreviousWordAction()
|
||||
{
|
||||
super(new InsertDeletePreviousWordHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().insertDeletePreviousWord(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertEnterHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,19 @@ public class InsertEnterAction extends EditorAction
|
||||
{
|
||||
public InsertEnterAction()
|
||||
{
|
||||
super(new InsertEnterHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler
|
||||
{
|
||||
public void execute(Editor editor, DataContext context)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CommandGroups.getInstance().getChange().processEnter(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertExitModeHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertExitModeAction extends EditorAction
|
||||
{
|
||||
public InsertExitModeAction()
|
||||
{
|
||||
super(new InsertExitModeHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler
|
||||
{
|
||||
public void execute(Editor editor, DataContext context)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().processEscape(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertHelpHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertHelpAction extends EditorAction
|
||||
{
|
||||
public InsertHelpAction()
|
||||
{
|
||||
super(new InsertHelpHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler
|
||||
{
|
||||
public void execute(Editor editor, DataContext context)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertHelp(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertInsertHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertInsertAction extends EditorAction
|
||||
{
|
||||
public InsertInsertAction()
|
||||
{
|
||||
super(new InsertInsertHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler
|
||||
{
|
||||
public void execute(Editor editor, DataContext context)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().processInsert(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,16 +19,29 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertLineStartHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class
|
||||
InsertLineStartAction extends EditorAction
|
||||
public class InsertLineStartAction extends EditorAction
|
||||
{
|
||||
public InsertLineStartAction()
|
||||
{
|
||||
super(new InsertLineStartHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertLineStart(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,52 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertNewLineAboveHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class
|
||||
InsertNewLineAboveAction extends EditorAction
|
||||
public class InsertNewLineAboveAction extends EditorAction
|
||||
{
|
||||
public InsertNewLineAboveAction()
|
||||
{
|
||||
super(new InsertNewLineAboveHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CommandGroups.getInstance().getChange().insertNewLineAbove(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,52 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertNewLineBelowHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class
|
||||
InsertNewLineBelowAction extends EditorAction
|
||||
public class InsertNewLineBelowAction extends EditorAction
|
||||
{
|
||||
public InsertNewLineBelowAction()
|
||||
{
|
||||
super(new InsertNewLineBelowHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CommandGroups.getInstance().getChange().insertNewLineBelow(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertPreviousInsertHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertPreviousInsertAction extends EditorAction
|
||||
{
|
||||
public InsertPreviousInsertAction()
|
||||
{
|
||||
super(new InsertPreviousInsertHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler
|
||||
{
|
||||
public void execute(Editor editor, DataContext context)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertPreviousInsert(editor, context, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertPreviousInsertExitHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertPreviousInsertExitAction extends EditorAction
|
||||
{
|
||||
public InsertPreviousInsertExitAction()
|
||||
{
|
||||
super(new InsertPreviousInsertExitHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler
|
||||
{
|
||||
public void execute(Editor editor, DataContext context)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().insertPreviousInsert(editor, context, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertRegisterHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertRegisterAction extends EditorAction
|
||||
{
|
||||
public InsertRegisterAction()
|
||||
{
|
||||
super(new InsertRegisterHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getChange().insertRegister(editor, context, cmd.getArgument().getCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,8 +19,12 @@ package com.maddyhome.idea.vim.action.change.insert;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.insert.InsertSingleCommandHandler;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class InsertSingleCommandAction extends EditorAction
|
||||
{
|
||||
public InsertSingleCommandAction()
|
||||
{
|
||||
super(new InsertSingleCommandHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends EditorActionHandler
|
||||
{
|
||||
public void execute(Editor editor, DataContext context)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().processSingleCommand(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class VisualBlockAppendAction extends EditorAction
|
||||
{
|
||||
public VisualBlockAppendAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().blockInsert(editor, context, range, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.maddyhome.idea.vim.action.change.insert;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class VisualBlockInsertAction extends EditorAction
|
||||
{
|
||||
public VisualBlockInsertAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
if (editor.isOneLineMode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CommandGroups.getInstance().getChange().blockInsert(editor, context, range, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.shift.AutoIndentLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class AutoIndentLinesAction extends EditorAction
|
||||
{
|
||||
public AutoIndentLinesAction()
|
||||
{
|
||||
super(new AutoIndentLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().autoIndentLines(editor, context, count);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.shift.ShiftLeftLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class ShiftLeftLinesAction extends EditorAction
|
||||
{
|
||||
public ShiftLeftLinesAction()
|
||||
{
|
||||
super(new ShiftLeftLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().indentLines(editor, context, count, -1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.shift.ShiftLeftMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class ShiftLeftMotionAction extends EditorAction
|
||||
{
|
||||
public ShiftLeftMotionAction()
|
||||
{
|
||||
super(new ShiftLeftMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, -1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.shift.ShiftLeftVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,16 @@ public class ShiftLeftVisualAction extends EditorAction
|
||||
{
|
||||
public ShiftLeftVisualAction()
|
||||
{
|
||||
super(new ShiftLeftVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), -1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.shift.ShiftRightLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class ShiftRightLinesAction extends EditorAction
|
||||
{
|
||||
public ShiftRightLinesAction()
|
||||
{
|
||||
super(new ShiftRightLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().indentLines(editor, context, count, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.shift.ShiftRightMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class ShiftRightMotionAction extends EditorAction
|
||||
{
|
||||
public ShiftRightMotionAction()
|
||||
{
|
||||
super(new ShiftRightMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().indentMotion(editor, context, count, rawCount, argument, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.change.shift;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.change.shift.ShiftRightVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,16 @@ public class ShiftRightVisualAction extends EditorAction
|
||||
{
|
||||
public ShiftRightVisualAction()
|
||||
{
|
||||
super(new ShiftRightVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
CommandGroups.getInstance().getChange().indentRange(editor, context, range, cmd.getCount(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.PutTextAfterCursorHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class PutTextAfterCursorAction extends EditorAction
|
||||
{
|
||||
public PutTextAfterCursorAction()
|
||||
{
|
||||
super(new PutTextAfterCursorHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.PutTextAfterCursorHandlerMoveCursor;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class PutTextAfterCursorActionMoveCursor extends EditorAction
|
||||
{
|
||||
public PutTextAfterCursorActionMoveCursor()
|
||||
{
|
||||
super(new PutTextAfterCursorHandlerMoveCursor());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.PutTextAfterCursorNoIndentHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class PutTextAfterCursorNoIndentAction extends EditorAction
|
||||
{
|
||||
public PutTextAfterCursorNoIndentAction()
|
||||
{
|
||||
super(new PutTextAfterCursorNoIndentHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putTextAfterCursor(editor, context, count, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.PutTextBeforeCursorHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class PutTextBeforeCursorAction extends EditorAction
|
||||
{
|
||||
public PutTextBeforeCursorAction()
|
||||
{
|
||||
super(new PutTextBeforeCursorHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.PutTextBeforeCursorHandlerMoveCursor;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class PutTextBeforeCursorActionMoveCursor extends EditorAction
|
||||
{
|
||||
public PutTextBeforeCursorActionMoveCursor()
|
||||
{
|
||||
super(new PutTextBeforeCursorHandlerMoveCursor());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.PutTextBeforeCursorNoIndentHandler;
|
||||
import com.maddyhome.idea.vim.command.Argument;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class PutTextBeforeCursorNoIndentAction extends EditorAction
|
||||
{
|
||||
public PutTextBeforeCursorNoIndentAction()
|
||||
{
|
||||
super(new PutTextBeforeCursorNoIndentHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends ChangeEditorActionHandler
|
||||
{
|
||||
public boolean execute(Editor editor, DataContext context, int count, int rawCount, Argument argument)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putTextBeforeCursor(editor, context, count, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,31 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.PutVisualTextHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +33,14 @@ public class PutVisualTextAction extends EditorAction
|
||||
{
|
||||
public PutVisualTextAction()
|
||||
{
|
||||
super(new PutVisualTextHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PutVisualTextMoveCursorAction extends EditorAction
|
||||
{
|
||||
public PutVisualTextMoveCursorAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), true, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PutVisualTextNoIndentAction extends EditorAction
|
||||
{
|
||||
public PutVisualTextNoIndentAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().putVisualRange(editor, context, range, cmd.getCount(), false, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -19,18 +19,29 @@ package com.maddyhome.idea.vim.action.copy;
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.action.AbstractCommandAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SelectRegisterAction extends AbstractCommandAction
|
||||
public class SelectRegisterAction extends EditorAction
|
||||
{
|
||||
protected boolean execute(DataContext context, Command cmd)
|
||||
public SelectRegisterAction()
|
||||
{
|
||||
return CommandGroups.getInstance().getRegister().selectRegister(cmd.getArgument().getCharacter());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getRegister().selectRegister(cmd.getArgument().getCharacter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.YankLineHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class YankLineAction extends EditorAction
|
||||
{
|
||||
public YankLineAction()
|
||||
{
|
||||
super(new YankLineHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().yankLine(editor, context, cmd.getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.YankMotionHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class YankMotionAction extends EditorAction
|
||||
{
|
||||
public YankMotionAction()
|
||||
{
|
||||
super(new YankMotionHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().yankMotion(editor, context, cmd.getCount(), cmd.getRawCount(), cmd.getArgument());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.YankVisualHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,15 @@ public class YankVisualAction extends EditorAction
|
||||
{
|
||||
public YankVisualAction()
|
||||
{
|
||||
super(new YankVisualHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range,
|
||||
CommandState.getInstance(editor).getSubMode(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,33 @@
|
||||
package com.maddyhome.idea.vim.action.copy;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.copy.YankVisualLinesHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.CommandState;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +35,26 @@ public class YankVisualLinesAction extends EditorAction
|
||||
{
|
||||
public YankVisualLinesAction()
|
||||
{
|
||||
super(new YankVisualLinesHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends VisualOperatorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd, TextRange range)
|
||||
{
|
||||
int mode = CommandState.getInstance(editor).getSubMode();
|
||||
if (mode == Command.FLAG_MOT_BLOCKWISE)
|
||||
{
|
||||
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range, mode, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
range = new TextRange(EditorHelper.getLineStartForOffset(editor, range.getStartOffset()),
|
||||
EditorHelper.getLineEndForOffset(editor, range.getEndOffset()) + 1);
|
||||
|
||||
return CommandGroups.getInstance().getCopy().yankRange(editor, context, range, Command.FLAG_MOT_LINEWISE,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.ex;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.ex.BackspaceHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,15 @@ public class BackspaceAction extends EditorAction
|
||||
{
|
||||
public BackspaceAction()
|
||||
{
|
||||
super(new BackspaceHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getProcess().processExKey(editor, context,
|
||||
(KeyStroke)cmd.getKeys().get(0), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.ex;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.ex.CancelExEntryHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class CancelExEntryAction extends EditorAction
|
||||
{
|
||||
public CancelExEntryAction()
|
||||
{
|
||||
super(new CancelExEntryHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getProcess().cancelExEntry(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.ex;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.ex.ProcessExEntryHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,14 @@ public class ProcessExEntryAction extends EditorAction
|
||||
{
|
||||
public ProcessExEntryAction()
|
||||
{
|
||||
super(new ProcessExEntryHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getProcess().processExEntry(editor, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,32 @@
|
||||
package com.maddyhome.idea.vim.action.ex;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.ex.ProcessExKeyHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +34,15 @@ public class ProcessExKeyAction extends EditorAction
|
||||
{
|
||||
public ProcessExKeyAction()
|
||||
{
|
||||
super(new ProcessExKeyHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
return CommandGroups.getInstance().getProcess().processExKey(editor, context,
|
||||
(KeyStroke)cmd.getKeys().get(0), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.maddyhome.idea.vim.action.file;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FileGetAsciiAction extends EditorAction
|
||||
{
|
||||
public FileGetAsciiAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getFile().displayAsciiInfo(editor);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.maddyhome.idea.vim.action.file;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FileGetFileInfoAction extends EditorAction
|
||||
{
|
||||
public FileGetFileInfoAction()
|
||||
{
|
||||
super(new FileGetFileInfoAction.Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getFile().displayFileInfo(editor, cmd.getRawCount() > 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
47
src/com/maddyhome/idea/vim/action/file/FileGetHexAction.java
Normal file
47
src/com/maddyhome/idea/vim/action/file/FileGetHexAction.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.maddyhome.idea.vim.action.file;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FileGetHexAction extends EditorAction
|
||||
{
|
||||
public FileGetHexAction()
|
||||
{
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getFile().displayHexInfo(editor);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.maddyhome.idea.vim.action.file;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FileGetLocationInfoAction extends EditorAction
|
||||
{
|
||||
public FileGetLocationInfoAction()
|
||||
{
|
||||
super(new FileGetLocationInfoAction.Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getFile().displayLocationInfo(editor);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.maddyhome.idea.vim.action.file;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2006 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class FilePreviousAction extends EditorAction
|
||||
{
|
||||
public FilePreviousAction()
|
||||
{
|
||||
super(new FilePreviousHandler());
|
||||
}
|
||||
|
||||
private static class FilePreviousHandler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getFile().selectPreviousTab(context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,30 @@
|
||||
package com.maddyhome.idea.vim.action.file;
|
||||
|
||||
/*
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
* IdeaVim - A Vim emulator plugin for IntelliJ Idea
|
||||
* Copyright (C) 2003-2005 Rick Maddy
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.maddyhome.idea.vim.handler.file.FileSaveHandler;
|
||||
import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.group.CommandGroups;
|
||||
import com.maddyhome.idea.vim.handler.AbstractEditorActionHandler;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -28,6 +32,16 @@ public class FileSaveAction extends EditorAction
|
||||
{
|
||||
public FileSaveAction()
|
||||
{
|
||||
super(new FileSaveHandler());
|
||||
super(new Handler());
|
||||
}
|
||||
|
||||
private static class Handler extends AbstractEditorActionHandler
|
||||
{
|
||||
protected boolean execute(Editor editor, DataContext context, Command cmd)
|
||||
{
|
||||
CommandGroups.getInstance().getFile().saveFile(editor, context);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user