     (setq merlin-enclosing-offset (1- merlin-enclosing-offset))
     (merlin-type-enclosing-go)))
 
+
+(defvar merlin-type-enclosing-map
+  (let ((keymap (make-sparse-keymap)))
+    (define-key keymap (kbd "<up>") 'up)
+    (define-key keymap (kbd "[up]") 'up)
+    (define-key keymap (kbd "<down>") 'down)
+    (define-key keymap (kbd "[down]") 'down)
+    keymap)
+  "The local map to navigate type enclosing.")
+
 (defun merlin-type-enclosing ()
   "Print the type of the expression under point (or of the region, if it exists)."
   (interactive)

             (version (replace-regexp-in-string "\n$" "" version)))
        (message "%s (from shell)" version))
    (message "%s" (merlin-send-command '(version)))))

;;;;;;;;;;;;;;;;
;; MODE SETUP ;;

    (merlin-sync-to-point)
    (if (region-active-p)
        (merlin-type-region)
      (when (merlin-type-enclosing-query)
        (merlin-type-enclosing-go-up))))
  (if merlin-arrow-keys-type-enclosing
      (merlin-event-loop merlin-type-enclosing-map
                         '((up . merlin-type-enclosing-go-up)
                           (down . merlin-type-enclosing-go-down)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PACKAGE, PROJECT AND FLAGS MANAGEMENT ;;
