This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-08
Channels
- # announcements (10)
- # babashka (4)
- # beginners (98)
- # cider (47)
- # clara (6)
- # clj-kondo (16)
- # clojure (54)
- # clojure-australia (3)
- # clojure-berlin (3)
- # clojure-czech (2)
- # clojure-europe (77)
- # clojure-nl (4)
- # clojure-uk (12)
- # clojuredesign-podcast (6)
- # clojurescript (10)
- # conjure (56)
- # cursive (3)
- # data-science (6)
- # datascript (8)
- # datomic (213)
- # depstar (5)
- # events (1)
- # figwheel-main (2)
- # fulcro (23)
- # graalvm (2)
- # jobs (3)
- # london-clojurians (1)
- # malli (30)
- # meander (15)
- # midje (1)
- # mount (5)
- # off-topic (18)
- # re-frame (4)
- # reitit (15)
- # remote-jobs (1)
- # shadow-cljs (23)
- # spacemacs (10)
- # specter (1)
- # tools-deps (88)
- # vim (16)
- # xtdb (1)
Started to use tpope/projectionist
which allows me to swap between src and test with a simple binding, for example, here is my .projections.json
configuration which lives at the root of the project
❯ cat .projections.json
{
"src/*.clj": {
"alternate": "test/{}_test.clj",
"type": "source"
},
"test/*_test.clj": {
"alternate": "src/{}.clj",
"type": "test"
}
}
Do I understand correctly that I need to add this configuration to every Clojure project I work with (I have lots).
Reading the vim-projectionist docs, it seems you can set it globally if a directory contains a file, using g:projectionist_heuristics
I wonder if that would work if we look for a deps.edn file in the root of a project, this could save putting a json file in every project.
If you try this approach, let me know if it works. Its on my very long neovim todo list :)
"
" Projections
"
autocmd User ProjectionistDetect
\ call projectionist#append(getcwd(),
\ {
\ 'src/*.clj': {
\ 'alternate': 'test/{}_test.clj',
\ 'type': 'source'
\ },
\ 'test/*_test.clj': {
\ 'alternate': 'src/{}.clj',
\ 'type': 'test'
\ },
\ })
bingo. only files of type clojure will have that applied, allowing projectionist to work as appropriate.
Excellent, thank you for sharing and improving my vim life
if one follows normal naming conventions, then swapping between your src file and the test file can be bound to a key, for example ,t
if ,
is your leader 🙂
Spacemacs uses SPC p a
for alternating between src and test in a project, so I would probably use that myself.