From a4c03b38a5010a06a8f64114b56fe3b8b65276da Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sat, 14 Nov 2015 19:05:12 +0100 Subject: [PATCH] Add the possibility to turn off the automatic serial update. Some users may want to explicitly update the DNS serial number. Instead of forcing them to update on each write, a new configuration option is used so they can chose turn it off. --- README.md | 6 ++++++ ftplugin/bindzone.vim | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c5c8b1e..a910146 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,9 @@ I know this not the first vim plugin available to update a DNS-zone serial numbe * it lacks functionalities. It chose not to fork the original plugin but to write a new one from scratch mainly for legal purposes, but also because I did not found the code as simple as I expected. + + +Configuration +------------- + +You can turn off the automatic serial update by setting `let g:dnsserial_auto_update = 0` in your vimrc. diff --git a/ftplugin/bindzone.vim b/ftplugin/bindzone.vim index 7881921..8fb7aa6 100644 --- a/ftplugin/bindzone.vim +++ b/ftplugin/bindzone.vim @@ -13,7 +13,13 @@ " limitations under the License. -augroup dnsserial - autocmd! - autocmd BufWritePre DNSSerialUpdate -augroup END +if !exists('g:dnsserial_auto_update') + let g:dnsserial_auto_update = 1 +endif + +if g:dnsserial_auto_update + augroup dnsserial + autocmd! + autocmd BufWritePre DNSSerialUpdate + augroup END +endif