Skip to content

Instantly share code, notes, and snippets.

@mgwilliams
Created February 18, 2014 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgwilliams/fee093a5687738d6fd06 to your computer and use it in GitHub Desktop.
Save mgwilliams/fee093a5687738d6fd06 to your computer and use it in GitHub Desktop.
diff --git a/ftdetect/sls.vim b/ftdetect/sls.vim
index 94295b4..d075bf8 100644
--- a/ftdetect/sls.vim
+++ b/ftdetect/sls.vim
@@ -1,3 +1,11 @@
-if has("autocmd")
- au BufNewFile,BufRead *.sls set filetype=sls
-endif
+function! DetectSls()
+ if !did_filetype()
+ if match(getline(1), '^#!py') > -1
+ set ft=python
+ else
+ set ft=sls
+ endif
+ endif
+endfunction
+
+:au BufNewFile,BufRead *.sls call DetectSls()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment