Skip to content

Commit

Permalink
Add support for 'ZZ' (like :wq) and 'ZQ' (like :q!) just because I can.
Browse files Browse the repository at this point in the history
  • Loading branch information
keforbes committed Jun 6, 2012
1 parent 2cf9a46 commit f94e982
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.sourceforge.vrapper.vim.commands.ChangeOperation;
import net.sourceforge.vrapper.vim.commands.ChangeToInsertModeCommand;
import net.sourceforge.vrapper.vim.commands.ChangeToSearchModeCommand;
import net.sourceforge.vrapper.vim.commands.CloseCommand;
import net.sourceforge.vrapper.vim.commands.Command;
import net.sourceforge.vrapper.vim.commands.CommandExecutionException;
import net.sourceforge.vrapper.vim.commands.CountIgnoringNonRepeatableCommand;
Expand All @@ -52,6 +53,7 @@
import net.sourceforge.vrapper.vim.commands.RedoCommand;
import net.sourceforge.vrapper.vim.commands.RepeatLastSubstitutionCommand;
import net.sourceforge.vrapper.vim.commands.ReplaceCommand;
import net.sourceforge.vrapper.vim.commands.SaveCommand;
import net.sourceforge.vrapper.vim.commands.SetMarkCommand;
import net.sourceforge.vrapper.vim.commands.SimpleDelimitedText;
import net.sourceforge.vrapper.vim.commands.SimpleSelection;
Expand All @@ -61,6 +63,7 @@
import net.sourceforge.vrapper.vim.commands.TextOperation;
import net.sourceforge.vrapper.vim.commands.TextOperationTextObjectCommand;
import net.sourceforge.vrapper.vim.commands.UndoCommand;
import net.sourceforge.vrapper.vim.commands.VimCommandSequence;
import net.sourceforge.vrapper.vim.commands.VisualMotionCommand;
import net.sourceforge.vrapper.vim.commands.YankOperation;
import net.sourceforge.vrapper.vim.commands.motions.LineEndMotion;
Expand Down Expand Up @@ -242,6 +245,7 @@ protected State<Command> buildInitialState() {
Command centerTopLine = CenterLineCommand.TOP;
Command repeatSubLine = RepeatLastSubstitutionCommand.CURRENT_LINE_ONLY;
Command repeatSubGlobal = RepeatLastSubstitutionCommand.GLOBALLY;
Command saveAndClose = new VimCommandSequence(SaveCommand.INSTANCE, CloseCommand.CLOSE);

Command afterEnteringVisualInc = new OptionDependentCommand<String>(Options.SELECTION, "inclusive",
new VisualMotionCommand(moveRight));
Expand Down Expand Up @@ -318,6 +322,9 @@ public void execute(EditorAdaptor editorAdaptor) throws CommandExecutionExceptio
VimConstants.PRINTABLE_KEYSTROKES)),
leafBind('u', undo),
leafCtrlBind('r', redo),
transitionBind('Z',
leafBind('Z', saveAndClose),
leafBind('Q', (Command)CloseCommand.FORCED_CLOSE)),
transitionBind('z',
leafBind('z', centerLine),
leafBind('.', centerLine),
Expand Down

0 comments on commit f94e982

Please sign in to comment.