Skip to content

Commit

Permalink
[bugfix] Resolving an annoying warning on write
Browse files Browse the repository at this point in the history
  • Loading branch information
venantius committed Nov 9, 2015
1 parent e302d0e commit 3ebfe3c
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions plugin/cljfmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,11 @@ function! s:GetFormattedFile()
return s:FilterOutput(split(l:cljfmt_output, "\n"))
endfunction

function! s:DeclareCurrentNS()
let ns = fireplace#ns()
let cmd = "(ns " . ns . ")"
call fireplace#session_eval(cmd)
endfunction

function! cljfmt#Format()
if !g:clj_fmt_required
let g:clj_fmt_required = s:RequireCljfmt()
endif

try
call s:DeclareCurrentNS()
catch /.*/
return 0
endtry

" If cljfmt.core has already been required, or was successfully imported
" above
if g:clj_fmt_required
Expand All @@ -94,18 +82,18 @@ function! cljfmt#Format()
endfunction

function! cljfmt#AutoFormat()
silent! write
if expand('%:t') != "project.clj" && expand('%:t') != "profiles.clj"
call cljfmt#Format()
endif
silent! write
endfunction

augroup vim-cljfmt
autocmd!

" code formatting on save
if get(g:, "clj_fmt_autosave", 1)
autocmd BufWritePost *.clj call cljfmt#AutoFormat()
autocmd BufWritePre *.clj call cljfmt#AutoFormat()
endif
augroup END

Expand Down

0 comments on commit 3ebfe3c

Please sign in to comment.