`:tabedit` now works as an alias to `:edit` with a path and as an alias to `:tabnew` without. `:tabnew` is a new command that opens a new tab with a new file if used without a path and works as an alias to `:tabedit` with one. `:tabclose` now works as a proper alias to `:quit` (i.e. passes the arguments) `:edit` now works more like before - it opens a given path in a new tab. It also doesn't do anything if the file was modified since the last commit, unless forced by using `:edit!` `:write` works properly again and doesn't overwrite files, unless forced by using `:write!` `:xit` is now called `:xit` and not just `:x` `:substitute` now properly replaces multiple groups (`:s/(a)b(c)/X\1\2X\0`)
26 lines
609 B
CoffeeScript
26 lines
609 B
CoffeeScript
ExNormalModeInputElement = require './ex-normal-mode-input-element'
|
|
|
|
class ViewModel
|
|
constructor: (@command, opts={}) ->
|
|
{@editor, @exState} = @command
|
|
|
|
@view = new ExNormalModeInputElement().initialize(@, opts)
|
|
@editor.normalModeInputView = @view
|
|
@exState.onDidFailToExecute => @view.remove()
|
|
@done = false
|
|
|
|
confirm: (view) ->
|
|
@exState.pushOperations(new Input(@view.value))
|
|
@done = true
|
|
|
|
cancel: (view) ->
|
|
unless @done
|
|
@exState.pushOperations(new Input(''))
|
|
@done = true
|
|
|
|
class Input
|
|
constructor: (@characters) ->
|
|
|
|
module.exports = {
|
|
ViewModel, Input
|
|
}
|