Why isn't this Vim syntax command in after/ftplugin/yaml.vim working?

vim

Solution

The `ftplugin` scripts are sourced before the syntax scripts, so the default YAML syntax clears your additional definition. Place your extension into `after/syntax/yaml.vim` instead; after all, you're extending a syntax, not filetype settings.

Problem

I have the following line in `after/ftplugin/yaml.vim` ``` syn match yamlBlockMappingKey /^\s*\zs.*\ze\s*:\%(\s\|$\)/ ``` I have also tried this: ``` execute 'syn match yamlBlockMappingKey /^\s*\zs.*\ze\s*:\%(\s\|$\)/' ``` The purpose of this is to make vim properly highlight keys that contain spaces, as per this stackoverflow question. The problem is that the command doesn't seem to work when I open a new YAML file. I know that `after/ftplugin/yaml.vim` is being sourced, as I put an `echom` command in there and it shows up in `messages`. Also, if I just take the line and paste it into the command prompt and execute it, it works. Anyone know what's up?

Original source