         @visit(current, null)
 
     if @isComplete()
-      @vimState.searchHistory.save(@input)
+      @vimState.searchHistory.save(@getInput())
       @finish()
 
   # If cursor is passed, it move actual move, otherwise


  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)
