Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Add support for configuring custom filetypes #1020

Closed
vjsingh opened this issue Mar 5, 2014 · 6 comments
Closed

Add support for configuring custom filetypes #1020

vjsingh opened this issue Mar 5, 2014 · 6 comments

Comments

@vjsingh
Copy link

vjsingh commented Mar 5, 2014

Say I have a new filetype I'm defining for my project that is .jays, which is very similar to a javascript (.js) file but slightly different.

As far as I can tell there is no way to tell Syntastic to run my javascript checker on .jays files. Unless there is in fact a way and I missed it, could we add support for this?

@lcd047
Copy link
Collaborator

lcd047 commented Mar 6, 2014

There is in fact a way, and you missed it. :) You might do something like this:

augroup filetype
    autocmd! BufRead,BufNewFile  *.jays  set filetype=jays
augroup END
let g:syntastic_filetype_map = { "jays": "javascript" }

@vjsingh
Copy link
Author

vjsingh commented Mar 6, 2014

Thanks for the help, but this doesn't seem to be working.

This is everything I have in my .vimrc for Syntastic (note that the extension is actually .template):

 17 let g:syntastic_filetype_map = { "template": "javascript" }
 18 " Enable syntastic checker for JS
 19 let g:syntastic_check_on_open=1
 20 let g:syntastic_enable_highlighting=1
 21 let g:syntastic_javascript_checkers=['gjslint']
 22 let g:syntastic_enable_signs=1
 23 let g:syntastic_auto_jump=0
 24 let g:syntastic_stl_format='[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
 25 let g:syntastic_mode_map = { 'mode': 'active',
 26                            \ 'active_filetypes': ['js', 'html', 'template'],
 27                            \ 'passive_filetypes': ['java'] }
 28
 29 " Enable JS syntax for .template
 30 augroup filetype
 31   autocmd! BufRead,BufNewFile  *.template  set filetype=template
 32 augroup END

@lcd047
Copy link
Collaborator

lcd047 commented Mar 6, 2014

Please define "doesn't seem to be working". What did you do, what did you expect to happen, and what happened instead?

@vjsingh
Copy link
Author

vjsingh commented Mar 6, 2014

Sorry. Opened a file with a ".template" extension in vim, and another file with a ".js" extension in vim (with the .vimrc shown above -- I copied and pasted that wrong, the first line (# 17) should actually be at the bottom, on line # 33. Sorry).

I expected to see syntax highlighting in both, but I only see syntax highlighting in the .js file.

@lcd047
Copy link
Collaborator

lcd047 commented Mar 6, 2014

You are confused. Syntastic doesn't have anything to do with syntax highlighting (not in the sense you mean it anyway).

@lcd047 lcd047 closed this as completed Mar 6, 2014
@vjsingh
Copy link
Author

vjsingh commented Mar 6, 2014

I can confirm that I am in fact a very confused little boy.

This was all I needed:

au BufRead,BufNewFile *.template set filetype=javascript

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

No branches or pull requests

2 participants