         vars      (set (concat refers aliases namespaces))
         macros    (set (filter #(-> % second meta :macro) vars))
         vars      (clojure.set/difference vars macros)
-        fns       (set (filter #(let [v (safe-var-get (second %))]
+        fns       (set (filter #(let [v (util/safe-var-get (second %))]
                                   (or (fn? v)
                                       (instance? clojure.lang.MultiFn v)))
                                vars))

(defnail NamespaceInfo
  "Usage: ng de.kotka.vimclojure.nails.NamespaceInfo"
  []
  (println (clj->vim (map #(-> % symbol find-ns ns-info)
                          (line-seq (BufferedReader. *in*))))))

(defnail MacroExpand
  "Usage: ng de.kotka.vimclojure.nails.MacroExpand [options]"
  [[nspace n "Lookup the symbols in the given namespace." "user"]
   [one?   o "Expand only the first macro."]]
  (let [nspace (resolve-and-load-namespace nspace)
        expand (if one
                 #(macroexpand-1 %)
                 #(macroexpand %))]
    (binding [*ns* nspace]
      (doseq [expr (stream->seq *in*)]
        (-> expr expand pretty-print-code)))))

(defnail Repl
  "Usage: ng de.kotka.vimclojure.nails.Repl [options]"


(clojure.core/ns de.kotka.vimclojure.nails
  (:use
     [clojure.contrib.def :only (defvar)])
  (:require
     (de.kotka.vimclojure [repl :as repl]
                          [util :as util]
                          [backend :as backend]))
  (:import
     com.martiansoftware.nailgun.NGContext
     clojure.lang.LineNumberingPushbackReader
