       return if @finishing
       text = @editor.getText()
       @model.emitter.emit 'did-change', text
-      if text.length >= @charsMax
+      if text.length >= @getSpec('charsMax')
         @confirm()
 
+  setSpec: (@spec) ->
+    _.defaults(@spec, {defaultInput: '', charsMax: 1})
+
+  getSpec: (name) ->
+    @spec[name]
+
   confirm: ->
-    if input = (@editor.getText() or @defaultInput)
+    if input = (@editor.getText() or @getSpec('defaultInput'))
       # console.log "called confirm with '#{input}'"
       @model.emitter.emit 'did-get', input
       @unfocus()


class InputElement extends HTMLElement
  finishing: false

  createdCallback: ->
    @className = 'vim-mode-input'

{Emitter} = require 'atom'
{CompositeDisposable} = require 'atom'
_ = require 'underscore-plus'

class Input
  subscriptions: null

  constructor: (@vimState) ->
    @emitter = new Emitter
    @view = atom.views.getView(this)
    @vimState.onDidFailToCompose =>
      @view.cancel()

  onDidGet: (spec={}, callback) ->
    @subscriptions ?= new CompositeDisposable
    @view.setSpec(spec)
    @subscriptions.add @emitter.on 'did-get', callback

  onDidChange: (callback) ->
