       @setTarget(@new(@target))
 
     # When preset-occurrence was exists, auto enable occurrence-wise
-    if @occurrence
-      @setOccurrence('static')
-    else if @acceptPresetOccurrence and @occurrenceManager.hasPatterns()
-      @setOccurrence('preset')
+    if @acceptPresetOccurrence and @occurrenceManager.hasPatterns()
+      @setOccurrence(true)
+    if @isOccurrence()
+      @addOccurrencePattern() unless @occurrenceManager.hasMarkers()
 
     if @acceptPersistentSelection
       @subscribe @onDidDeactivateMode ({mode}) =>

    @vimState.hasPersistentSelections() and
    settings.get('autoSelectPersistentSelectionOnOperate')

  # type is one of ['preset', 'modifier']
  setOccurrence: (type) ->
    @occurrence = true
    switch type
      when 'static'
        unless @isComplete() # we enter operator-pending
          debug 'static: mark as we enter operator-pending'
          @addOccurrencePattern() unless @occurrenceManager.hasMarkers()
      when 'preset'
        debug 'preset: nothing to do since we have markers already'
      when 'modifier'
        debug 'modifier: overwrite existing marker when manually typed `o`'
        @occurrenceManager.resetPatterns() # clear existing marker
        @addOccurrencePattern() # mark cursor word.

  addOccurrencePattern: (pattern=null) ->
    pattern ?= @patternForOccurrence
    unless pattern?

{inspect} = require 'util'
{
  haveSomeNonEmptySelection
  isEndsWithNewLineForBufferRow
  getValidVimBufferRow
  cursorIsAtEmptyRow
  getWordPatternAtBufferPosition
  destroyNonLastSelection
} = require './utils'
swrap = require './selection-wrapper'
settings = require './settings'
