@@ -52,18 +52,52 @@ silent! setlocal formatoptions-=t formatoptions+=croqlj
52
52
let b: undo_ftplugin = ' setlocal sw< sts< et< isk< com< cms< path< inex< sua< def<' .
53
53
\ ' | unlet! b:match_ignorecase b:match_words b:block_begin b:block_end'
54
54
55
- function s: projectionist_detect_elixir ()
56
- if filereadable (' mix.exs' )
57
- let root = simplify (fnamemodify (' .' , ' :p:s?[\/]$??' ))
55
+ if get (g: , ' loaded_projectionist' , 0 )
56
+ let g: projectionist_heuristics = get (g: , ' projectionist_heuristics' , {})
58
57
59
- let projections = {}
60
- let projections[' lib/*.ex' ] = { ' type' : ' main' , ' alternate' : [' test/{}_test.exs' ] }
61
- let projections[' lib/**/*.ex' ] = { ' type' : ' main' , ' alternate' : [' test/{}_test.exs' ] }
62
- let projections[' test/*_test.exs' ] = { ' type' : ' test' , ' alternate' : [' lib/{}.ex' ] }
63
- let projections[' test/**/*_test.exs' ] = { ' type' : ' test' , ' alternate' : [' lib/{}.ex' ] }
64
-
65
- call projectionist#append (root, projections)
66
- endif
67
- endfunc
58
+ call extend (g: projectionist_heuristics , {
59
+ \ " &mix.exs" :
60
+ \ {
61
+ \ ' apps/*/mix.exs' : { ' type' : ' app' },
62
+ \ ' lib/*.ex' : {
63
+ \ ' type' : ' lib' ,
64
+ \ ' alternate' : ' test/{}_test.exs' ,
65
+ \ ' template' : [
66
+ \ ' defmodule {camelcase|capitalize|dot} do' ,
67
+ \ ' end'
68
+ \ ],
69
+ \ },
70
+ \ ' test/*_test.exs' : {
71
+ \ ' type' : ' test' ,
72
+ \ ' alternate' : ' lib/{}.ex' ,
73
+ \ ' dispatch' : " mix test test/{}_test.exs`=v:lnum ? ':'.v:lnum : ''`" ,
74
+ \ ' template' : [
75
+ \ ' defmodule {camelcase|capitalize|dot}Test do' ,
76
+ \ ' use ExUnit.Case' ,
77
+ \ ' ' ,
78
+ \ ' alias {camelcase|capitalize|dot}, as: Subject' ,
79
+ \ ' ' ,
80
+ \ ' doctest Subject' ,
81
+ \ ' end'
82
+ \ ],
83
+ \ },
84
+ \ ' mix.exs' : { ' type' : ' mix' },
85
+ \ ' config/*.exs' : { ' type' : ' config' },
86
+ \ ' *.ex' : {
87
+ \ ' makery' : {
88
+ \ ' lint' : { ' compiler' : ' credo' },
89
+ \ ' test' : { ' compiler' : ' exunit' },
90
+ \ ' build' : { ' compiler' : ' mix' }
91
+ \ }
92
+ \ },
93
+ \ ' *.exs' : {
94
+ \ ' makery' : {
95
+ \ ' lint' : { ' compiler' : ' credo' },
96
+ \ ' test' : { ' compiler' : ' exunit' },
97
+ \ ' build' : { ' compiler' : ' mix' }
98
+ \ }
99
+ \ }
100
+ \ }
101
+ \ })
102
+ endif
68
103
69
- autocmd User ProjectionistDetect call s: projectionist_detect_elixir ()
0 commit comments