Background
Run SQL files using pgsql that were edited with gVim on Windows.
Problem
The BOM character causes syntax errors with pgsql. I would like to edit files using gVim and, when saved, no longer have a BOM character. If the file has the BOM character, then saving it keeps the BOM character, which is not desired.
Ideas
Changed the settings (Edit » Startup Settings) as follows:
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
au BufReadPre set nobomb
au BufReadPre setlocal nobomb
au BufReadPre setglobal nobomb
au BufReadPost set nobomb
au BufReadPost setlocal nobomb
au BufReadPost setglobal nobomb
au BufWritePre set nobomb
au BufWritePre setlocal nobomb
au BufWritePre setglobal nobomb
au BufWritePost set nobomb
au BufWritePost setlocal nobomb
au BufWritePost setglobal nobomb
set encoding=utf-8 nobomb " BOM often causes trouble
setlocal nobomb
setglobal nobomb
Didn't work. I still have to type :set nobomb to explicitly remove the BOM.
Question
How do you configure gVim so that the BOM is stripped immediately upon loading the file, without having to remember to type :set nobomb every time? (I want to set it and forget it.)
Thank you!
