pangloss/vim-javascript — Issue #32: setlocal iskeyword+=$ applied to php filetypes
Author: connrs
Created: 2011-10-19 09:32:59+00:00
State: open

My knowledge of plugin development is limited but I've tried to work a solution out before posting this issue:

After digging around, I've discovered that Vim, by default, sources syntax/html.vim which, by default, sources syntax/javascript.vim when you edit a PHP document. This isn't actually a problem except for [line 28 of syntax/javascript.vim](https://github.com/pangloss/vim-javascript/blob/master/syntax/javascript.vim#L28): `setlocal iskeyword+=$`

This messes with my workflow when I'm coding as my muscle memory sees $ differently depending on whether I'm working on Javascript or PHP. I tried to figure out a way of fixing the issue and I think I got it to work. I removed `setlocal iskeyword+=$` from syntax/javascript.vim and moved it to a new file ftplugin/javascript.vim based on a recommendation from freenode#vim.

This worked for me when I tested a JS file and a PHP file but when editing JS in an HTML file, it doesn't. While I don't tend to work with JS that is inline in HTML, I can understand that others may possibly want to. To work around this, I duplicated ftplugin/javascript.vim to ftplugin/html.vim and the functionality was restored when editing JS within HTML.

I do have a local clone with my changes applied that I can push to Github for you to check out and test; I don't know if it's too trivial for you to verify based upon my explanation above. When I get some spare time at the office, I can push it up and either leave a link here or just do a pull request.