Skip to content

Commit 12d3307

Browse files
committed
Add basic projectionist support
1 parent 0a847f0 commit 12d3307

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ftplugin/elixir.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,19 @@ silent! setlocal formatoptions-=t formatoptions+=croqlj
5151

5252
let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< def<'.
5353
\ '| unlet! b:match_ignorecase b:match_words b:block_begin b:block_end'
54+
55+
function s:projectionist_detect_elixir()
56+
if filereadable('mix.exs')
57+
let root = simplify(fnamemodify('.', ':p:s?[\/]$??'))
58+
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
68+
69+
autocmd User ProjectionistDetect call s:projectionist_detect_elixir()

0 commit comments

Comments
 (0)