mxw / vim-jsx

React JSX syntax highlighting and indenting for vim.
1.59k stars 95 forks source link

Remove /after directory #30

Closed lencioni closed 9 years ago

lencioni commented 9 years ago

People currently cannot to use this plugin for things like syntax highlighting and indentation along with a local ftdetect for JSX files because the ftdetect in this plugin is nested in the /after directory, causing it to run after the local one.

This commit addresses this by un-nesting the files from the /after directory. Incidentally, this is the structure that other similar plugins, such as vim-javascript 1, use.

With this change, I removed the manual installation instructions from the readme since they no longer made sense and updating them to make sense seemed like more effort than it was worth for the benefit. I assume that people who are manually installing Vim plugins will know how to do that in this case.

Fixes #29.

mxw commented 9 years ago

This needs to be in an after/ directory to guarantee that it is loaded after the vim-javascript dependency, regardless of how people choose to include or order that bundle. To override things in the vim-jsx ftdetect, just make an after/ftdetect.vim or an after/ftdetect/javascript.vim.

lencioni commented 9 years ago

What specifically do you need from vim-javascript and do you think that would be resolved by #31?

mxw commented 9 years ago

The default JS highlighting that ships with vim is extremely minimal. I use the syntax regions defined by vim-javascript to handle the JS/XML syntax nesting.

lencioni commented 9 years ago

It seems like the ftdetect and ftplugin don't really need to be in after in that case. Would you be open to moving those out of after?

bigsley commented 9 years ago

I'm running into this right now and moving ftdetect & ftplugin out of after would help me.

mxw commented 9 years ago

@bigsley—What problem are you having, exactly? As a general rule, I think if you depend on some bundle/plugin script being loaded, you should put your local script in the appropriate after/ subdirectory.

lencioni commented 9 years ago

@mxw I'd guess it is likely the same issue that I've been running into, which appears to be specifically the ftdetect file in this plugin clobbering my ftdetect file for JSX. This is not a dependency of this plugin, rather it is avoiding an unwanted side-effect of including this plugin.

On closer inspection, moving this plugin's ftdetect outside of after still doesn't seem to resolve the issue (even though it seems like a more appropriate location). In the end, it looks like I'll need to keep my JSX ftdetect in an after directory, away from all of my other ftdetect files, if I want to continue to use vim-jsx.

mxw commented 9 years ago

@lencioni—As I've said, it's generally true that if you depend on a plugin or bundle to supply you functionality, any alterations you make to that functionality should be placed in your after/ directory. Pathogen, at least, will run your local scripts, then all plugin scripts (in some order—alphabetical currently, but this is probably not an end-user guarantee), then all plugin after/ scripts, then your after/ scripts. This gives plugin authors two "priorities" for scripts—alongside most things, or after most things—and it gives you the user two priorities as well: before everything, and after everything.

If you use a plugin for a given language or feature, if you want to override something (as opposed to toggling g:variables that the plugin exposes, e.g.), it should be in your after/ directory.