Browse Source

Check for named-checkzone only when editing a bind zone file

Emmanuel Bouthenot 3 years ago
parent
commit
636b68bdd7
1 changed files with 8 additions and 8 deletions
  1. 8 8
      plugin/bindzone.vim

+ 8 - 8
plugin/bindzone.vim

@@ -1,28 +1,28 @@
 " File: bindzone.vim
 " Description: Edit Bind zones safely
 " Author: Emmanuel Bouthenot <kolter@openics.org>
-" Version: 0.2
-" Last Modified: November 30, 2014
+" Version: 0.3
+" Last Modified: May 15, 2020
 " License: WTFPLv2 (see http://sam.zoy.org/wtfpl/)
 " Changelog:
 "  0.1: Initial Release
 "  0.2: Make it compatible vim plugins managers
+"  0.3: Check for named-checkzone only when editing a bind zone file
 
 if exists("loadedBindZone")
     finish
 endif
 
-if !executable('named-checkzone')
-    echo "Error while loading bindzone.vim: unable to find 'named-checkzone' executable"
-    finish
-endif
-
 let loadedBindZone = 1
 
 autocmd FileType bindzone execute('call BindZoneApply()')
 
 function BindZoneApply()
-    autocmd BufWriteCmd <buffer> execute('call BindZoneChecker()')
+    if executable('named-checkzone')
+        autocmd BufWriteCmd <buffer> execute('call BindZoneChecker()')
+    else
+        echo "Error while loading bindzone.vim: unable to find 'named-checkzone' executable"
+    endif
 endfunction
 
 function BindUpdateSerial()