Fork me on GitHub
#vim
<
2021-09-28
>
emilaasa13:09:49

Is there a plugin that creates the "alternate file" (creates the test file) according to clojure namespace rules?

walterl14:09:33

❯ cat .projections.json 
{
  "src/*.clj": {
    "alternate": "test/{}_test.clj",
    "type": "source"
  },
  "test/*_test.clj": {
    "alternate": "src/{}.clj",
    "type": "test"
  }
}

emilaasa14:09:58

Ah yes that's the one! 🙂 Thanks!

emilaasa14:09:35

I wonder how much time this will save me in the long run 😛

walterl14:09:31

I use :AV/`:AS`/`:AT` daily. It definitely lessens cognitive load. 💪 🧠

1
emilaasa15:09:12

Works real nice, thanks for the help 🙂

👍 1
dharrigan15:09:10

Yup, I use projectionist too. Tis wunderbar!

Guilherme Dallanol14:10:00

Is there a way of declaring this inside a *.vim file? I don't want to create one .projections.json file per project/ 😕

Guilherme Dallanol14:10:41

let g:projectionist_heuristics = {
      \   "src/*.clj": {
      \     "alternate": "test/unit/{}_test.clj",
      \     "type": "source"
      \   },
      \   "test/unit/*_test.clj": {
      \     "alternate": "src/{}.clj",
      \     "type": "test"
      \   }
      \ }
but I think I'm missing something

Guilherme Dallanol14:10:15

oh, nevermind, I got it!

Guilherme Dallanol14:10:27

let g:projectionist_heuristics = {
      \   "*": {
      \     "src/*.clj": {
      \       "alternate": "test/unit/{}_test.clj",
      \       "type": "source"
      \     },
      \     "test/unit/*_test.clj": {
      \       "alternate": "src/{}.clj",
      \       "type": "test"
      \     }
      \   }
      \ }

🎉 1
walterl21:10:45

I was wondering about this too, but never got around to checking. Thanks for doing the leg work, @U02FG8J02TF 🎉

💯 1