 (defnail DocLookup
   "Usage: ng de.kotka.vimclojure.nails.DocString [options]"
   [[nspace n "Lookup the symbols in the given namespace." "user"]]
-  (let [nspace  (resolve-and-load-namespace nspace)
+  (let [nspace  (util/resolve-and-load-namespace nspace)
         symbols (map symbol (line-seq (BufferedReader. *in*)))]
-    (print (doc-lookup nspace symbols))
+    (print (backend/doc-lookup nspace symbols))
     (flush)))
 
 (defnail FindDoc

        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 %))]
                                  (or (fn? v)
                                      (instance? clojure.lang.MultiFn v)))
                               vars))

(defnail NamespaceInfo
  "Usage: ng de.kotka.vimclojure.nails.NamespaceInfo"
  []
  (println (util/clj->vim (map #(-> % symbol find-ns backend/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 (util/resolve-and-load-namespace nspace)
        expand (if one
                 #(macroexpand-1 %)
                 #(macroexpand %))]
    (binding [*ns* nspace]
      (doseq [expr (util/stream->seq *in*)]
        (-> expr expand util/pretty-print-code)))))

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