   lineNumbers: no
   lineWrapping: yes
   dragDrop: no
+  autofocus: yes
 editor.on 'change', ->
   updateView()
   if initiated

    if e.ctrlKey
      if e.altKey
        hit = switch e.keyCode
          when 26 then model.gotoPresent(); true # ctrl+alt+z
          when 24 then state.mode = 'write'; true # ctrl+alt+x
          when 3 then state.mode = ''; true # ctrl+alt+c
          when 22 then state.mode = 'read'; true # ctrl+alt+v

      updateTitle()

updateView = ->
  switch state.mode
    when 'present'
      md = editor.getValue().split /\n\s*\n\s*(?:[-*]\s*){3,}\n/
      if state.slide < md.length
        viewEl.innerHTML = marked md[state.slide || 0]
      else
        state.slide = md.length - 1
    when 'read', 'write'
      viewEl.innerHTML = marked editor.getValue()
    else
      cline = editor.getCursor().line
      md = editor.getValue().split '\n'
      md[cline] += '<span id="cursor"></span>'
      md = md.join '\n'
      viewEl.innerHTML = marked md
      updateIndex() if state.index
      updateToc() if state.toc
      scrollTop = viewWrapEl.scrollTop
      viewHeight = viewWrapEl.offsetHeight
      cursorSpan = document.getElementById 'cursor'
      cursorTop = cursorSpan.offsetTop
      cursorHeight = cursorSpan.offsetHeight
      if cursorTop < scrollTop or cursorTop > scrollTop + viewHeight - cursorHeight
        viewWrapEl.scrollTop = cursorTop - viewHeight/2

updateTitle = ->
  document.title = (if saved then '' else '*')+docTitle()
