       editor.getBuffer().setText("012 345\nabc\n")
       editor.setCursorScreenPosition([0, 4])
 
+    describe "when followed by a second y ", ->
+      beforeEach ->
+        keydown('y')
+        keydown('y')
+
+      it "saves the line to the default register", ->
+        expect(vimState.getRegister('"').text).toBe "012 345\n"
+        expect(editor.getCursorScreenPosition()).toEqual [0, 4]
+
+    describe "when followed with a repeated y", ->
+      beforeEach ->
+        keydown('y')
+        keydown('2')
+        keydown('y')
+
+      it "copies n lines, starting from the current", ->
+        expect(vimState.getRegister('"').text).toBe "012 345\nabc\n"
+
+    describe "with a register", ->
+      beforeEach ->
+        keydown('"')
+        keydown('a')
+        keydown('y')
+        keydown('y')
+
+      it "saves the line to the a register", ->
+        expect(vimState.getRegister('a').text).toBe "012 345\n"
+
+    describe "with a motion", ->
+      beforeEach ->
+        keydown('y')
+        keydown('w')
+
+      it "saves the first word to the default register", ->
+        expect(vimState.getRegister('"').text).toBe '345'
+
+  describe "the Y keybinding", ->
+    beforeEach ->
+      editor.getBuffer().setText "012 345\nabc\n"
+      editor.setCursorScreenPosition [0, 4]
+
     it "saves the line to the default register", ->
-      keydown('y')
-      keydown('y')
+      keydown('Y', shift: true)
 
       expect(vimState.getRegister('"').text).toBe "012 345\n"
       expect(editor.getCursorScreenPosition()).toEqual [0, 4]
 
-    describe "when the second y is prefixed by a count", ->
-      it "copies n lines, starting from the current", ->
-        keydown('y')
-        keydown('2')
-        keydown('y')
-
-        expect(vimState.getRegister('"').text).toBe "012 345\nabc\n"
-
-    it "saves the line to the a register", ->
-      keydown('"')
-      keydown('a')
-      keydown('y')
-      keydown('y')
-
-      expect(vimState.getRegister('a').text).toBe "012 345\n"
-
-    it "saves the first word to the default register", ->
-      keydown('y')
-      keydown('w')
-
-      expect(vimState.getRegister('"').text).toBe '345'
-
-  describe "the Y keybinding", ->
-    beforeEach ->
-      editor.getBuffer().setText "012 345\nabc\n"
-      editor.setCursorScreenPosition [0, 4]
-
-    it "saves the line to the default register", ->
-      keydown('Y', shift: true)
-
-      expect(vimState.getRegister('"').text).toBe "012 345\n"
-      expect(editor.getCursorScreenPosition()).toEqual [0, 4]
-
-    describe "when prefixed by a count", ->
-      it "copies n lines, starting from the current", ->
-        keydown('2')
-        keydown('Y', shift: true)
-
-        expect(vimState.getRegister('"').text).toBe "012 345\nabc\n"
-
-    it "saves the line to the a register", ->
-      keydown('"')
-      keydown('a')
-      keydown('Y', shift: true)
-
-      expect(vimState.getRegister('a').text).toBe "012 345\n"
-
   describe "the p keybinding", ->
-    describe "character", ->
+    describe "with character contents", ->
       beforeEach ->
         editor.getBuffer().setText "012\n"
         editor.setCursorScreenPosition [0, 0]
         vimState.setRegister('"', text: '345')
         vimState.setRegister('a', text: 'a')
 
-      it "inserts the contents of the default register", ->
-        keydown('p')
-
-        expect(editor.getText()).toBe "034512\n"
-        expect(editor.getCursorScreenPosition()).toEqual [0, 4]
-
-      it "inserts the contents of the 'a' register", ->
-        keydown('"')
-        keydown('a')
-        keydown('p')
-
-        expect(editor.getText()).toBe "0a12\n"
-        expect(editor.getCursorScreenPosition()).toEqual [0, 2]
-
-    describe "linewise", ->
+      describe "from the default register", ->
+        beforeEach -> keydown('p')
+
+        it "inserts the contents", ->
+          expect(editor.getText()).toBe "034512\n"
+          expect(editor.getCursorScreenPosition()).toEqual [0, 4]
+
+      describe "from a specified register", ->
+        beforeEach ->
+          keydown('"')
+          keydown('a')
+          keydown('p')
+
+        it "inserts the contents of the 'a' register", ->
+          expect(editor.getText()).toBe "0a12\n"
+          expect(editor.getCursorScreenPosition()).toEqual [0, 2]
+
+    describe "with linewise contents", ->
       beforeEach ->
         editor.getBuffer().setText("012\n")
         editor.setCursorScreenPosition([0, 1])
         vimState.setRegister('"', text: " 345\n", type: 'linewise')
+        keydown('p')
 
       it "inserts the contents of the default register", ->
-        keydown('p')
-
         expect(editor.getText()).toBe "012\n 345\n"
         expect(editor.getCursorScreenPosition()).toEqual [1, 1]
 
     describe "undo behavior", ->
