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

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

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

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

patricklewis opened this issue Aug 27, 2013 · 15 comments

Comments

@patricklewis
Copy link

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
Copy link

Same here.

@evantravers
Copy link

👍 Yep… same thing here.

@minad
Copy link
Member

minad commented Sep 3, 2013

Any idea why this happens or how to fix it?

@minad
Copy link
Member

minad commented Sep 3, 2013

I thought Vim uses only the extension for resolving the type

@evantravers
Copy link

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
This is the standard way to set the filetype, and allows syntax.vim to
set the correct syntax highlighting automatically.
@jacknagel
Copy link
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.

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

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
Copy link
Contributor

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

@waiting-for-dev
Copy link

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

autocmd BufNewFile,BufRead *.slim set ft=slim

@minad
Copy link
Member

minad commented Jan 3, 2014

@cram1010 Create a pull request?!

@waiting-for-dev
Copy link

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
Copy link
Member

minad commented Jan 3, 2014

It was meant more like an encouragement 😄

@waiting-for-dev
Copy link

great :)

@fb
Copy link
Contributor

fb commented Jan 7, 2014

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

@minad minad closed this as completed Jan 7, 2014
@waiting-for-dev
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants