summaryrefslogtreecommitdiffstats
path: root/.config/nvim/autoload/bukutagcomplete.vim
blob: c1731b5d2e5dc30d8b24a2c450aae64b8b1e1154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function! bukutagcomplete#Complete(findstart, base)
   if a:findstart == 1
      let line = getline('.')
      let idx = col('.')
      while idx > 0
         let idx -= 1
         let c = line[idx]
         if c == ','
            return idx + 2
         else
            continue
         endif
      endwhile
      return idx
   else
       return split(system('buku --stag --np | pcregrep -o1 " ([a-zA-Z ]+) (?=\()" | grep ' . a:base), '\n')
   endif
endfunction