         # Reset existing preset-occurrence. e.g. `c o p`, `d o f`
         @occurrenceManager.resetPatterns()
         @addOccurrencePattern()
-        @subscribe @onDidDeactivateMode ({mode}) =>
-          @occurrenceManager.resetPatterns() if mode is 'operator-pending'
+        @onDidResetOperationStack(@resetOccurrencePattern.bind(this))
 
   canSelectPersistentSelection: ->
     @acceptPersistentSelection and

    {@mutationManager, @occurrenceManager, @persistentSelection} = @vimState

    # If occurrence property is set at this timing and there is no preset-occurrence marker.
    # treat `occurrence` is BOUNDED to operator itself so cleanup on each finish.
    if @occurrence and not @occurrenceManager.hasMarkers()
      @onDidResetOperationStack =>
        @occurrenceManager.resetPatterns()

    @initialize()
    @onDidSetOperatorModifier(@setModifier.bind(this))

      point = @getCursorBufferPosition()
      pattern = getWordPatternAtBufferPosition(@editor, point, singleNonWordChar: true)
    @occurrenceManager.addPattern(pattern)

  resetOccurrencePattern: ->
    @occurrenceManager.resetPatterns()

  # target is TextObject or Motion to operate on.
  setTarget: (@target) ->
