1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
|
*indent_blankline.txt* Show vertical lines for indent on empty lines
Author: Lukas Reineke <lukas.reineke@protonmail.com>
Version: 2.20.4
==============================================================================
CONTENTS *indent-blankline*
1. Introduction |indent-blankline-introduction|
2. Highlights |indent-blankline-highlights|
3. Setup |indent-blankline-setup|
4. Variables |indent-blankline-variables|
5. Commands |indent-blankline-commands|
6. License |indent-blankline-license|
==============================================================================
1. INTRODUCTION *indent-blankline-introduction*
This plugin adds indentation guides to all lines (including empty lines).
It uses Neovim's virtual text feature and **no conceal**
This plugin requires Neovim 0.5 or higher. It makes use of Neovim only
features so it will not work in Vim.
There is a legacy version of the plugin that supports Neovim 0.4 under the
branch `version-1`
==============================================================================
2. HIGHLIGHTS *indent-blankline-highlights*
To change the highlighting of either the indent character, or the whitespace
between indent characters, define or update these highlight groups.
------------------------------------------------------------------------------
IndentBlanklineChar *hl-IndentBlanklineChar*
Highlight of indent character.
Default: takes guifg color from 'Whitespace' ~
Example: >
highlight IndentBlanklineChar guifg=#00FF00 gui=nocombine
------------------------------------------------------------------------------
IndentBlanklineSpaceChar *hl-IndentBlanklineSpaceChar*
Highlight of space character.
Default: takes guifg color from 'Whitespace' ~
Example: >
highlight IndentBlanklineSpaceChar guifg=#00FF00 gui=nocombine
------------------------------------------------------------------------------
IndentBlanklineSpaceCharBlankline *hl-IndentBlanklineSpaceCharBlankline*
Highlight of space character on blank lines.
Default: takes guifg color from 'Whitespace' ~
Example: >
highlight IndentBlanklineSpaceCharBlankline guifg=#00FF00 gui=nocombine
------------------------------------------------------------------------------
IndentBlanklineContextChar *hl-IndentBlanklineContextChar*
Highlight of indent character when base of current context.
Only used when |g:indent_blankline_show_current_context| is active
Default: takes guifg color from 'Label' ~
Example: >
highlight IndentBlanklineContextChar guifg=#00FF00 gui=nocombine
------------------------------------------------------------------------------
IndentBlanklineContextSpaceChar *hl-IndentBlanklineContextSpaceChar*
Highlight of space characters one indent level of the current context.
Only used when |g:indent_blankline_show_current_context| is active
Default: takes guifg color from 'Label' ~
Example: >
highlight IndentBlanklineContextSpaceChar guifg=#00FF00 gui=nocombine
------------------------------------------------------------------------------
IndentBlanklineContextStart *hl-IndentBlanklineContextStart*
Highlight of the first line of the current context.
Only used when |g:indent_blankline_show_current_context_start| is active
Default: takes guifg color from 'Label' as guisp and adds underline ~
Note: You need to have set |gui-colors| for the default to work.
Example: >
highlight IndentBlanklineContextStart guisp=#00FF00 gui=underline
------------------------------------------------------------------------------
Note: Define your highlight group after setting colorscheme or your colorscheme will clear your highlight group
When defining the highlight group, it is important to set |nocombine| as a
gui option. This is to make sure the character does not inherit gui options
from the underlying text, like italic or bold.
Highlight groups get reset on |ColorScheme| autocommand, if both fg and bg
are empty.
The set more than one highlight group that changes based on indentation level,
see:
|g:indent_blankline_char_highlight_list|
|g:indent_blankline_space_char_highlight_list|
|g:indent_blankline_space_char_blankline_highlight_list|
==============================================================================
3. SETUP *indent-blankline-setup*
To configure indent-blankline, either run the setup function, or set variables
manually.
The setup function has a single table as argument, keys of the table match the
|indent-blankline-variables| without the `indent_blankline_` part.
Example: >
require("indent_blankline").setup {
-- for example, context is off by default, use this to turn it on
show_current_context = true,
show_current_context_start = true,
}
==============================================================================
4. VARIABLES *indent-blankline-variables*
All variables can be set globally |g:var|, per tab |t:var|, or per buffer |b:var|
------------------------------------------------------------------------------
g:indent_blankline_char *g:indent_blankline_char*
Specifies the character to be used as indent line.
Not used if |g:indent_blankline_char_list| is not empty.
When set explicitly to empty string (""), no indentation character is
displayed at all, even when |g:indent_blankline_char_list| is not empty.
This can be useful in combination with
|g:indent_blankline_space_char_highlight_list| to only rely on different
highlighting of different indentation levels without needing to show a
special character.
Also set by |g:indentLine_char|
Default: '│' ~
Example: >
let g:indent_blankline_char = '|'
------------------------------------------------------------------------------
g:indent_blankline_char_blankline *g:indent_blankline_char_blankline*
Specifies the character to be used as indent line for blanklines.
Not used if |g:indent_blankline_char_list_blankline| is not empty.
Default: '' ~
Example: >
let g:indent_blankline_char_blankline = '┆'
------------------------------------------------------------------------------
g:indent_blankline_char_list *g:indent_blankline_char_list*
Specifies a list of characters to be used as indent line for
each indentation level.
Ignored if the value is an empty list.
Also set by |g:indentLine_char_list|
Default: [] ~
Example: >
let g:indent_blankline_char_list = ['|', '¦', '┆', '┊']
------------------------------------------------------------------------------
g:indent_blankline_char_list_blankline *g:indent_blankline_char_list_blankline*
Specifies a list of characters to be used as indent line for
each indentation level on blanklines.
Ignored if the value is an empty list.
Default: [] ~
Example: >
let g:indent_blankline_char_list_blankline = ['|', '¦', '┆', '┊']
------------------------------------------------------------------------------
g:indent_blankline_char_highlight_list *g:indent_blankline_char_highlight_list*
Specifies the list of character highlights for each indentation level.
Ignored if the value is an empty list.
Default: [] ~
Example: >
let g:indent_blankline_char_highlight_list = ['Error', 'Function']
------------------------------------------------------------------------------
g:indent_blankline_space_char_blankline *g:indent_blankline_space_char_blankline*
Specifies the character to be used as the space value in between indent
lines when the line is blank.
Default: An empty space character ~
Example: >
let g:indent_blankline_space_char_blankline = ' '
------------------------------------------------------------------------------
g:indent_blankline_space_char_highlight_list *g:indent_blankline_space_char_highlight_list*
Specifies the list of space character highlights for each indentation
level.
Ignored if the value is an empty list.
Default: [] ~
Example: >
let g:indent_blankline_space_char_highlight_list = ['Error', 'Function']
------------------------------------------------------------------------------
g:indent_blankline_space_char_blankline_highlight_list *g:indent_blankline_space_char_blankline_highlight_list*
Specifies the list of space character highlights for each indentation
level when the line is empty.
Ignored if the value is an empty list.
Also set by |g:indent_blankline_space_char_highlight_list|
Default: [] ~
Example: >
let g:indent_blankline_space_char_blankline_highlight_list = ['Error', 'Function']
------------------------------------------------------------------------------
g:indent_blankline_use_treesitter *g:indent_blankline_use_treesitter*
Use treesitter to calculate indentation when possible.
Requires treesitter
Default: false ~
Example: >
let g:indent_blankline_use_treesitter = v:true
------------------------------------------------------------------------------
g:indent_blankline_indent_level *g:indent_blankline_indent_level*
Specifies the maximum indent level to display.
Also set by |g:indentLine_indentLevel|
Default: 10 ~
Example: >
let g:indent_blankline_indent_level = 4
------------------------------------------------------------------------------
g:indent_blankline_max_indent_increase *g:indent_blankline_max_indent_increase*
The maximum indent level increase from line to line.
Set this option to 1 to make aligned trailing multiline comments not
create indentation.
Default: g:indent_blankline_indent_level ~
Example: >
let g:indent_blankline_max_indent_increase = 1
------------------------------------------------------------------------------
g:indent_blankline_show_first_indent_level *g:indent_blankline_show_first_indent_level*
Displays indentation in the first column.
Default: v:true ~
Example: >
let g:indent_blankline_show_first_indent_level = v:false
------------------------------------------------------------------------------
g:indent_blankline_show_trailing_blankline_indent *g:indent_blankline_show_trailing_blankline_indent*
Displays a trailing indentation guide on blank lines, to match the
indentation of surrounding code.
Turn this off if you want to use background highlighting instead of chars.
Default: v:true ~
Example: >
let g:indent_blankline_show_trailing_blankline_indent = v:false
------------------------------------------------------------------------------
g:indent_blankline_show_end_of_line *g:indent_blankline_show_end_of_line*
Displays the end of line character set by |listchars| instead of the
indent guide on line returns.
Default: v:false ~
Example: >
let g:indent_blankline_show_end_of_line = v:true
------------------------------------------------------------------------------
g:indent_blankline_show_foldtext *g:indent_blankline_show_foldtext*
Displays the full fold text instead of the indent guide on folded lines.
Note: there is no autocommand to subscribe to changes in folding. This
might lead to unexpected results. A possible solution for this is to
remap folding bindings to also call |IndentBlanklineRefresh|
Default: v:true ~
Example: >
let g:indent_blankline_show_foldtext = v:false
------------------------------------------------------------------------------
g:indent_blankline_enabled *g:indent_blankline_enabled*
Turns this plugin on or off.
Also set by |g:indentLine_enabled|
Note: the buffer version of this variable overwrites all other
enabled/disabled checks.
Default: v:true ~
Example: >
let g:indent_blankline_enabled = v:false
------------------------------------------------------------------------------
g:indent_blankline_disable_with_nolist *g:indent_blankline_disable_with_nolist*
When true, automatically turns this plugin off when |nolist| is set.
When false, setting |nolist| will keep displaying indentation guides but
removes whitespace characters set by |listchars|.
Default: v:false ~
Example: >
let g:indent_blankline_disable_with_nolist = v:true
------------------------------------------------------------------------------
g:indent_blankline_filetype *g:indent_blankline_filetype*
Specifies a list of |filetype| values for which this plugin is enabled.
All |filetypes| are enabled if the value is an empty list.
Also set by |g:indentLine_fileType|
Default: [] ~
Example: >
let g:indent_blankline_filetype = ['vim']
------------------------------------------------------------------------------
g:indent_blankline_filetype_exclude *g:indent_blankline_filetype_exclude*
Specifies a list of |filetype| values for which this plugin is not enabled.
Ignored if the value is an empty list.
Also set by |g:indentLine_fileTypeExclude|
Default: [ ~
"lspinfo", ~
"packer", ~
"checkhealth", ~
"help", ~
"man", ~
"", ~
] ~
Example: >
let g:indent_blankline_filetype_exclude = ['help']
------------------------------------------------------------------------------
g:indent_blankline_buftype_exclude *g:indent_blankline_buftype_exclude*
Specifies a list of |buftype| values for which this plugin is not enabled.
Ignored if the value is an empty list.
Also set by |g:indentLine_bufTypeExclude|
Default: [ ~
"terminal", ~
"nofile", ~
"quickfix", ~
"prompt", ~
] ~
Example: >
let g:indent_blankline_buftype_exclude = ['terminal']
------------------------------------------------------------------------------
g:indent_blankline_bufname_exclude *g:indent_blankline_bufname_exclude*
Specifies a list of buffer names (file name with full path) for which
this plugin is not enabled.
A name can be regular expression as well.
Also set by |g:indentLine_bufNameExclude|
Default: [] ~
Example: >
let g:indent_blankline_bufname_exclude = ['README.md', '.*\.py']
------------------------------------------------------------------------------
g:indent_blankline_strict_tabs *g:indent_blankline_strict_tabs*
When on, if there is a single tab in a line, only tabs are used to
calculate the indentation level.
When off, both spaces and tabs are used to calculate the indentation
level.
Only makes a difference if a line has a mix of tabs and spaces for
indentation.
Default: v:false ~
Example: >
let g:indent_blankline_strict_tabs = v:true
------------------------------------------------------------------------------
g:indent_blankline_show_current_context *g:indent_blankline_show_current_context*
When on, use treesitter to determine the current context. Then show the
indent character in a different highlight.
Note: Requires https://github.com/nvim-treesitter/nvim-treesitter to be
installed
Note: With this option enabled, the plugin refreshes on |CursorMoved|,
which might be slower
Default: v:false ~
Example: >
let g:indent_blankline_show_current_context = v:true
------------------------------------------------------------------------------
g:indent_blankline_show_current_context_start *g:indent_blankline_show_current_context_start*
Applies the |hl-IndentBlanklineContextStart| highlight group to the first
line of the current context.
By default this will underline.
Note: Requires https://github.com/nvim-treesitter/nvim-treesitter to be
installed
Note: You need to have set |gui-colors| and it depends on your terminal
emulator if this works as expected.
If you are using kitty and tmux, take a look at this article to
make it work
http://evantravers.com/articles/2021/02/05/curly-underlines-in-kitty-tmux-neovim/
Default: v:false ~
Example: >
let g:indent_blankline_show_current_context_start = v:true
------------------------------------------------------------------------------
g:indent_blankline_show_current_context_start_on_current_line *g:indent_blankline_show_current_context_start_on_current_line*
Shows |g:indent_blankline_show_current_context_start| even when the cursor
is on the same line
Default: v:true ~
Example: >
let g:indent_blankline_show_current_context_start_on_current_line = v:false
------------------------------------------------------------------------------
g:indent_blankline_context_char *g:indent_blankline_context_char*
Specifies the character to be used for the current context indent line.
Not used if |g:indent_blankline_context_char_list| is not empty.
Useful to have a greater distinction between the current context indent
line and others.
Also useful in combination with |g:indent_blankline_char| set to empty string
(""), as this allows only the current context indent line to be shown.
Default: g:indent_blankline_char ~
Example: >
let g:indent_blankline_context_char = '┃'
------------------------------------------------------------------------------
g:indent_blankline_context_char_blankline *g:indent_blankline_context_char_blankline*
Equivalent of |g:indent_blankline_char_blankline| for
|g:indent_blankline_context_char|.
Default: '' ~
Example: >
let g:indent_blankline_context_char_blankline = '┆'
------------------------------------------------------------------------------
g:indent_blankline_context_char_list *g:indent_blankline_context_char_list*
Equivalent of |g:indent_blankline_char_list| for
|g:indent_blankline_context_char|.
Default: [] ~
Example: >
let g:indent_blankline_context_char_list = ['┃', '║', '╬', '█']
------------------------------------------------------------------------------
g:indent_blankline_context_char_list_blankline *g:indent_blankline_context_char_list_blankline*
Equivalent of |g:indent_blankline_char_list_blankline| for
|g:indent_blankline_context_char_blankline|.
Default: [] ~
Example: >
let g:indent_blankline_context_char_list_blankline = ['┃', '║', '╬', '█']
------------------------------------------------------------------------------
g:indent_blankline_context_highlight_list *g:indent_blankline_context_highlight_list*
Specifies the list of character highlights for the current context at
each indentation level.
Ignored if the value is an empty list.
Only used when |g:indent_blankline_show_current_context| is active
Default: [] ~
Example: >
let g:indent_blankline_context_highlight_list = ['Error', 'Warning']
------------------------------------------------------------------------------
g:indent_blankline_char_priority *g:indent_blankline_char_priority*
Specifies the |extmarks| priority for chars.
Default: 1 ~
Example: >
let g:indent_blankline_char_priority = 50
------------------------------------------------------------------------------
g:indent_blankline_context_start_priority *g:indent_blankline_context_start_priority*
Specifies the |extmarks| priority for the context start.
Default: 10000 ~
Example: >
let g:indent_blankline_context_start_priority = 50
------------------------------------------------------------------------------
g:indent_blankline_context_patterns *g:indent_blankline_context_patterns*
Specifies a list of lua patterns that are used to match against the
treesitter |tsnode:type()| at the cursor position to find the current
context.
To learn more about how lua pattern work, see here:
https://www.lua.org/manual/5.1/manual.html#5.4.1
Only used when |g:indent_blankline_show_current_context| is active
Default: [ ~
"class", ~
"^func", ~
"method", ~
"^if", ~
"while", ~
"for", ~
"with", ~
"try", ~
"except", ~
"arguments", ~
"argument_list", ~
"object", ~
"dictionary", ~
"element", ~
"table", ~
"tuple", ~
"do_block", ~
] ~
Example: >
let g:indent_blankline_context_patterns = ['^if']
------------------------------------------------------------------------------
g:indent_blankline_use_treesitter_scope *g:indent_blankline_use_treesitter_scope*
Instead of using |g:indent_blankline_context_patterns|, use the current
scope defined by nvim-treesitter as the context.
Default: false ~
Example: >
let g:indent_blankline_use_treesitter_scope = true
------------------------------------------------------------------------------
g:indent_blankline_context_pattern_highlight *g:indent_blankline_context_pattern_highlight*
Specifies a map of patterns set in
|g:indent_blankline_context_patterns| to highlight groups.
When the current matching context pattern is in the map, the context
will be highlighted with the corresponding highlight group.
Only used when |g:indent_blankline_show_current_context| is active
Default: {} ~
Example: >
let g:indent_blankline_context_pattern_highlight = {'function': 'Function'}
------------------------------------------------------------------------------
g:indent_blankline_viewport_buffer *g:indent_blankline_viewport_buffer*
Sets the buffer of extra lines before and after the current viewport that
are considered when generating indentation and the context.
Default: 10 ~
Example: >
let g:indent_blankline_viewport_buffer = 20
------------------------------------------------------------------------------
g:indent_blankline_disable_warning_message *g:indent_blankline_disable_warning_message*
Turns deprecation warning messages off.
Default: v:false ~
Example: >
let g:indent_blankline_disable_warning_message = v:true
==============================================================================
5. COMMANDS *indent-blankline-commands*
------------------------------------------------------------------------------
:IndentBlanklineRefresh[!] *IndentBlanklineRefresh*
Refreshes the indent guides for the current buffer.
Run this with |autocmd| when the file changes. For example after a plugin
formats the file.
With bang (IndentBlanklineRefresh!) refreshes the indent guides globally.
By default it is run for:
1. |FileChangedShellPost| *
2. |TextChanged| *
3. |TextChangedI| *
4. |CompleteChanged| *
5. |BufWinEnter| *
6. |Filetype| *
7. |OptionSet| list,listchars,shiftwidth,tabstop,expandtab
Example: >
autocmd User ALEFixPost IndentBlanklineRefresh
------------------------------------------------------------------------------
:IndentBlanklineRefreshScroll[!] *IndentBlanklineRefreshScroll*
Refreshes the indent guides for the current buffer. But tries to reuse as
indent guides that already exist. Only used if we are sure the buffer
content did not change.
With bang (IndentBlanklineRefresh!) refreshes the indent guides globally.
By default it is run for:
1. |WinScrolled| *
Example: >
autocmd WinScrolled * IndentBlanklineRefreshScroll
------------------------------------------------------------------------------
:IndentBlanklineEnable[!] *IndentBlanklineEnable*
Enables this plugin for the current buffer.
This overwrites any include/exclude rules.
With bang (IndentBlanklineEnable!) enables this plugin globally
------------------------------------------------------------------------------
:IndentBlanklineDisable[!] *IndentBlanklineDisable*
Disables this plugin for the current buffer.
This overwrites any include/exclude rules.
With bang (IndentBlanklineDisable!) disables this plugin globally
------------------------------------------------------------------------------
:IndentBlanklineToggle[!] *IndentBlanklineToggle*
Toggles between |IndentBlanklineEnable| and |IndentBlanklineDisable|.
With bang (IndentBlanklineToggle!) toggles globally
==============================================================================
6. LICENSE *indent-blankline-license*
The MIT Licence
http://www.opensource.org/licenses/mit-license.php
Copyright (c) 2023 Lukas Reineke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
==============================================================================
vim:tw=78:ts=8:ft=help:norl
|