   isBackwards: ->
     @backwards
 
+  getInput: ->
+    @input
+
   # Not sure if I should support count but keep this for compatibility to official vim-mode.
   getCount: ->
     count = super


  scan: (cursor) ->
    ranges = []
    return ranges if @input is ''

    @editor.scan @getPattern(@input), ({range}) ->
      ranges.push range

    point = cursor.getBufferPosition()
    [pre, post] = _.partition ranges, ({start}) =>
      if @isBackwards()
        start.isLessThan(point)
      else
        start.isLessThanOrEqual(point)

    post.concat(pre)


  @extend()
  wordRegex: null

  getInput: ->
    return @input if @input?

    # FIXME: This must depend on the current language
    defaultIsKeyword = "[@a-zA-Z0-9_\-]+"
    userIsKeyword = settings.get('iskeyword')
    @wordRegex = new RegExp(userIsKeyword or defaultIsKeyword)
    # @getCurrentWord() have side effect(moving cursor), so don't call twice.
    @input = @getCurrentWord()

  getPattern: (text) ->
    pattern = _.escapeRegExp(text)
