   (reify KeyListener
     (keyReleased [this e] nil)
     (keyTyped [this e]
-      (when (and @enable-advanced? (special-codes (.getKeyCode e)))
+      (when (and @enable-advanced?
+                 (get #{"(" ")" "[" "]" "{" "}" "\""}
+                      (str (.getKeyChar e))))
         (.consume e)))
     (keyPressed [this e]
       (when-not (.isConsumed e)
         (let [k (convert-key-event e)
-              p (exec-paredit! k w buffer enable-default? enable-advanced?)]
+              p (exec-paredit k w buffer enable-default? enable-advanced?)]
           (when p (.consume e)))))))
-
-(defn convert-input-method-event
-  [event]
-  ["M" (os-x-charmap (str (.first (.getText event))))])
 
 (defn input-method-event-handler
   [w buffer enable-default? enable-advanced?]
   (reify InputMethodListener
     (inputMethodTextChanged [this e]
       (let [k (convert-input-method-event e)
-            p (exec-paredit! k w buffer enable-default? enable-advanced?)]
+            p (exec-paredit k w buffer enable-default? enable-advanced?)]
         (when p (.consume e))))))
 
 (defn init-paredit!

   ["M" "{"] :paredit-open-curly
   ["M" "}"] :paredit-close-curly})

(def ^:const special-codes
  #{KeyEvent/VK_LEFT_PARENTHESIS
    KeyEvent/VK_RIGHT_PARENTHESIS
    KeyEvent/VK_OPEN_BRACKET
    KeyEvent/VK_CLOSE_BRACKET
    KeyEvent/VK_BRACELEFT
    KeyEvent/VK_BRACERIGHT
    KeyEvent/VK_BACK_SPACE
    KeyEvent/VK_DELETE
    KeyEvent/VK_QUOTEDBL
    KeyEvent/VK_LEFT
    KeyEvent/VK_RIGHT})

(defn exec-paredit!
  [k w buffer enable-default? enable-advanced?]
  (when-let [cmd (or (and enable-default?
                          (default-keymap k))
                     (and @enable-advanced?
                          (or (advanced-keymap k)
                              (advanced-alternate-keymap k)
                              (foreign-keymap k))))]
    (insert-result! w (exec-command cmd w buffer))
    cmd))

(defn convert-key-event
  [event]

       (.isAltDown event) "M"
       (.isControlDown event) "C"
       :else nil)
     (if (= KeyEvent/CHAR_UNDEFINED key-char)
       (KeyEvent/getKeyText key-code)
       (str key-char))]))

