22"  Language:  GraphQL
33"  Maintainer:  Jon Parise <[email protected] >44
5- if  exists (" b:did_indent"  )
5+ if  exists (' b:did_indent'  )
66  finish 
77endif 
88let  b: did_indent  =  1 
@@ -16,16 +16,16 @@ setlocal indentexpr=GetGraphQLIndent()
1616setlocal  indentkeys = 0 {,0 },0 ),0 [,0 ],0 #,! ^F,o ,O,e 
1717
1818"  If our indentation function already exists, we have nothing more to do.
19- if  exists (" *GetGraphQLIndent"  )
19+ if  exists (' *GetGraphQLIndent'  )
2020  finish 
2121endif 
2222
23- let  s: cpo_save  =  &cpo 
24- set  cpo &vim 
23+ let  s: cpo_save  =  &cpoptions 
24+ set  cpoptions &vim 
2525
2626"  Check if the character at lnum:col is inside a string.
2727function  s: InString (lnum, col )
28-   return  synIDattr (synID (a: lnum , a: col , 1 ), ' name'  ) ==  ' graphqlString' 
28+   return  synIDattr (synID (a: lnum , a: col , 1 ), ' name'  ) is #  ' graphqlString' 
2929endfunction 
3030
3131function  GetGraphQLIndent ()
@@ -41,15 +41,15 @@ function GetGraphQLIndent()
4141  "  If this line contains just a closing bracket, find its matching opening 
4242  "  bracket and indent the closing backet to match. 
4343  let  l: col  =  matchend (l: line , ' ^\s*[]})]'  )
44-   if  l: col >  0  &&  ! s: InString (v: lnum , col )
44+   if  l: col >  0  &&  ! s: InString (v: lnum , l: col )
4545    let  l: bracket  =  l: line [l: col  -  1 ]
4646    call  cursor (v: lnum , l: col )
4747
48-     if  l: bracket  ==  ' }' 
48+     if  l: bracket  is #  ' }' 
4949      let  l: matched  =  searchpair (' {'  , ' '  , ' }'  , ' bW'  )
50-     elseif  l: bracket  ==  ' ]' 
50+     elseif  l: bracket  is #  ' ]' 
5151      let  l: matched  =  searchpair (' \['  , ' '  , ' \]'  , ' bW'  )
52-     elseif  l: bracket  ==  ' )' 
52+     elseif  l: bracket  is #  ' )' 
5353      let  l: matched  =  searchpair (' ('  , ' '  , ' )'  , ' bW'  )
5454    else 
5555      let  l: matched  =  -1 
@@ -65,13 +65,13 @@ function GetGraphQLIndent()
6565
6666  "  If the previous line contained an opening bracket, and we are still in it, 
6767  "  add indent depending on the bracket type. 
68-   if  getline (l: prevlnum ) = ~ ' [[{(]\s*$' 
68+   if  getline (l: prevlnum ) = ~#  ' [[{(]\s*$' 
6969    return  indent (l: prevlnum ) +  shiftwidth ()
7070  endif 
7171
7272  "  Default to the existing indentation level. 
7373  return  indent (l: prevlnum )
7474endfunction 
7575
76- let  &cpo  =  s: cpo_save
76+ let  &cpoptions  =  s: cpo_save
7777unlet  s: cpo_save
0 commit comments