From 14463f605c00f366091d217dfce00db4579a8417 Mon Sep 17 00:00:00 2001 From: Case Nelson Date: Fri, 18 Dec 2015 20:52:33 -0700 Subject: [PATCH] adding g:parinfer_mode - adding airline support for mode --- plugin/parinfer.vim | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/plugin/parinfer.vim b/plugin/parinfer.vim index e162577..ae0e859 100644 --- a/plugin/parinfer.vim +++ b/plugin/parinfer.vim @@ -1,9 +1,34 @@ +let g:parinfer_mode = "indent" + +function! s:indent() + if has('nvim') && g:parinfer_mode != "off" + try + silent undojoin + catch + endtry + let l:lines = ParinferIndent("changed") + if !empty(lines) + call setline(1,lines) + endif + endif +endfunction + augroup ClojureParinfer autocmd FileType clojure - \ :autocmd! ClojureParinfer BufEnter - \ :let lines = ParinferIndent("enter") | if !empty(lines) | call setline(1,lines) | endif | unlet lines + \ :autocmd! ClojureParinfer BufEnter + \ :call indent() autocmd FileType clojure - \ :autocmd! TextChanged,TextChangedI - \ :try | silent undojoin | catch | endtry | let lines = ParinferIndent("changed") | if !empty(lines) | call setline(1,lines) | endif | unlet lines + \ :autocmd! ClojureParinfer TextChanged,TextChangedI + \ :call indent() augroup END + +if (exists('g:loaded_airline') && g:loaded_airline) + function! ParinferAirline(...) + if &filetype == "clojure" + let w:airline_section_a = g:airline_section_a . ' %{g:parinfer_mode}' + endif + endfunction + + call airline#add_statusline_func('ParinferAirline') +endif