Skip to content

Commit

Permalink
Added check to make sure buffer is modifiable
Browse files Browse the repository at this point in the history
Check &modifiable before starting neoformat

Also added logging to cmd definition
  • Loading branch information
sbdchd committed Dec 5, 2016
1 parent 2860f18 commit b40081d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions autoload/neoformat.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ function! neoformat#Neoformat(user_formatter) abort
return neoformat#utils#warn('Neovim, or Vim with job control, is currently required to run this plugin')
endif

if !&modifiable
return neoformat#utils#warn('buffer not modifiable')
endif

if !empty(a:user_formatter)
let formatter = a:user_formatter
else
Expand Down Expand Up @@ -48,6 +52,8 @@ function! neoformat#Neoformat(user_formatter) abort
return neoformat#NextNeoformat()
endif

call neoformat#utils#log(cmd)

return neoformat#run#Neoformat(cmd)
endfunction

Expand Down

0 comments on commit b40081d

Please sign in to comment.