diff options
| author | Stephen Blott | 2015-01-24 17:26:35 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-24 17:26:35 +0000 |
| commit | 4d47050983c46fc6563b40517aef949b7ad46b54 (patch) | |
| tree | d22032535ba25bc10896eddc7694835668866504 | |
| parent | f7bf189fc0e918a4d46e0eb375dcfe95dc380676 (diff) | |
| download | vimium-4d47050983c46fc6563b40517aef949b7ad46b54.tar.bz2 | |
Visual/edit modes: implement "yy".
| -rw-r--r-- | content_scripts/mode_visual_edit.coffee | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee index f45ecf51..ad7fb59c 100644 --- a/content_scripts/mode_visual_edit.coffee +++ b/content_scripts/mode_visual_edit.coffee @@ -4,7 +4,6 @@ # - line-visual mode # - better implementation of `o` # - caret mode -# - yy # This prevents printable characters from being passed through to underlying page. It should, however, allow # through chrome keyboard shortcuts. It's a backstop for all of the modes following. @@ -262,6 +261,7 @@ class Movement extends MaintainCount selectLine: -> direction = @getDirection() for direction in [ @opposite[direction], direction ] + console.log direction @runMovement "#{direction} lineboundary" @swapFocusAndAnchor() @@ -317,7 +317,11 @@ class VisualMode extends Movement underEditMode: false super extend defaults, options - extend @commands, "y": @yank + extend @commands, + "y": -> + # Special case: "yy" (the first from edit mode, and now the second). + @selectLine() if @options.expectImmediateY and @keyQueue == "" + @yank() if @options.underEditMode extend @commands, @@ -350,7 +354,7 @@ class EditMode extends Movement "v": -> new VisualModeForEdit "Y": -> @runInVisualMode runMovement: "Y" - "y": => @runInVisualMode {} + "y": => @runInVisualMode expectImmediateY: true "d": => @runInVisualMode deleteFromDocument: true "c": => @runInVisualMode deleteFromDocument: true |
