On Tue, 6 Jul 2010, Peng Yu wrote:
> On Jul 6, 3:55 pm, "Benjamin R. Haskell" wrote:
> > [...]
> > The following worksforme:
> >
> > ==> ~/.vim/after/syntax/sh.vim <==
> > unlet b:current_syntax
> > syntax include @sql syntax/sql.vim
> > syn region shHereDoc matchgroup=shRedir start=/<<\s*\\\=\z(\S*\)/
> > end=/^\z1\s*$/ contai...@shdblquotelist,@sql
> > ==================================
> >
> > [...]
>
> Note that I'm using the suffix .sql rather .sh, as I think that bash
> is just a wrapper, the main stuff is in sql. The about tips help only
> if a .sh suffix is used. Could you please take a look for the case
> where .sql suffix is used? Thank you!
Regardless of what the main stuff is, it's still wrapped as a bash
script. I'd just use the .sh or .bash suffix, since that's what the
file is.
But, Vim will also let you call an apple an orange. In your vimrc:
aug FileTypeOverride
au!
au BufRead *.sql if -1 != match(getline(1),'^#!.*sh\>') | set ft=sh |
endif
aug END
Note the use of 'set ft' rather than 'setf', which forces the filetype
to 'sh', even if it gets set to 'sql' before this autocmd is run.
The '^#!.*sh\>' pattern matches a shebang line containing a shell-like
name. e.g. #!/bin/bash, #!/bin/sh, #!/usr/local/bin/ash
--
Best,
Ben
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php