set filetype changes the way a vim file is processed by invoking all FileType autocommands. This is not saved. If you want to always open this file with filetype=apache , try adding it to your .vimrc :
au BufRead,BufNewFile /etc/apache2/sites-available/www.example.com set filetype=apache
You can learn more about this in:
:help 'filetype' :help filetypes :help :autocmd :help .vimrc
EDIT: as found in my /usr/share/vim/vim73/filetype.vim :
au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache')
s:StarSetf will be setfiletype before apache if the file type does not match the ignored template. On my system :echo g:ft_ignore_pat will only show archive file extensions as ignored. setfiletype does set filetype , but only once.
So, at least on my system the template */etc/apache2/sites-*/* will catch your file name and make it apache .
source share