Bug#319825: vim-common: mishightlights valid bash code

Lucas Nussbaum lucas at lucas-nussbaum.net
Mon Jul 25 06:45:07 UTC 2005


On Sun, Jul 24, 2005 at 09:40:38PM -0400, Justin Pryzby <justinpryzby at users.sourceforge.net> wrote:
> Package: vim-common
> Severity: normal
> Version: 6.3-071+1
> 
> vim cannot deal with the following type of bash command substitution:
> 
>   foo=$(bar)
> 
> $, ( and ) are highlighted in red, as if the code were invalid.

It works here. The relevant autocmds are :
    *.bash    call SetFileTypeSH("bash")
    .kshrc*   call SetFileTypeSH("ksh")
    *.ksh     call SetFileTypeSH("ksh")
    *.sh      call SetFileTypeSH(getline(1))
    *.env     call SetFileTypeSH(getline(1))
    .tcshrc*  setf tcsh
    *.tcsh    setf tcsh
	 [...]

To get bash syntax highlighting, you can :
- use extension .bash instead of .sh
- put a shebang #!/bin/bash at the beginning of your script
- run manually :cal SetFileTypeSH("bash")

Please note that $() is bash-specific and won't work with most
sh-compatible shells.
-- 
| Lucas Nussbaum
| lucas at lucas-nussbaum.net   http://www.lucas-nussbaum.net/ |
| jabber: lucas at nussbaum.fr             GPG: 1024D/023B3F4F |




More information about the pkg-vim-maintainers mailing list