You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
According to vim docs, I believe we should use setf (gonna change that back in my PR or will close PR completely -- gonna check who sets ft incorrectly first)
The reason will be displayed to describe this comment to others. Learn more.
@rapind yes, as @ixti said this is better way to do it, but due to some other pachages/bugs it doesn't work as expected. This suppose to do it only ones instead of each time.
According to the docs you want to use setf so you don't override what may have already been set. So it follows that doctype html is kept by vim when using setf. So it's not a bug and just an unfortunate side effect of specifying doctype when using setf. There was a previous discussion here where they seem to have opted for set filetype. #38
I recommend using set filetype instead though as it results in the least surprise for users of this plugin.
From the docs:
Include this autocommand to .vimrc, if you do NOT want to override a previous filetype detection, but only set a filetype if the filetype was not detected at all:
" associate *.foo with php filetype
au BufRead,BufNewFile *.foo setfiletype php
To override any filetype which was already detected, use this instead (note the 'set filetype=' syntax):
The reason will be displayed to describe this comment to others. Learn more.
@ixti pretty cool. I'm still struggling to see what the use case is for wanting to keep an existing syntax on a slim file when you have this plugin enabled though. Before adding the extra conditional (complexity) can someone suggest a use case where setf is better for *.slim files?
The reason will be displayed to describe this comment to others. Learn more.
The use case is when by some unexpected reason user would like to have different filetype on *.slim files (e.g. some other utility will have same name for it's files) based on some complex rules. In fact after the discussion and attempts to find best solution I think the BEST solutions is to avoid to decide for user HOW he wants ftdetect of slim to work. gonna provede a better patch on PR :D
1ac9ebd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igas was there a reason for changing this back? You now lose indenting in files that start with a
doctype html
due to this change.Seems like this has gone back and forth for some reason over the years: https://github.com/slim-template/vim-slim/commits/master/ftdetect/slim.vim
Relevant issue: github.com//issues/38
1ac9ebd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to vim docs, I believe we should use
setf
(gonna change that back in my PR or will close PR completely -- gonna check who sets ft incorrectly first)1ac9ebd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rapind yes, as @ixti said this is better way to do it, but due to some other pachages/bugs it doesn't work as expected. This suppose to do it only ones instead of each time.
1ac9ebd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igas interesting.
According to the docs you want to use setf so you don't override what may have already been set. So it follows that
doctype html
is kept by vim when usingsetf
. So it's not a bug and just an unfortunate side effect of specifying doctype when usingsetf
. There was a previous discussion here where they seem to have opted forset filetype
. #38I recommend using
set filetype
instead though as it results in the least surprise for users of this plugin.From the docs:
Include this autocommand to .vimrc, if you do NOT want to override a previous filetype detection, but only set a filetype if the filetype was not detected at all:
To override any filetype which was already detected, use this instead (note the 'set filetype=' syntax):
1ac9ebd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about (pushed a patch to PR) using
set filetype=slim
on*.slim
if first line isdoctype html
, andsetf
otherwise.1ac9ebd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ixti pretty cool. I'm still struggling to see what the use case is for wanting to keep an existing syntax on a slim file when you have this plugin enabled though. Before adding the extra conditional (complexity) can someone suggest a use case where setf is better for *.slim files?
1ac9ebd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use case is when by some unexpected reason user would like to have different filetype on
*.slim
files (e.g. some other utility will have same name for it's files) based on some complex rules. In fact after the discussion and attempts to find best solution I think the BEST solutions is to avoid to decide for user HOW he wants ftdetect of slim to work. gonna provede a better patch on PR :D