2
2
" Language: GraphQL
3
3
" Maintainer: Jon Parise <[email protected] >
4
4
5
- if exists (" b:did_indent" )
5
+ if exists (' b:did_indent' )
6
6
finish
7
7
endif
8
8
let b: did_indent = 1
@@ -16,16 +16,16 @@ setlocal indentexpr=GetGraphQLIndent()
16
16
setlocal indentkeys = 0 {,0 },0 ),0 [,0 ],0 #,! ^F,o ,O,e
17
17
18
18
" If our indentation function already exists, we have nothing more to do.
19
- if exists (" *GetGraphQLIndent" )
19
+ if exists (' *GetGraphQLIndent' )
20
20
finish
21
21
endif
22
22
23
- let s: cpo_save = &cpo
24
- set cpo &vim
23
+ let s: cpo_save = &cpoptions
24
+ set cpoptions &vim
25
25
26
26
" Check if the character at lnum:col is inside a string.
27
27
function 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'
29
29
endfunction
30
30
31
31
function GetGraphQLIndent ()
@@ -41,15 +41,15 @@ function GetGraphQLIndent()
41
41
" If this line contains just a closing bracket, find its matching opening
42
42
" bracket and indent the closing backet to match.
43
43
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 )
45
45
let l: bracket = l: line [l: col - 1 ]
46
46
call cursor (v: lnum , l: col )
47
47
48
- if l: bracket == ' }'
48
+ if l: bracket is # ' }'
49
49
let l: matched = searchpair (' {' , ' ' , ' }' , ' bW' )
50
- elseif l: bracket == ' ]'
50
+ elseif l: bracket is # ' ]'
51
51
let l: matched = searchpair (' \[' , ' ' , ' \]' , ' bW' )
52
- elseif l: bracket == ' )'
52
+ elseif l: bracket is # ' )'
53
53
let l: matched = searchpair (' (' , ' ' , ' )' , ' bW' )
54
54
else
55
55
let l: matched = -1
@@ -65,13 +65,13 @@ function GetGraphQLIndent()
65
65
66
66
" If the previous line contained an opening bracket, and we are still in it,
67
67
" add indent depending on the bracket type.
68
- if getline (l: prevlnum ) = ~ ' [[{(]\s*$'
68
+ if getline (l: prevlnum ) = ~# ' [[{(]\s*$'
69
69
return indent (l: prevlnum ) + shiftwidth ()
70
70
endif
71
71
72
72
" Default to the existing indentation level.
73
73
return indent (l: prevlnum )
74
74
endfunction
75
75
76
- let &cpo = s: cpo_save
76
+ let &cpoptions = s: cpo_save
77
77
unlet s: cpo_save
0 commit comments