]> git.wincent.com - pinnacle.git/commitdiff
Fix regex for decorating existing patterns
authorGreg Hurrell <greg@hurrell.net>
Wed, 7 Jun 2017 02:29:10 +0000 (19:29 -0700)
committerGreg Hurrell <greg@hurrell.net>
Wed, 7 Jun 2017 02:29:10 +0000 (19:29 -0700)
Was only working with one prefix and one suffix:

  a=b c=d e=f

(finding c=d).

Would fail given:

  a=b c=d e=f g=h

Which means that it would end up creating a dupe rule for "c=d",
potentially, which Vim would then collapse.

autoload/pinnacle.vim

index 620a39aac97888fb26737283fea71f4fbfadd769..34284ca28bc08a610d5d72a2000cb4b1ce088409 100644 (file)
@@ -228,9 +228,9 @@ function! pinnacle#decorate(style, group) abort
     " Check for existing setting.
     let l:matches = matchlist(
       \   l:original,
-      \   '^\([^ ]\+ \)\?' .
+      \   '^\([^ ]\+ \)*' .
       \   '\(' . l:lhs . '=[^ ]\+\)' .
-      \   '\( .\+\)\?$'
+      \   '\( .\+\)*$'
       \ )
     if l:matches == []
       " No setting, add one with just a:style in it