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

Vim sets filetype to HTML (not Slim) when using 'doctype html' #38

Closed
patricklewis opened this Issue Aug 27, 2013 · 15 comments

Comments

Projects
None yet
8 participants
@patricklewis

patricklewis commented Aug 27, 2013

I was editing my Rails application layout file in Vim 7.3 with this vim-slim plugin installed and noticed that Vim was using a filetype of HTML instead of Slim for my application.html.slim file and not providing syntax highlighting.

My other views that followed the *.html.slim naming convention were correctly using the Slim filetype and syntax.

The culprit seemed to be the first line of the file, which was doctype html. I changed it to the equivalent doctype 5 and now Vim correctly sets the filetype to Slim for this file.

@clemensg

This comment has been minimized.

Show comment
Hide comment
@clemensg

clemensg Aug 29, 2013

Same here.

clemensg commented Aug 29, 2013

Same here.

@evantravers

This comment has been minimized.

Show comment
Hide comment
@evantravers

evantravers Sep 3, 2013

👍 Yep… same thing here.

evantravers commented Sep 3, 2013

👍 Yep… same thing here.

@minad

This comment has been minimized.

Show comment
Hide comment
@minad

minad Sep 3, 2013

Contributor

Any idea why this happens or how to fix it?

Contributor

minad commented Sep 3, 2013

Any idea why this happens or how to fix it?

@minad

This comment has been minimized.

Show comment
Hide comment
@minad

minad Sep 3, 2013

Contributor

I thought Vim uses only the extension for resolving the type

Contributor

minad commented Sep 3, 2013

I thought Vim uses only the extension for resolving the type

@evantravers

This comment has been minimized.

Show comment
Hide comment
@evantravers

evantravers Sep 4, 2013

This is the change that broke it for me… 1e4e488#commitcomment-3871242

When I revert it, it works just fine. Good catch on the doctype thing though… now we just need to figure out why.

evantravers commented Sep 4, 2013

This is the change that broke it for me… 1e4e488#commitcomment-3871242

When I revert it, it works just fine. Good catch on the doctype thing though… now we just need to figure out why.

minad referenced this issue Sep 4, 2013

Use setfiletype
This is the standard way to set the filetype, and allows syntax.vim to
set the correct syntax highlighting automatically.
@jacknagel

This comment has been minimized.

Show comment
Hide comment
@jacknagel

jacknagel Sep 4, 2013

Contributor

1e4e488 should be reverted.

Vim's filetype.vim has an autocmd that tries to detect html files based on doctype and this is triggered before scripts in ftdetect/* are sourced. IMO that seems wrong, but what can you do I guess.

Sorry for the hassle everyone.

Contributor

jacknagel commented Sep 4, 2013

1e4e488 should be reverted.

Vim's filetype.vim has an autocmd that tries to detect html files based on doctype and this is triggered before scripts in ftdetect/* are sourced. IMO that seems wrong, but what can you do I guess.

Sorry for the hassle everyone.

djbender pushed a commit to djbender/vim-slim that referenced this issue Sep 15, 2013

@suan

This comment has been minimized.

Show comment
Hide comment
@suan

suan Dec 2, 2013

@jacknagel Has it really been reverted? I still see the code in master and am getting the issue in a fresh clone

suan commented Dec 2, 2013

@jacknagel Has it really been reverted? I still see the code in master and am getting the issue in a fresh clone

@jacknagel

This comment has been minimized.

Show comment
Hide comment
@jacknagel

jacknagel Dec 2, 2013

Contributor

I don't think so. I don't have commit access to this repo, though.

Contributor

jacknagel commented Dec 2, 2013

I don't think so. I don't have commit access to this repo, though.

@waiting-for-dev

This comment has been minimized.

Show comment
Hide comment
@waiting-for-dev

waiting-for-dev Jan 3, 2014

Very annoying indeed. Until fixed (although this repo seems quite dead...) I use in .vimrc:

autocmd BufNewFile,BufRead *.slim set ft=slim

waiting-for-dev commented Jan 3, 2014

Very annoying indeed. Until fixed (although this repo seems quite dead...) I use in .vimrc:

autocmd BufNewFile,BufRead *.slim set ft=slim
@minad

This comment has been minimized.

Show comment
Hide comment
@minad

minad Jan 3, 2014

Contributor

@cram1010 Create a pull request?!

Contributor

minad commented Jan 3, 2014

@cram1010 Create a pull request?!

@waiting-for-dev

This comment has been minimized.

Show comment
Hide comment
@waiting-for-dev

waiting-for-dev Jan 3, 2014

yeah... it would be great if I had the time... Maybe did my comment sound like a criticism? No my intention, it was just an ascertainment. I understand it is difficult to find the time to maintain a project, like I find difficult to find the time to prepare the pull request...

waiting-for-dev commented Jan 3, 2014

yeah... it would be great if I had the time... Maybe did my comment sound like a criticism? No my intention, it was just an ascertainment. I understand it is difficult to find the time to maintain a project, like I find difficult to find the time to prepare the pull request...

@minad

This comment has been minimized.

Show comment
Hide comment
@minad

minad Jan 3, 2014

Contributor

It was meant more like an encouragement 😄

Contributor

minad commented Jan 3, 2014

It was meant more like an encouragement 😄

@waiting-for-dev

This comment has been minimized.

Show comment
Hide comment
@waiting-for-dev

waiting-for-dev commented Jan 4, 2014

great :)

@fb

This comment has been minimized.

Show comment
Hide comment
@fb

fb Jan 7, 2014

Contributor

f8180ad which is merged in master fixes this issue for me.

Contributor

fb commented Jan 7, 2014

f8180ad which is merged in master fixes this issue for me.

@minad minad closed this Jan 7, 2014

@waiting-for-dev

This comment has been minimized.

Show comment
Hide comment
@waiting-for-dev

waiting-for-dev Jan 7, 2014

I updated the plugin and now it works for me, too. Thanks!!

waiting-for-dev commented Jan 7, 2014

I updated the plugin and now it works for me, too. Thanks!!

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