From b40081d07436c73c289e5433630ccef686177445 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Sun, 4 Dec 2016 21:40:01 -0500 Subject: [PATCH] Added check to make sure buffer is modifiable Check &modifiable before starting neoformat Also added logging to cmd definition --- autoload/neoformat.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoload/neoformat.vim b/autoload/neoformat.vim index 0b7449f7..8638f013 100644 --- a/autoload/neoformat.vim +++ b/autoload/neoformat.vim @@ -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 @@ -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