\def\xlstyamlvalue{\normalfont\xlstGetStyle{basic}\normalcolor} % a dash only marks a list item outside of a value, a comment or a string \begingroup\makeatletter \gdef\xlstyamlbullet{% \lst@ifwhitespace\xlstIfPmode{\xlstGet{keywordC}{-}}{-}\else-\fi} \endgroup \lstdefinelanguage{lYaml}{ basicstyle=\xlstGetStyle{keywordA}, % '**' keeps comments, strings and keywords alive within the value moredelim=**[l][\xlstyamlvalue]{:}, comment=[l]{\#}, morestring=[b]", morestring=[b]', sensitive=false, morekeywords=[2]{true,false,null,yes,no,on,off}, add to literate={-}{{\xlstyamlbullet}}1 } \RegisterLanguage{yaml}{lYaml}