I am trying to follow the instructions on the vim wiki to get a matchit plugin that works with ColdFusion files (* .cfm) containing ColdFusion and HTML tags that run on MacVim.
I have a syntax file for ColdFusion (cf.vim) set to $ HOME / .vim / syntax / cf.vim, the latest match version set to .vim / plugin / matchit.vim, ve added the following block at the end of the matchit end .vim:
au FileType html,jsp,php,cf if !exists("b:match_words") |
I also added the following line at the end of my $ HOME / .vimrc file:
filetype plugin on
Finally, I added the proposed block at the end of cf.vim:
" Only do this when not done yet for this buffer if exists("b:did_ftplugin") finish endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 if exists("loaded_matchit") let b:match_words = '<cfif\>.\{-}>\|<cfif\>.\{-}$:' \ . '<cfelseif\>.\{-}>\|<cfelseif\>.\{-}$:' \ . '<cfelse\>.\{-}>\|<cfelse\>.\{-}$:' \ . '<\/cfif>,' \ . '<cfloop\>.\{-}>\|<cfloop\>.\{-}$:' \ . '<\/cfloop\>.\{-}>,' \ . '<cfoutput\>.\{-}>\|<cfoutput\>.\{-}$:' \ . '<\/cfoutput\>.\{-}>,' \ . '<cftimer\>.\{-}>\|<cftimer\>.\{-}$:' \ . '<\/cftimer\>.\{-}>,' \ . ',' \ . '<cfquery\>.\{-}>\|<cfquery\>.\{-}$:<\/cfquery\>.\{-}>,' \ . '<cfscript>:<\/cfscript>' " Since we are counting things outside of comments only, " It is important we account comments accurately or match_words " will be wrong and therefore useless syntax sync fromstart endif " exists("loaded_matchit")
However, when I press the% key to jump to the corresponding tag, it only works halfway based on the file extension. If the file has the extension .cfm, I can go from <cfif> to </cfif> , but not from <body> to </body> , for example. The situation is canceled if the extension is .html.
However, looking at the code for cf.vim, it should work with ColdFusion and HTML tags mixed in one file:
" Inherit syntax rules from the standard HTML syntax file if version < 600 source <sfile>:p:h/html.vim else runtime! syntax/html.vim endif
In the corresponding note, I added:
let b:match_ignorecase = 1
up to $ HOME / .vimrc to disable case sensitivity as stated in the documentation, but it still only works with cfif, not CFIF.