When I open a PHP file in Vim I want Vim to provide SQL assistance as well as all the PHP assistance.
From :h sql-completion-filetypes
:
This can be enabled easily with the following steps (assuming a Perl file):
1. :e test.pl 2. :set filetype=sql 3. :set ft=perl
I would like to automate this: So far I have tried
Appending the following commands to ~/.vim/after/ftplugins/php.vim
:set filetype=sql
:set ft=php
This throws errors like
Error detected while processing FileType Auto commands for "*":
E218: autocommand nesting too deep
Which I'm assuming is happening because when whenever the set ft=php
command is run - it then re-triggers the ~/.vim/after/ftplugins/php.vim
script which then re-triggers the set ft=php
statement.
Is it possible to automate running these commands :set filetype=sql
, :set ft=php
when opening a php file?
setf sql.php
to set multiple filetypes on a file. To automate this:autocmd FileType php setf sql.php