zedapp/zed — pull request #164 by robru (2014-04-01 06:07:49+00:00)
Title: Set language mode based on shebang line.

So I work on some scripts that don't have file extensions, but the files start with unix shebangs (eg, `#!/usr/bin/python` on the very first line). This change makes Zed check the first line of the file if and only if other methods of mode-identification have failed.

By default, the shebang is checked for the mode-name, so all languages immediately benefit from this as long as the zed mode name matches the unix interpreter name (and I'm not aware of any that don't, but I could be wrong).

Just in case, I added the ability for modes to specify other shebang keywords. Initially I did this so I could specify `"python3"` and `"python"` for python, but it proved unnecessary since "python3" already matches a search for "python" anyway. I left the feature just in case other languages have some kind of discrepancy here (I guess the javascript mode will want to specify `node` and `gjs` as potential shebangs).

Let me know what you think! Thanks!