Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matching filetypes with a dot in the name #48

Open
selimober opened this issue Nov 21, 2015 · 6 comments
Open

matching filetypes with a dot in the name #48

selimober opened this issue Nov 21, 2015 · 6 comments

Comments

@selimober
Copy link

I want to use the plugin with javascript files, jsx in fact.
I'm using https://github.com/mxw/vim-jsx plugin which sets the filetype of *.js files to:

:set ft?
filetype=javascript.jsx

I've tried to copy html.vim under ~/.vim/plugged/xmledit/ftplugin to javascript.vim, javascript.jsx.vim, javascriptjsx.vim and jsx.vim to no avail.

Otherwise the plugin works on html and xml without a problem.

@marlun
Copy link
Collaborator

marlun commented Nov 24, 2015

I was also thinking about wanting this to work. Maybe there's something @mxw could do to help with this too?

@mxw
Copy link

mxw commented Nov 25, 2015

@selimober—Is the issue that your .vim file simply isn't being loaded, or that it doesn't work with JSX's embedded XML? You should be able to test the former by adding an :echo or an :echom somewhere in the ftplugin file. (I would be surprised if this were the case... if you have an ftplugin/javascript.vim file, it should work for all JS and JSX files.)

If it's just that your plugin itself doesn't support JSX, I'm not sure how I can help you short of hacking on your plugin.

@selimober
Copy link
Author

@mxw — Thanks for helping. The plugin I mentioned is in fact a JSX plugin. So it does support JSX.

1- I did put an :echo "xmledt running... on ftplugin/javascript.vim file as you instructed. If I disable the jsx plugin, thus the filetype stays as javascript, I see the output of :echo. But not when the jsx plugin enabled, i.e. when the file type is javascript.jsx

2- Now, even with the jsx plugin disabled, and "xmledit running..." message displayed, tags are not automatically closed in javascript files, I mean when I close <p with >, it doesn't turn into a <p></p> just like editing an html file with xmledit.

Thanks for trying to help anyways..

@mxw
Copy link

mxw commented Nov 26, 2015

That behavior is inconsistent with how vim is supposed to behave... when you set a filetype to be foo.bar.baz, then ftplugin/foo.vim, ftplugin/bar.vim, and ftplugin/baz.vim should all get run, and this is the behavior I see...

@sukima
Copy link
Owner

sukima commented Dec 3, 2015

say wha?

You can bundle filetypes with a dot?! I had no idea you could to that. I thought you needed one filetype and that's it. Hence why this repo suggests creating a symlink to each filetype you want it enable for.

@mxw
Copy link

mxw commented Dec 3, 2015

Yeah—Unless this package does some weird and narrow filetype-matching, in principle, you can incorporate the syntax, indent, and ftplugin files for any number of filetypes by just setting an aggregate filetype. (I don't see this documented anywhere in vim's help files, but it definitely works, and there are a few StackOverflow questions about it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants