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

Add support for django-plus.vim #730

Merged
merged 1 commit into from
Aug 5, 2016
Merged

Conversation

tweekmonster
Copy link
Contributor

Hi! I created a plugin called django-plus.vim and would like UltiSnips to work with it since Django is an exceptional case in Vim.

The django filetype is considered a text template in Vim. But, for users to easily enable the Django snippets in Python scripts, the python.django filetype can be used. This causes some problems since plugins might not consider the dotted filetype, and filetypes like markdown.django or yaml.django (or even python.django) should actually be including htmldjango.snippets.

The other problem is that using :UltisnipsEdit without arguments, one would expect django.snippets to be loaded, but python.snippets is loaded instead. The filetype would need to be django.python, but will break syntax highlighting in Python scripts.

django-plus.vim reliably detects files in a Django project and sets b:is_django and leaves the filetype alone. I attempted to manually call UltiSnips#FileTypeChanged() and UltiSnipsAddFiletypes django in an after/ftplugin scripts, but that isn't reliable since other plugins can re-set filetype.

This shouldn't affect anyone who doesn't have django-plus.vim installed. If there's a better way to do this, let me know.

@seletskiy
Copy link
Collaborator

@tweekmonster: I doubt that UltiSnips should have any 3-rd party plugin code.

Did you tried to register autocmd FileType * <your-code-that-register-filetype-in-ultisnips>?

@tweekmonster
Copy link
Contributor Author

I doubt that UltiSnips should have any 3-rd party plugin code.

I don't disagree with you. I think I took the wrong approach because it was late. It might be better if UltiSnips#FileTypeChanged() allowed the filetype to be passed in instead.

I updated the PR. If you think that's reasonable, you can change the PR title to match the commit message so it makes sense.

@seletskiy seletskiy merged commit b4c7a57 into SirVer:master Aug 5, 2016
@seletskiy
Copy link
Collaborator

@tweekmonster: Yep, that's much more reasonable! Thanks!

@tweekmonster
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants