Why is this Vim syntax command not working after running / ftplugin / yaml.vim?

I have the following line in after/ftplugin/yaml.vim

syn match yamlBlockMappingKey /^\s*\zs.*\ze\s*:\%(\s\|$\)/

      

I also tried this:

execute 'syn match yamlBlockMappingKey /^\s*\zs.*\ze\s*:\%(\s\|$\)/'

      

The goal is to make vim properly allocated keys that contain spaces, for that matter on thread_stack . The problem is the command doesn't work when I open a new YAML file. I know what after/ftplugin/yaml.vim

is being used as I put the command there echom

and it appears in messages

. Also, if I just take a string and paste it into the command line and execute it, it works. Does anyone know what?

+3


source to share


1 answer


The scripts ftplugin

come before the syntax scripts, so the default YAML syntax clears up your extra definition. Place the extension instead after/syntax/yaml.vim

; after all, you are expanding syntax, not file type parameters.



+5


source







All Articles