On 2018-10-23 13:07:33 +02, HiPhish wrote: > Hello Schemers > > When I open a Scheme file (Neo)vim the file type is set to "scheme", but I > would like to be able to detect that it is not just Scheme, but Guile Scheme. > So far I have set up the editor to scan the first line for a shebang and if > the word "guile" appears to set the file type to "scheme.guile": > > if getline(1) =~? '\v^#!.*[Gg]uile' > let &filetype .= '.guile' > endif > > If you are not familiar with Vim, the important part is the regex > '^#!.*[Gg]uile'. This works OK, but is there a better way than adding a > shebang or some other manual hing to the head of every script? How does Emacs > do it?
Vim like Emacs recognizes modelines in the file. I start guile scripts with: #! /bin/sh ## -*- mode: scheme; coding: utf-8 -*- ## Time-stamp: <2018-09-14 08:43:42 barry> exec ${GUILE:-guile} -e main -s $0 ${1+"$@"} !# -- Barry Fishman