Fork me on GitHub
#spacemacs
<
2022-04-21
>
Martynas Maciulevičius05:04:43

Hey. Is there a way to change the default template for a file type? When I create a clojure _test.clj file I always get this content:

(ns my-ns.util-test
  (:require [my-ns.util :as sut]
            [clojure.test :as t]))
And the only thing that I change EVERY time is this line: [clojure.test :as t] -> [clojure.test :refer :all] This is what I do in every test source file that I create. Is it possible to change the template? I was trying to find it in .emacs.d but I couldn't find it. How do I do it?

Martynas Maciulevičius05:04:17

Found it. Need to add this to config:

(defcustom cljr-clojure-test-declaration "[clojure.test :refer :all]"
    "The require form to use when clojure.test is in use in a clj file."
    :type 'string
    :safe #'stringp)
  (defcustom cljr-cljs-clojure-test-declaration "[cljs.test :refer :all :include-macros true]"
    "The require form to use when cljs.test is in use in a cljs file."
    :type 'string
    :safe #'stringp)