vim-fuzzbox/fuzzbox.vim

just a question

Closed this issue · 5 comments

is it easly to create a FuzzyTable ? i want create my Fuzzy for search todo and fixme in code for my vim config https://gitlab.com/nda-cunh/SupraVim

I couldn't add this fuzzy here because it uses my supravim-server binary which parses the project continuously, so I wanted to know how to create a FuzzyTodo, if it's easy to use this plugin's API or not! thank you!

do you have a matrix or a discord to talk about it?

Hi,

While there is no documented public api (yet), you can just use exported autoload functions to create your own selectors, e.g.

myfuzzy.vim

vim9script

import autoload 'fuzzyy/utils/selector.vim'

def Select(wid: number, result: list<any>)
  echom 'You selected: ' .. result[0]
enddef

def Items(): list<any>
  return ['foo', 'bar', 'baz']
enddef

export def Start()
  selector.Start(Items(), {
    select_cb: Select,
    preview: 0
  })
enddef

vimrc

...
import "path/to/myfuzzy.vim"
command! -nargs=0 MyFuzzy call myfuzzy.Start()

This will obviously break if the paths to autoload functions change, their names change, signatures change etc., but as long as you don't go too crazy this probably won't happen very often (but don't quote me on that!).

do you have a matrix or a discord to talk about it?

Not at the moment, sorry, it's a good idea, but I'm not sure there are enough contributors or even users yet for it to be useful. Probably best to track things as github issues for future contributors and users to browse for now.

Thank my duzzy work good :)

Image

can i add a title to my fuzzy or not ? :) you can close the issue if you want

can i add a title to my fuzzy or not ?

Yes, selector.Start() returns a dict of the window ids, which you can use to set the title option for a window, e.g.

export def Start()
  var wids = selector.Start(Items(), {
    select_cb: Select,
    preview: 0
  })
  popup_setoptions(wids.prompt, { title: 'My Fuzzy' })
enddef

btw, you can make this a little prettier by using the popup border chars to indent to line up with the prompt, e.g.

popup_setoptions(wids.prompt, { title: '─ My Fuzzy ' })