-      it "handles repeats", ->
+      beforeEach ->
         editor.setText("12345\nabcde\nABCDE\nQWERT")
         editor.setCursorScreenPosition([1, 1])
         vimState.setRegister('"', text: '123')
-
         keydown('2')
         keydown('p')
-
         keydown('u')
 
+      it "handles repeats", ->
         expect(editor.getText()).toBe "12345\nabcde\nABCDE\nQWERT"
 
   describe "the P keybinding", ->
-    describe "character", ->
+    describe "with character contents", ->
       beforeEach ->
         editor.getBuffer().setText("012\n")
         editor.setCursorScreenPosition([0, 0])
         vimState.setRegister('"', text: '345')
         vimState.setRegister('a', text: 'a')
-
-      it "inserts the contents of the default register", ->
         keydown('P', shift: true)
 
+      it "inserts the contents of the default register above", ->
         expect(editor.getText()).toBe "345012\n"
         expect(editor.getCursorScreenPosition()).toEqual [0, 3]
-
-      it "inserts the contents of the 'a' register", ->
-        keydown('"')
-        keydown('a')
-        keydown('P', shift: true)
-
-        expect(editor.getText()).toBe "a012\n"
-        expect(editor.getCursorScreenPosition()).toEqual [0, 1]
-
-    describe "linewise", ->
-      beforeEach ->
-        editor.getBuffer().setText("012\n")
-        editor.setCursorScreenPosition([0, 1])
-        vimState.setRegister('"', text: " 345\n", type: 'linewise')
-
-      it "inserts the contents of the default register", ->
-        keydown('P', shift: true)
-
-        expect(editor.getText()).toBe " 345\n012\n"
-        expect(editor.getCursorScreenPosition()).toEqual [0, 1]
 
   describe "the O keybinding", ->
     beforeEach ->

    beforeEach ->
      editor.getBuffer().setText("012\n")

    it "switches to insert mode and shifts to the right", ->
      editor.setCursorScreenPosition([0, 0])

      keydown('a')

      expect(editor.getCursorScreenPosition()).toEqual [0, 1]
      expect(editor).toHaveClass 'insert-mode'

    it "doesn't linewrap", ->
      editor.setCursorScreenPosition([0, 3])

      keydown('a')

      expect(editor.getCursorScreenPosition()).toEqual [0, 3]

  describe "the J keybinding", ->
    beforeEach ->
      editor.getBuffer().setText("012\n    456\n")
      editor.setCursorScreenPosition([0, 1])

    it "deletes the contents until the end of the line", ->
      keydown('J', shift: true)

      expect(editor.getText()).toBe "012 456\n"

    describe "undo behavior", ->
      it "handles repeats", ->
        editor.setText("12345\nabcde\nABCDE\nQWERT")
        editor.setCursorScreenPosition([1, 1])

        keydown('2')
        keydown('J', shift: true)

        keydown('u')

        expect(editor.getText()).toBe "12345\nabcde\nABCDE\nQWERT"

  describe "the > keybinding", ->
    describe "when followed by a >", ->
      it "indents the current line", ->
        editor.setText("12345\nabcde\nABCDE")
        editor.setCursorScreenPosition([1, 1])

        keydown('>')
        keydown('>')

        expect(editor.getText()).toBe "12345\n  abcde\nABCDE"
        expect(editor.getCursorScreenPosition()).toEqual [1, 2]

      it "indents multiple lines at once", ->
        editor.setText("12345\nabcde\nABCDE")
        editor.setCursorScreenPosition([0, 0])

        keydown('3')
        keydown('>')
        keydown('>')

        expect(editor.getText()).toBe "  12345\n  abcde\n  ABCDE"
        expect(editor.getCursorScreenPosition()).toEqual [0, 2]

        keydown('u')
        expect(editor.getText()).toBe "12345\nabcde\nABCDE"

  describe "the < keybinding", ->
    describe "when followed by a <", ->
      it "indents the current line", ->
        expect(editor.setText("12345\n  abcde\nABCDE"))
        editor.setCursorScreenPosition([1, 2])

        keydown('<')
        keydown('<')
        expect(editor.getText()).toBe "12345\nabcde\nABCDE"
        expect(editor.getCursorScreenPosition()).toEqual [1, 0]

      it "indents multiple lines at once", ->
        editor.setText("  12345\n  abcde\n  ABCDE")
        editor.setCursorScreenPosition([0, 0])

        keydown('3')
        keydown('<')
        keydown('<')
        expect(editor.getText()).toBe "12345\nabcde\nABCDE"
        expect(editor.getCursorScreenPosition()).toEqual [0, 0]

        keydown('u')
        expect(editor.getText()).toBe "  12345\n  abcde\n  ABCDE"


      editor.getBuffer().setText("  abc\n  012\n")
      editor.setCursorScreenPosition([1, 1])
      keydown('O', shift: true)

    it "switches to insert and adds a newline above the current one", ->
      expect(editor.getText()).toBe "  abc\n  \n  012\n"
      expect(editor.getCursorScreenPosition()).toEqual [1, 2]
      expect(editor).toHaveClass 'insert-mode'
