Fork me on GitHub
David Pham05:04:14

Is there an easy way to rename a namespace in a whole codebase? Say I had namespace foo.baz required everywhere and I want to rename it foo.baz2


clj-refactor has a command for that but it requires your entire project to be analyzed and loadable, usually I just go with something like ivy-occur and do a text-based search and replace


I just use projectile’s replace in project functionality.


slightly related: I think it would be nice to have a refactor to toggle between usage of a namespace alias and a refer


I’m not sure exactly what you mean, but you can file a ticket on clojure-mode issue tracker.


Say I have

(ns foo.core (:require [clojure.string :as str]))

(str/join ", " [1 2 3])
Calling "`cljr-toggle-refer`" or whatever its name would be with the mark on str/join would change our buffer to
(ns foo.core (:require [clojure.string :refer [join]]))

(join ", " [1 2 3])


Got it. Well, file a ticket please, and we’ll see if we’ll get to implementing this.