     rightOfCursor = line.substring column
 
     matchOnLine = regex.exec rightOfCursor
+
+    # If we're on top of the last char of a word we want to match the next one.
     if matchOnLine?[0].length <= 1
-      # if we're on top of the last char of a word we want to go to the next one
       matchOnLine = regex.exec rightOfCursor
 
+    # If there's a match on the current line, go to the end of the word that's
+    # been matched.
     if matchOnLine
-      # go to the end of the word that's been matched
       column += matchOnLine[0].length + matchOnLine.index - 1
+
+    # If there's no match on the current line go end of the next word, whatever
+    # line that may be on.  If there are no more non-blank characters, don't
+    # move the cursor.
     else
-      # if there's no match on the current line go end of the next word, whatever line
-      # that may be
       loop
         line = jim.adaptor.lineText ++row
         firstMatchOnSubsequentLine = regex.exec line


{Command, repeatCountTimes} = require './helpers'

# accumulate the default mappings
defaultMappings = {}
map = (keys, motionClass) -> defaultMappings[keys] = motionClass

# base class for all motions
class Motion extends Command

  # motions do the same thing in visual mode
  visualExec: (jim) -> @exec jim


# Define an unmapped `Motion` that will be used for double operators (e.g. `cc`,
# `2yy`, `3d4d`).
class LinewiseCommandMotion extends Motion
  linewise: yes
  exec: (jim) ->
    if additionalLines = @count - 1
      new MoveDown(additionalLines).exec jim


# Basic directional motions
# -------------------------
