From 58709c49f6b6ede81dcf87752b09b8f64d84f1fc Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 10 Jan 2018 23:50:02 +0100 Subject: Update --- ftplugin/elixir.vim | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'ftplugin/elixir.vim') diff --git a/ftplugin/elixir.vim b/ftplugin/elixir.vim index 651cfba6..7219cb95 100644 --- a/ftplugin/elixir.vim +++ b/ftplugin/elixir.vim @@ -1,12 +1,12 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1 -if (exists("b:did_ftplugin")) +if exists('b:did_ftplugin') finish endif let b:did_ftplugin = 1 " Matchit support -if exists("loaded_matchit") && !exists("b:match_words") +if exists('loaded_matchit') && !exists('b:match_words') let b:match_ignorecase = 0 let b:match_words = '\:\@' . @@ -32,9 +32,26 @@ let &l:path = setlocal includeexpr=elixir#util#get_filename(v:fname) setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl +let &l:define = 'def\(macro|guard|delegate\)p' + +silent! setlocal formatoptions-=t formatoptions+=croqlj + +let b:block_begin = '\<\(do$\|fn\>\)' +let b:block_end = '\' + +nnoremap ]] ':silent keeppatterns /'.b:block_begin.'' +nnoremap [[ ':silent keeppatterns ?'.b:block_begin.'' +nnoremap ][ ':silent keeppatterns /'.b:block_end .'' +nnoremap [] ':silent keeppatterns ?'.b:block_end .'' + +onoremap ]] ':silent keeppatterns /'.b:block_begin.'' +onoremap [[ ':silent keeppatterns ?'.b:block_begin.'' +onoremap ][ ':silent keeppatterns /'.b:block_end .'' +onoremap [] ':silent keeppatterns ?'.b:block_end .'' + silent! setlocal formatoptions-=t formatoptions+=croqlj -let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< '. - \ '| unlet! b:match_ignorecase b:match_words' +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' endif -- cgit v1.2.3