Skip to content

Instantly share code, notes, and snippets.

@4rc0s
Created June 26, 2009 09:07
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 4rc0s/136384 to your computer and use it in GitHub Desktop.
Save 4rc0s/136384 to your computer and use it in GitHub Desktop.
# Add extension for supported modes based on TM_SCOPE
# Cribbed from http://github.com/defunkt/gist.el/tree/master/gist.el
def get_extension
scope = ENV["TM_SCOPE"].split[0]
case scope
when /source\.actionscript/ : "as"
when /source\.c/, /source\.objc/ : "c"
when /source\.c\+\+/, /source.objc\+\+/ : "cpp"
# common-lisp-mode : "el"
when /source\.css/ : "css"
when /source\.diff/, "meta.diff.range" : "diff"
# emacs-lisp-mode : "el"
when /source\.erlang/ : "erl"
when /source\.haskell/, "text.tex.latex.haskel" : "hs"
when /text\.html/ : "html"
when /source\.io/ : "io"
when /source\.java/ : "java"
when /source\.js/ : "js"
# jde-mode : "java"
# js2-mode : "js"
when /source\.lua/ : "lua"
when /source\.ocaml/ : "ml"
when /source\.objc/, "source.objc++" : "m"
when /source\.perl/ : "pl"
when /source\.php/ : "php"
when /source\.python/ : "sc"
when /source\.ruby/ : "rb" # Emacs bundle uses rbx
when /text\.plain/ : "txt"
when /source\.sql/ : "sql"
when /source\.scheme/ : "scm"
when /source\.smalltalk/ : "st"
when /source\.shell/ : "sh"
when /source\.tcl/, "text.html.tcl" : "tcl"
when /source\.lex/ : "tex"
when /text\.xml/, /text.xml.xsl/, /source.plist/, /text.xml.plist/ : "xml"
else "txt"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment