-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding g:parinfer_mode - adding airline support for mode
- Loading branch information
Case Nelson
committed
Dec 19, 2015
1 parent
ab1f02c
commit 14463f6
Showing
1 changed file
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <buffer> | ||
\ :let lines = ParinferIndent("enter") | if !empty(lines) | call setline(1,lines) | endif | unlet lines | ||
\ :autocmd! ClojureParinfer BufEnter <buffer> | ||
\ :call <SID>indent() | ||
|
||
autocmd FileType clojure | ||
\ :autocmd! TextChanged,TextChangedI <buffer> | ||
\ :try | silent undojoin | catch | endtry | let lines = ParinferIndent("changed") | if !empty(lines) | call setline(1,lines) | endif | unlet lines | ||
\ :autocmd! ClojureParinfer TextChanged,TextChangedI <buffer> | ||
\ :call <SID>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 |