Skip to content

Commit

Permalink
style: trim space in parenthesis keys to avoid 'contained' duplicate
Browse files Browse the repository at this point in the history
and wrapped the long line
  • Loading branch information
91khr committed Dec 4, 2021
1 parent c18071e commit ae0ef43
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions autoload/rainbow.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@ endfun

fun s:resolve_parenthesis_with(init_state, p)
let [paren, contained, containedin, contains_prefix, contains, op] = a:init_state
let p = (type(a:p) == type([])) ? ((len(a:p) == 3) ? printf('start=#%s# step=%s end=#%s#', a:p[0], op, a:p[-1]) : printf('start=#%s# end=#%s#', a:p[0], a:p[-1])) : a:p "NOTE: preprocess the old style parentheses config
let p = (type(a:p) == type([])) ?
\ ((len(a:p) == 3) ?
\ printf('start=#%s# step=%s end=#%s#', a:p[0], op, a:p[-1]) :
\ printf('start=#%s# end=#%s#', a:p[0], a:p[-1])) :
\ a:p "NOTE: preprocess the old style parentheses config

let ls = split(p, '\v%(%(start|step|end)\=(.)%(\1@!.)*\1[^ ]*|\w+%(\=[^ ]*)?) ?\zs', 0)
for s in ls
let [k, v] = [matchstr(s, '^[^=]\+\ze\(=\|$\)'), matchstr(s, '^[^=]\+=\zs.*')]
let [k, v] = [s:trim(matchstr(s, '^[^=]\+\ze\(=\|$\)')), s:trim(matchstr(s, '^[^=]\+=\zs.*'))]
if k == 'step'
let op = s:trim(v)
let op = v
elseif k == 'contains_prefix'
let contains_prefix = s:trim(v)
let contains_prefix = v
elseif k == 'contains'
let contains = s:concat([contains, s:trim(v)])
let contains = s:concat([contains, v])
elseif k == 'containedin'
let containedin = s:concat([containedin, s:trim(v)])
let containedin = s:concat([containedin, v])
elseif k == 'contained'
let contained = 1
else
Expand Down

0 comments on commit ae0ef43

Please sign in to comment.