- execute: (count=1) ->
- @vimState.setInsertionCheckpoint() unless @typingCompleted
- _.times count, =>
- @editor.selectRight()
- @setTextRegister(@register, @editor.getSelectedText())
- @editor.delete()
-
- if @typingCompleted
- @typedText = @typedText.trimLeft()
- return super
-
- @vimState.activateInsertMode()
- @typingCompleted = true
-
-class SubstituteLine extends Insert
- register: null
-
- constructor: (@editor, @vimState, {@selectOptions}={}) ->
- @register = settings.defaultRegister()
-
- execute: (count=1) ->
- @vimState.setInsertionCheckpoint() unless @typingCompleted
- @editor.moveToBeginningOfLine()
- _.times count, =>
- @editor.selectToEndOfLine()
- @editor.selectRight()
- @setTextRegister(@register, @editor.getSelectedText())
- @editor.delete()
- @editor.insertNewlineAbove()
- @editor.getLastCursor().skipLeadingWhitespace()
-
- if @typingCompleted
- @typedText = @typedText.trimLeft()
- return super
-
- @vimState.activateInsertMode()
- @typingCompleted = true
+ @vimState.activateInsertMode()
+ @typingCompleted = true
+ else
+ @vimState.activateNormalMode()