~gpanders/dotfiles

ref: 5629911cfe9a2fc4e566bab14373aec451244000 dotfiles/vim/.vim/autoload/fzf.vim -rw-r--r-- 1.1 KiB
5629911cGreg Anders Fix bash syntax error in 'note' command 1 year, 9 months ago
                                                                                
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
" Use FZF to find help tags
" Author: Greg Anders
" Date: 2019-05-07

function! fzf#helptags(bang)
    if !exists('*fzf#run')
        echohl ErrorMsg
        echom 'FZF installation not found'
        echohl None
        return
    endif

    let tags = uniq(sort(globpath(&runtimepath, 'doc/tags', 0, 1)))
    call fzf#run(fzf#wrap('Helptags', {
                \ 'source': 'grep -ho "^\S\+" ' . join(tags),
                \ 'sink': 'help',
                \ 'options': '--no-multi',
                \ }, a:bang))
endfunction

function! fzf#tags(bang, query, mod)
    if !exists('*fzf#run')
        echohl ErrorMsg
        echom 'FZF installation not found'
        echohl None
        return
    endif

    let tags = map(taglist('.'), {_, v -> printf('%-40s %-10s %s', v.name, v.kind, v.filename)})
    let options = '--select-1 --no-multi'
    if !empty(a:query)
        let options .= ' --query=' . a:query
    endif

    call fzf#run(fzf#wrap('Tags', {
                \ 'source': tags,
                \ 'sink': {t -> execute(a:mod . 'tag ' . split(t)[0])},
                \ 'options': options,
                \ }, a:bang))
endfunction