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

Append to vader_types filetypes or support any filetype. #14

Closed
cirosantilli opened this Issue Sep 7, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@cirosantilli
Contributor

cirosantilli commented Sep 7, 2014

I want to add a new filetype to the existing supported list without removing the default ones. E.g., if I add:

let g:vader_types = ['mkd']

Then the only ft recognized will be 'mkd', which is not cool since someone can be developing in multiple languages.

Is there a way to do that?

Of course,

let g:vader_types += ['mkd']

does not work because it is not defined to start with.

One possible solution would be to try and load any filetype as it is typed, and only change the syntax of the block if some syntax if found.

junegunn added a commit that referenced this issue Sep 7, 2014

@junegunn

This comment has been minimized.

Owner

junegunn commented Sep 7, 2014

Yeah, it's something that has been bothering me. I particularly didn't like the fact that Vader has a hard-coded, predefined set of filetypes that are unconditionally loaded even when they are not used. So I updated Vader to analyze the content of the buffer and load the syntaxes that are only referred to. And as you suggested, it will now dynamically load syntaxes as you type in insert mode. It will add slight overhead to the editing, but I believe it won't be noticeable. Let me know if it's not the case. Since Vader only detects changes in insert mode (using TextChangedI or CursorMovedI) it is possible that it misses to load the syntax file when the block headers are changed in non-insert mode. In that case, you can make Vader reprocess the buffer with :e or :setf vader. Notice that the use of g:vader_types is now removed.

Please update and let me know if it works for you.

@junegunn junegunn added the enhancement label Sep 7, 2014

@cirosantilli

This comment has been minimized.

Contributor

cirosantilli commented Sep 7, 2014

Appears to be working correctly, even highlights the ft only for known filetypes! Thanks for such as quick fix. Closing as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment