 
 class KeyBindings
 
-  defaultVimKeyBindings =
-    MENU:
-      'MENU_SELECT'       : ['enter']
-      'MENU_UP'           : ['ctrl+k', 'up', 'tab']
-      'MENU_DOWN'         : ['ctrl+j', 'down', 'shift+tab']
-
-      'LEFT'              : ['left']
-      'RIGHT'             : ['right']
-      'HOME'              : ['ctrl+a', 'home']
-      'END'               : ['ctrl+e', 'end']
-      'BEGINNING_WORD'    : ['alt+b']
-      'END_WORD'          : ['alt+f']
-      'NEXT_WORD'         : []
-      'BEGINNING_WWORD'   : []
-      'END_WWORD'         : []
-      'NEXT_WWORD'        : []
-      'FIND_NEXT_CHAR'    : []
-      'FIND_PREV_CHAR'    : []
-      'TO_NEXT_CHAR'      : []
-      'TO_PREV_CHAR'      : []
-
-      'BACKSPACE'         : ['backspace']
-      'DELKEY'            : ['shift+backspace']
-
-      'EXIT_MODE'         : ['esc', 'ctrl+c']
-    INSERT:
-      'LEFT'              : ['left']
-      'RIGHT'             : ['right']
-      'UP'                : ['up']
-      'DOWN'              : ['down']
-      'HOME'              : ['ctrl+a', 'home']
-      'END'               : ['ctrl+e', 'end']
-      'BEGINNING_WORD'    : ['alt+b']
-      'END_WORD'          : ['alt+f']
-      'NEXT_WORD'         : []
-      'BEGINNING_WWORD'   : []
-      'END_WWORD'         : []
-      'NEXT_WWORD'        : []
-      'FIND_NEXT_CHAR'    : []
-      'FIND_PREV_CHAR'    : []
-      'TO_NEXT_CHAR'      : []
-      'TO_PREV_CHAR'      : []
-
-      'BACKSPACE'         : ['backspace']
-      'DELKEY'            : ['shift+backspace']
-      'SPLIT'             : ['enter']
-
-      'INDENT_RIGHT'      : ['tab']
-      'INDENT_LEFT'       : ['shift+tab']
-      'MOVE_BLOCK_RIGHT'  : []
-      'MOVE_BLOCK_LEFT'   : []
-      'MOVE_BLOCK_DOWN'   : []
-      'MOVE_BLOCK_UP'     : []
-
-      'NEXT_SIBLING'      : []
-      'PREV_SIBLING'      : []
-
-      'TOGGLE_FOLD'       : ['ctrl+z']
-      'ZOOM_OUT'          : ['ctrl+left']
-      'ZOOM_IN'           : ['ctrl+right']
-      'ZOOM_OUT_ALL'      : ['ctrl+shift+left']
-      'ZOOM_IN_ALL'       : ['ctrl+shift+right']
-      'SCROLL_DOWN'       : ['ctrl+d']
-      'SCROLL_UP'         : ['ctrl+u']
-
-      'SEARCH'            : []
-      'EXPORT'            : ['ctrl+s']
-      'EXIT_MODE'         : ['esc', 'ctrl+c']
-    NORMAL:
-      'HELP'              : ['?']
-      'INSERT'            : ['i']
-      'INSERT_HOME'       : ['I']
-      'INSERT_AFTER'      : ['a']
-      'INSERT_END'        : ['A']
-      'INSERT_LINE_BELOW' : ['o']
-      'INSERT_LINE_ABOVE' : ['O']
-
-      'REPLACE'           : ['r']
-      'UNDO'              : ['u']
-      'REDO'              : ['ctrl+r']
-      'REPLAY'            : ['.']
-
-      'LEFT'              : ['h', 'left']
-      'RIGHT'             : ['l', 'right']
-      'UP'                : ['k', 'up']
-      'DOWN'              : ['j', 'down']
-      'HOME'              : ['0', '^']
-      'END'               : ['$']
-      'BEGINNING_WORD'    : ['b']
-      'END_WORD'          : ['e']
-      'NEXT_WORD'         : ['w']
-      'BEGINNING_WWORD'   : ['B']
-      'END_WWORD'         : ['E']
-      'NEXT_WWORD'        : ['W']
-      'FIND_NEXT_CHAR'    : ['f']
-      'FIND_PREV_CHAR'    : ['F']
-      'TO_NEXT_CHAR'      : ['t']
-      'TO_PREV_CHAR'      : ['T']
-
-      'GO'                : ['g']
-      'PARENT'            : ['p']
-      'GO_END'            : ['G']
-      'DELETE'            : ['d']
-      'CHANGE'            : ['c']
-      'DELETE_CHAR'       : ['x']
-      'DELETE_LAST_CHAR'  : ['X']
-      'CHANGE_CHAR'       : ['s']
-      'YANK'              : ['y']
-      'PASTE_AFTER'       : ['p']
-      'PASTE_BEFORE'      : ['P']
-      'JOIN_LINE'         : ['J']
-
-      'INDENT_RIGHT'      : ['tab']
-      'INDENT_LEFT'       : ['shift+tab']
-      'MOVE_BLOCK_RIGHT'  : ['>', 'ctrl+l']
-      'MOVE_BLOCK_LEFT'   : ['<', 'ctrl+h']
-      'MOVE_BLOCK_DOWN'   : ['ctrl+j']
-      'MOVE_BLOCK_UP'     : ['ctrl+k']
-
-      'NEXT_SIBLING'      : ['alt+j']
-      'PREV_SIBLING'      : ['alt+k']
-
-      'TOGGLE_FOLD'       : ['z']
-      'ZOOM_OUT'          : ['[', 'alt+h', 'ctrl+left']
-      'ZOOM_IN'           : [']', 'alt+l', 'ctrl+right']
-      'ZOOM_OUT_ALL'      : ['{']
-      'ZOOM_IN_ALL'       : ['}']
-      'SCROLL_DOWN'       : ['ctrl+d']
-      'SCROLL_UP'         : ['ctrl+u']
-
-      'SEARCH'            : ['/', 'ctrl+f']
-      'RECORD_MACRO'      : ['q']
-      'PLAY_MACRO'        : ['@']
-
-      'EXPORT'            : ['ctrl+s']
-
-
   # takes keyDefinitions and keyMaps, and combines them
   getBindings = (definitions, keyMap) ->
     bindings = {}

        bindings[key] = v
    return bindings

  constructor: (view, divs = {}) ->
    @view = view

    @keyMaps = _.clone defaultVimKeyBindings

    @bindings = {}
    @bindings[MODES.NORMAL] = getBindings keyDefinitions, @keyMaps.NORMAL
    @bindings[MODES.INSERT] = getBindings keyDefinitions, @keyMaps.INSERT
    @bindings[MODES.MENU]   = getBindings keyDefinitions, @keyMaps.MENU

    if divs.keyBindingsDiv
      @keybindingsDiv = divs.keyBindingsDiv
      do @buildBindingsDiv

    if divs.menuDiv
      @menuDiv = divs.menuDiv

    if divs.modeDiv
      @modeDiv = divs.modeDiv

    @mode = ''
    @setMode MODES.NORMAL

    @macros = {}

        if k == 'MOTION'
          keys = ['<MOTION>']
        else
          keys = modeKeymap[k]
          if not keys
            continue

        if keys.length == 0
          continue

        row = $('<tr>')

        # row.append $('<td>').text keys[0]
