Skip to content

Instantly share code, notes, and snippets.

@glensc
Created May 13, 2014 18:25
Show Gist options
  • Save glensc/edf3fb61109ac7383784 to your computer and use it in GitHub Desktop.
Save glensc/edf3fb61109ac7383784 to your computer and use it in GitHub Desktop.
vim script to prevent edits to Chef generated files

copy noedit.vim to $VIMRUNTIME/plugin/noedit.vim or just include in your ~/.vimrc file

" prevent edits of Chef generated files
au BufReadPost /etc/** if join(getline(1,10), "\n") =~? 'Generated by Chef' | setl nomodifiable readonly | endif
" vim:ft=vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment