mirror of
https://github.com/Yggdroot/indentLine.git
synced 2025-12-06 20:24:28 +08:00
fix issue #266
This commit is contained in:
@@ -46,6 +46,12 @@ let g:indentLine_char = 'c'
|
|||||||
```
|
```
|
||||||
where `'c'` can be any ASCII character. You can also use one of `¦`, `┆`, `│`, `⎸`, or `▏` to display more beautiful lines. However, these characters will only work with files whose encoding is UTF-8.
|
where `'c'` can be any ASCII character. You can also use one of `¦`, `┆`, `│`, `⎸`, or `▏` to display more beautiful lines. However, these characters will only work with files whose encoding is UTF-8.
|
||||||
|
|
||||||
|
or
|
||||||
|
```vim
|
||||||
|
let g:indentLine_char_list = ['|', '¦', '┆', '┊']
|
||||||
|
```
|
||||||
|
each indent level has a distinct character.
|
||||||
|
|
||||||
**Change Conceal Behaviour**
|
**Change Conceal Behaviour**
|
||||||
|
|
||||||
This plugin enables the Vim `conceal` feature which automatically hides stretches of text based on syntax highlighting. This setting will apply to all syntax items.
|
This plugin enables the Vim `conceal` feature which automatically hides stretches of text based on syntax highlighting. This setting will apply to all syntax items.
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ let g:indentLine_loaded = 1
|
|||||||
let g:indentLine_newVersion = get(g:,'indentLine_newVersion',v:version > 704 || v:version == 704 && has("patch792"))
|
let g:indentLine_newVersion = get(g:,'indentLine_newVersion',v:version > 704 || v:version == 704 && has("patch792"))
|
||||||
|
|
||||||
let g:indentLine_char = get(g:, 'indentLine_char', (&encoding ==# "utf-8" && &term isnot# "linux" ? '¦' : '|'))
|
let g:indentLine_char = get(g:, 'indentLine_char', (&encoding ==# "utf-8" && &term isnot# "linux" ? '¦' : '|'))
|
||||||
|
let g:indentLine_char_list = get(g:, 'indentLine_char_list', [])
|
||||||
let g:indentLine_first_char = get(g:, 'indentLine_first_char', (&encoding ==# "utf-8" && &term isnot# "linux" ? '¦' : '|'))
|
let g:indentLine_first_char = get(g:, 'indentLine_first_char', (&encoding ==# "utf-8" && &term isnot# "linux" ? '¦' : '|'))
|
||||||
let g:indentLine_indentLevel = get(g:, 'indentLine_indentLevel', 20)
|
let g:indentLine_indentLevel = get(g:, 'indentLine_indentLevel', 20)
|
||||||
let g:indentLine_enabled = get(g:, 'indentLine_enabled', 1)
|
let g:indentLine_enabled = get(g:, 'indentLine_enabled', 1)
|
||||||
@@ -139,8 +140,16 @@ function! s:IndentLinesEnable()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let space = &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth
|
let space = &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth
|
||||||
|
let n = len(g:indentLine_char_list)
|
||||||
|
let level = 0
|
||||||
for i in range(space+1, space * g:indentLine_indentLevel + 1, space)
|
for i in range(space+1, space * g:indentLine_indentLevel + 1, space)
|
||||||
call add(w:indentLine_indentLineId, matchadd('Conceal', '^\s\+\zs\%'.i.'v ', 0, -1, {'conceal': g:indentLine_char}))
|
if n > 0
|
||||||
|
let char = g:indentLine_char_list[level % n]
|
||||||
|
let level += 1
|
||||||
|
else
|
||||||
|
let char = g:indentLine_char
|
||||||
|
endif
|
||||||
|
call add(w:indentLine_indentLineId, matchadd('Conceal', '^\s\+\zs\%'.i.'v ', 0, -1, {'conceal': char}))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -20,16 +20,20 @@ CONFIG *indentLine-config*
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
VARIABLES *indentLine-variables*
|
VARIABLES *indentLine-variables*
|
||||||
|
|
||||||
g:indentLine_loaded *g:loaded_indentLine*
|
|
||||||
Whether load indentLine plugin.
|
|
||||||
Default value is 0.
|
|
||||||
|
|
||||||
g:indentLine_char *g:indentLine_char*
|
g:indentLine_char *g:indentLine_char*
|
||||||
Specify a character to be used as indent line.
|
Specify a character to be used as indent line if
|
||||||
|
|g:indentLine_char_list| is not [].
|
||||||
You also can use other characters:
|
You also can use other characters:
|
||||||
| ¦ ┆ │
|
| ¦ ┆ │
|
||||||
Default value is "|".
|
Default value is "|".
|
||||||
|
|
||||||
|
g:indentLine_char_list *g:indentLine_char_list*
|
||||||
|
Specify a list of characters to be used as indent line for
|
||||||
|
each indent level. If the value is an empty list [], use
|
||||||
|
|g:indentLine_char| instead.
|
||||||
|
e.g., let g:indentLine_char_list = ['|', '¦', '┆', '┊']
|
||||||
|
Default value is [].
|
||||||
|
|
||||||
g:indentLine_setColors *g:indentLine_setColors*
|
g:indentLine_setColors *g:indentLine_setColors*
|
||||||
By default, indentLine will overwrite 'conceal' color.
|
By default, indentLine will overwrite 'conceal' color.
|
||||||
If you want to highlight conceal with your
|
If you want to highlight conceal with your
|
||||||
|
|||||||
Reference in New Issue
Block a user