File: help.vim

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (24 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
" Author: w0rp <devw0rp@gmail.com>
" Description: Generic fixer functions for Vim help documents.

function! ale#fixers#help#AlignTags(buffer, lines) abort
    let l:new_lines = []

    for l:line in a:lines
        if len(l:line) != 79
            let l:match = matchlist(l:line, '\v +(\*[^*]+\*)$')

            if !empty(l:match)
                let l:start = l:line[:-len(l:match[0]) - 1]
                let l:tag = l:match[1]
                let l:spaces = repeat(' ', 79 - len(l:start) - len(l:tag))

                let l:line = l:start . l:spaces . l:tag
            endif
        endif

        call add(l:new_lines, l:line)
    endfor

    return l:new_lines
endfunction