2015-07-18 17:05:45 -04:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
|
|
|
|
2018-01-10 17:50:02 -05:00
|
|
|
if exists('b:did_ftplugin')
|
2013-09-12 11:31:56 -04:00
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let b:did_ftplugin = 1
|
|
|
|
|
|
|
|
" Matchit support
|
2018-01-10 17:50:02 -05:00
|
|
|
if exists('loaded_matchit') && !exists('b:match_words')
|
2013-09-12 11:31:56 -04:00
|
|
|
let b:match_ignorecase = 0
|
|
|
|
|
2016-01-22 03:08:00 -05:00
|
|
|
let b:match_words = '\:\@<!\<\%(do\|fn\)\:\@!\>' .
|
2013-09-12 11:31:56 -04:00
|
|
|
\ ':' .
|
|
|
|
\ '\<\%(else\|elsif\|catch\|after\|rescue\)\:\@!\>' .
|
|
|
|
\ ':' .
|
|
|
|
\ '\:\@<!\<end\>' .
|
|
|
|
\ ',{:},\[:\],(:)'
|
|
|
|
endif
|
|
|
|
|
2017-05-17 05:07:28 -04:00
|
|
|
setlocal shiftwidth=2 softtabstop=2 expandtab iskeyword+=!,?
|
2013-09-12 11:31:56 -04:00
|
|
|
setlocal comments=:#
|
|
|
|
setlocal commentstring=#\ %s
|
2015-07-18 17:05:45 -04:00
|
|
|
|
2016-05-02 04:42:37 -04:00
|
|
|
let &l:path =
|
|
|
|
\ join([
|
2017-05-17 05:07:28 -04:00
|
|
|
\ 'lib',
|
|
|
|
\ 'src',
|
|
|
|
\ 'deps/**/lib',
|
|
|
|
\ 'deps/**/src',
|
2016-05-02 04:42:37 -04:00
|
|
|
\ &g:path
|
|
|
|
\ ], ',')
|
2017-05-17 05:07:28 -04:00
|
|
|
setlocal includeexpr=elixir#util#get_filename(v:fname)
|
2016-05-02 04:42:37 -04:00
|
|
|
setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl
|
|
|
|
|
2018-04-30 15:00:42 -04:00
|
|
|
let &l:define = 'def\(macro\|guard\|delegate\)\=p\='
|
2018-01-10 17:50:02 -05:00
|
|
|
|
|
|
|
silent! setlocal formatoptions-=t formatoptions+=croqlj
|
|
|
|
|
|
|
|
let b:block_begin = '\<\(do$\|fn\>\)'
|
|
|
|
let b:block_end = '\<end\>'
|
|
|
|
|
|
|
|
nnoremap <buffer> <silent> <expr> ]] ':silent keeppatterns /'.b:block_begin.'<CR>'
|
|
|
|
nnoremap <buffer> <silent> <expr> [[ ':silent keeppatterns ?'.b:block_begin.'<CR>'
|
|
|
|
nnoremap <buffer> <silent> <expr> ][ ':silent keeppatterns /'.b:block_end .'<CR>'
|
|
|
|
nnoremap <buffer> <silent> <expr> [] ':silent keeppatterns ?'.b:block_end .'<CR>'
|
|
|
|
|
|
|
|
onoremap <buffer> <silent> <expr> ]] ':silent keeppatterns /'.b:block_begin.'<CR>'
|
|
|
|
onoremap <buffer> <silent> <expr> [[ ':silent keeppatterns ?'.b:block_begin.'<CR>'
|
|
|
|
onoremap <buffer> <silent> <expr> ][ ':silent keeppatterns /'.b:block_end .'<CR>'
|
|
|
|
onoremap <buffer> <silent> <expr> [] ':silent keeppatterns ?'.b:block_end .'<CR>'
|
|
|
|
|
2016-07-05 03:53:49 -04:00
|
|
|
silent! setlocal formatoptions-=t formatoptions+=croqlj
|
2016-05-02 04:42:37 -04:00
|
|
|
|
2018-01-10 17:50:02 -05:00
|
|
|
let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< def<'.
|
|
|
|
\ '| unlet! b:match_ignorecase b:match_words b:block_begin b:block_end'
|
2017-05-17 05:07:28 -04:00
|
|
|
|
2015-07-18 17:05:45 -04:00
|
|
|
endif
|