Skip to content

Commit b0fa302

Browse files
Merge pull request #1 from macbeth322/add-right_align-option
add right_align option
2 parents 4764873 + 5a02f07 commit b0fa302

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

after/plugin/indentLine.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ let g:indentLine_faster = get(g:, 'indentLine_faster', 0)
3030
let g:indentLine_leadingSpaceChar = get(g:, 'indentLine_leadingSpaceChar', (&encoding ==# "utf-8" && &term isnot# "linux" ? '˰' : '.'))
3131
let g:indentLine_leadingSpaceEnabled = get(g:, 'indentLine_leadingSpaceEnabled', 0)
3232
let g:indentLine_mysyntaxfile = fnamemodify(expand("<sfile>"), ":p:h:h")."/syntax/indentLine.vim"
33+
let g:indentLine_right_align = get(g:, 'indentLine_right_align', 0)
3334

3435
"{{{1 function! s:InitColor()
3536
function! s:InitColor()
@@ -135,14 +136,15 @@ function! s:IndentLinesEnable()
135136

136137
call s:SetConcealOption()
137138

139+
let space = &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth
140+
let space_start = g:indentLine_right_align == 0 ? space + 1 : space * 2
138141
if g:indentLine_showFirstIndentLevel
139-
call add(w:indentLine_indentLineId, matchadd('Conceal', '^ ', 0, -1, {'conceal': g:indentLine_first_char}))
142+
call add(w:indentLine_indentLineId, matchadd('Conceal', '^\s*\zs\%'.(space_start - space).'v ', 0, -1, {'conceal': g:indentLine_first_char}))
140143
endif
141144

142-
let space = &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth
143145
let n = len(g:indentLine_char_list)
144146
let level = 0
145-
for i in range(space+1, space * g:indentLine_indentLevel + 1, space)
147+
for i in range(space_start, space * g:indentLine_indentLevel + 1, space)
146148
if n > 0
147149
let char = g:indentLine_char_list[level % n]
148150
let level += 1

0 commit comments

Comments
 (0)