     match = regex.exec leftOfCursor
     if match
       column = match.index
+
+    # If there are no matches left of the cursor, go to the last word on the
+    # previous line.  Vim skips lines that are have only whitespace on them, but
+    # not completely empty lines.
     else
-      # there are no matches left of the cursor
-      # go to the last word on the previous line
       row--
-      # Vim skips lines that are only whitespace
-      # (but not completely empty lines)
       row-- while /^\s+$/.test(line = jim.adaptor.lineText row)
       match = regex.exec line
       column = match?.index or 0

      # Move to the `row` and `column` that have been determined.
      jim.adaptor.moveTo row, column

map 'W', class MoveToNextBigWord extends MoveToNextWord
  bigWord: yes


    jim.adaptor.moveTo rowNumber, 0
    new MoveToFirstNonBlank().exec jim

# Go to `{count}` line number or the last line.
map 'G', class GoToLineOrEnd extends GoToLine
  constructor: (@count) ->
  exec: (jim) ->
    @count or= jim.adaptor.lastRow() + 1
    super

# Go to the first line that's visible in the viewport.
map 'H', class GoToFirstVisibleLine extends Motion
  linewise: yes
  exec: (jim) ->
    line = jim.adaptor.firstFullyVisibleRow() + @count
    new GoToLineOrEnd(line).exec jim

# Go to the middle line of the lines that exist and are visible in the viewport.
map 'M', class GoToMiddleLine extends Motion
  linewise: yes
  exec: (jim) ->
