Skip to main content
added 91 characters in body
Source Link
muru
  • 25.1k
  • 8
  • 83
  • 144

When I open a PHP file in Vim I want vimVim to provide SQL assistance as well as all the PHP assistance.
From :h sql-completion-filetypes: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

1.  :e test.pl  
2.  :set filetype=sql  
3.  :set ft=perl

I would like to automate this: So far I have tried

appendingAppending 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

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?

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?

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?

edited title
Link
the_velour_fog
  • 3.4k
  • 3
  • 23
  • 40

Automating Automate running SQL filetype scripts when enteringopening a PHP file

Source Link
the_velour_fog
  • 3.4k
  • 3
  • 23
  • 40

Automating running SQL filetype scripts when entering a PHP file

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?