Bug#848663: vim: sh syntax highlighting of command substitution $() is wrong

James McCoy jamessan at debian.org
Mon Dec 19 13:02:53 UTC 2016


On Mon, Dec 19, 2016 at 11:55:50AM +0100, Bas Zoetekouw wrote:
> Vim's currenr behaviour for syntax highlighting of shell scripts (with
> #!/bin/sh and /bin/sh pointing to dash) is to mark command
> substititions using the $(foo) construction as an error.

Not that I can see.

> This is incorrect, as POSIX sh alllows this construction.
> 
> Because vim's syntaxt hightlighting script correctly identifies
> /bin/sh-->/bin/dash as a POSIX shell, and sets b:is_posix,

Which it then translates to b:is_kornshell:

    if !exists("b:is_kornshell") && !exists("b:is_bash")
      if exists("g:is_posix") && !exists("g:is_kornshell")
       let g:is_kornshell= g:is_posix
      endif
      if exists("g:is_kornshell")
        let b:is_kornshell= 1
        if exists("b:is_sh")
          unlet b:is_sh
        endif

What b:is_ variable is set in that buffer?  Also, see ":help
ft-sh-syntax", although /bin/sh should be handled as POSIX if it's a
symlink to dash.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB



More information about the pkg-vim-maintainers mailing list