anchor.diff:          :lem-vi-mode.word))
   (in-package :lem-vi-mode)
   
  +(defvar *vi-keymap* (make-keymap :name '*vi-keymap* :undef-hook 'vi-command-dispatcher))
   (defvar *command-keymap* (make-keymap :name '*command-keymap*))
   (defvar *insert-keymap* (make-keymap :name '*insert-keymap*))
  +
  +(defvar *current-state*)
  +(defvar *modeline-element*)
  +
  +(define-attribute state-attribute
  +  (t :reverse-p t))
   
   (defstruct vi-state
     name
     keymap
     function)
  +
  +(defstruct (vi-modeline-element (:conc-name element-))
  +  name)
  +
  +(defmethod convert-modeline-element ((element vi-modeline-element) window)
  +  (values (element-name element) 'state-attribute))
   
   (defmacro define-vi-state (name (&key keymap) &body body)
     `(setf (get ',name 'state)
  
positive.code: 
  (define-key *insert-keymap* "escape" 'vi-insert-end)
  
  (define-command vi-move-to-beginning-of-line/universal-argument-0 () ()
    (if (mode-active-p (current-buffer) 'universal-argument)
        (universal-argument-0)
        (move-to-beginning-of-line)))
  
  (define-command vi-backward-char (&optional (n 1)) ("p")
    (backward-char n))
  
  (define-command vi-forward-char (&optional (n 1)) ("p")
    (forward-char n))
  
  (define-command vi-previous-line (&optional (n 1)) ("p")
    (previous-line n))
  
  (define-command vi-next-line (&optional (n 1)) ("p")
    (next-line n))
  
  (define-command vi-forward-word-begin (&optional (n 1)) ("p")
    (forward-word-begin (current-point) n nil))
  
negative.code: (define-key *command-keymap* "7" 'universal-argument-7)
  (define-key *command-keymap* "8" 'universal-argument-8)
  (define-key *command-keymap* "9" 'universal-argument-9)
  (define-key *command-keymap* "l" 'vi-forward-char)
  (define-key *command-keymap* "h" 'vi-backward-char)
  (define-key *command-keymap* "j" 'vi-next-line)
  (define-key *command-keymap* "k" 'vi-previous-line)
  (define-key *command-keymap* "w" 'vi-forward-word-begin)
  (define-key *command-keymap* "b" 'vi-backward-word-begin)
  (define-key *command-keymap* "W" 'vi-forward-word-begin-broad)
  