4
4
"
5
5
" Toggles the indent guides on and off.
6
6
"
7
- function ! indent_guides#toggle ()
7
+ function ! indent_guides#toggle () abort
8
8
call indent_guides#init_matches ()
9
9
10
10
if empty (w: indent_guides_matches )
@@ -18,7 +18,7 @@ endfunction
18
18
" Called from autocmds, keeps indent guides enabled or disabled when entering
19
19
" other buffers and windows.
20
20
"
21
- function ! indent_guides#process_autocmds ()
21
+ function ! indent_guides#process_autocmds () abort
22
22
if g: indent_guides_autocmds_enabled
23
23
call indent_guides#enable ()
24
24
else
@@ -30,7 +30,7 @@ endfunction
30
30
" Enables the indent guides for the current buffer and any other buffer upon
31
31
" entering it.
32
32
"
33
- function ! indent_guides#enable ()
33
+ function ! indent_guides#enable () abort
34
34
let g: indent_guides_autocmds_enabled = 1
35
35
36
36
if &diff || indent_guides#exclude_filetype ()
@@ -64,15 +64,15 @@ endfunction
64
64
" Disables the indent guides for the current buffer and any other buffer upon
65
65
" entering it.
66
66
"
67
- function ! indent_guides#disable ()
67
+ function ! indent_guides#disable () abort
68
68
let g: indent_guides_autocmds_enabled = 0
69
69
call indent_guides#clear_matches ()
70
70
endfunction
71
71
72
72
"
73
73
" Clear all highlight matches for the current window.
74
74
"
75
- function ! indent_guides#clear_matches ()
75
+ function ! indent_guides#clear_matches () abort
76
76
call indent_guides#init_matches ()
77
77
if ! empty (w: indent_guides_matches )
78
78
let l: index = 0
@@ -91,7 +91,7 @@ endfunction
91
91
"
92
92
" Automagically calculates and defines the indent highlight colors.
93
93
"
94
- function ! indent_guides#highlight_colors ()
94
+ function ! indent_guides#highlight_colors () abort
95
95
if s: auto_colors
96
96
if has (' gui_running' ) || has (' nvim' )
97
97
call indent_guides#gui_highlight_colors ()
@@ -105,7 +105,7 @@ endfunction
105
105
" Defines some basic indent highlight colors that work for Terminal Vim and
106
106
" gVim when colors can't be automatically calculated.
107
107
"
108
- function ! indent_guides#basic_highlight_colors ()
108
+ function ! indent_guides#basic_highlight_colors () abort
109
109
let l: cterm_colors = (&g: background == ' dark' ) ? [' darkgrey' , ' black' ] : [' lightgrey' , ' white' ]
110
110
let l: gui_colors = (&g: background == ' dark' ) ? [' grey15' , ' grey30' ] : [' grey70' , ' grey85' ]
111
111
@@ -117,7 +117,7 @@ endfunction
117
117
" Automagically calculates and defines the indent highlight colors for gui
118
118
" vim.
119
119
"
120
- function ! indent_guides#gui_highlight_colors ()
120
+ function ! indent_guides#gui_highlight_colors () abort
121
121
let l: hi_normal_guibg = ' '
122
122
123
123
" capture the backgroud color from the normal highlight
@@ -150,7 +150,7 @@ endfunction
150
150
" Takes a color and darkens or lightens it depending on whether a dark or light
151
151
" colorscheme is being used.
152
152
"
153
- function ! indent_guides#lighten_or_darken_color (color )
153
+ function ! indent_guides#lighten_or_darken_color (color ) abort
154
154
let l: new_color = ' '
155
155
156
156
if (&g: background == ' dark' )
@@ -165,23 +165,23 @@ endfunction
165
165
"
166
166
" Define default highlights.
167
167
"
168
- function ! indent_guides#define_default_highlights ()
168
+ function ! indent_guides#define_default_highlights () abort
169
169
hi default clear IndentGuidesOdd
170
170
hi default clear IndentGuidesEven
171
171
endfunction
172
172
173
173
"
174
174
" Init the w:indent_guides_matches variable.
175
175
"
176
- function ! indent_guides#init_matches ()
176
+ function ! indent_guides#init_matches () abort
177
177
let w: indent_guides_matches = exists (' w:indent_guides_matches' ) ? w: indent_guides_matches : []
178
178
endfunction
179
179
180
180
"
181
181
" We need to initialize these vars every time a buffer is entered while the
182
182
" plugin is enabled.
183
183
"
184
- function ! indent_guides#init_script_vars ()
184
+ function ! indent_guides#init_script_vars () abort
185
185
if &l: shiftwidth > 0 && &l: expandtab
186
186
let s: indent_size = &l: shiftwidth
187
187
else
@@ -229,7 +229,7 @@ endfunction
229
229
"
230
230
" NOTE: Currently, this only works when soft-tabs are being used.
231
231
"
232
- function ! indent_guides#calculate_guide_size ()
232
+ function ! indent_guides#calculate_guide_size () abort
233
233
let l: guide_size = g: indent_guides_guide_size
234
234
235
235
if l: guide_size == 0 || l: guide_size > s: indent_size
@@ -245,7 +245,7 @@ endfunction
245
245
" Example: indent_guides#capture_highlight('normal')
246
246
" Returns: 'Normal xxx guifg=#323232 guibg=#ffffff'
247
247
"
248
- function ! indent_guides#capture_highlight (group_name)
248
+ function ! indent_guides#capture_highlight (group_name) abort
249
249
redir = > l: output
250
250
exe " silent hi " . a: group_name
251
251
redir END
@@ -266,7 +266,7 @@ endfunction
266
266
" Example: indent_guides#indent_highlight_pattern('\t', 9, 2)
267
267
" Returns: /^\t*\%9v\zs\t*\%11v\ze/
268
268
"
269
- function ! indent_guides#indent_highlight_pattern (indent_pattern, column_start, indent_size)
269
+ function ! indent_guides#indent_highlight_pattern (indent_pattern, column_start, indent_size) abort
270
270
let l: pattern = ' ^' . a: indent_pattern . ' *\%' . a: column_start . ' v\zs'
271
271
let l: pattern .= a: indent_pattern . ' *\%' . (a: column_start + a: indent_size ) . ' v'
272
272
let l: pattern .= ' \ze'
@@ -276,7 +276,7 @@ endfunction
276
276
"
277
277
" Detect if any of the buffer filetypes should be excluded.
278
278
"
279
- function ! indent_guides#exclude_filetype ()
279
+ function ! indent_guides#exclude_filetype () abort
280
280
for ft in split (&ft , ' \.' )
281
281
if index (g: indent_guides_exclude_filetypes , ft ) > -1
282
282
return 1
0 commit comments