···135135136136API *artio-api*
137137138138-artio.resume() *artio-resume*
138138+artio.pick({opts}) *artio.pick()*
139139+140140+ create a new picker |artio.Picker| and start it.
141141+142142+ >lua
143143+ artio.pick({
144144+ items = { 'a', 'b', 'c' },
145145+ fn = artio.sorter,
146146+ })
147147+ <
148148+149149+artio.generic({items}, {props}) *artio.generic()*
150150+151151+ creates a generic picker from the given items and props.
152152+ uses the default |artio.sorter| function.
153153+154154+ *artio.select()*
155155+artio.select({items}, {opts}, {on_choice}, {start_opts?})
156156+157157+ the |vim.ui.select| interface implemented for artio.
158158+ adds an optional `{start_opts?}` argument that accepts artio specific
159159+ options.
160160+161161+artio.resume() *artio.resume()*
139162140163 resume the last closed picker. does not work across neovim
141164 restarts/sessions.
142165143166 Plug: `<Plug>(artio-resume)`.
167167+168168+API-PICKER *artio-api-picker*
169169+170170+*artio.Picker*
171171+ a picker is a special table that holds the state of the picker.
172172+ the current active picker is stored in
173173+ `require('artio.picker').active_picker`.
174174+175175+ Fields: ~
176176+ - {items} (`artio.Picker.item[]|string[]`)
177177+ array of |artio.Picker.item| or strings. an array of
178178+ strings will be converted to items.
179179+ - {fn} (`artio.Picker.sorter`)
180180+ an instance of |artio.Picker.sorter|.
181181+ - {on_close} (`fun(text: string, idx: integer)`)
182182+ callback function for when the picker closes (after
183183+ accepting a match). gets the `item.text` field as the
184184+ first argument and the item id as the second.
185185+ - {get_items}? (`fun(input: string): artio.Picker.item[]`)
186186+ - {format_item}? (`fun(item: any): string`)
187187+ - {preview_item}? (`fun(item: any): integer, fun(win: integer)`)
188188+ - {get_icon}? (`fun(item: artio.Picker.item): string, string`)
189189+ - {hl_item}? (`fun(item: artio.Picker.item): artio.Picker.hl[]`)
190190+ - {on_quit}? (`fun()`)
191191+ callback function for when the picker closes before
192192+ choosing a match.
193193+ - {prompt}? (`string`)
194194+ text before prompt prefix. can be disabled with
195195+ `config.opts.prompt_title = false`.
196196+ - {defaulttext}? (`string`)
197197+ start input for picker.
198198+ - {prompttext}? (`string`)
199199+ defaults to prompt title combined with prompt prefix.
200200+ - {opts}? (`artio.config.opts`)
201201+ picker options combined with the user config.
202202+ - {win}? (`artio.config.win`)
203203+ picker window options combined with the user config.
204204+ - {actions}? (`table<string, artio.Picker.action>`)
205205+ picker specific actions.
206206+ - {mappings}? (`table<string, string>`)
207207+ mappings from the user config.
208208+209209+API-SORTER *artio-api-sorter*
210210+211211+*artio.Picker.sorter*
212212+ a function that takes an array of |artio.Picker.item| and an input string
213213+ and returns a table of matches |artio.Picker.matches|.
214214+215215+*artio.Picker.matches*
216216+ a table where each key is the id of the item and each value is of
217217+ |artio.Picker.match|.
218218+219219+*artio.Picker.match*
220220+221221+ Fields: ~
222222+ - {1} (`integer`)
223223+ id of the item
224224+ - {2} (`any`)
225225+ array of ' matching ' hls. these correspond to chars of the
226226+ `item.text` field. this is based on the output of
227227+ |matchfuzzypos|.
228228+ - {3} (`integer`)
229229+ the score of the match.
230230+231231+*artio.Picker.item*
232232+233233+ Fields: ~
234234+ - {id} (`integer`)
235235+ - {v} (`any`)
236236+ - {text} (`string`)
237237+238238+artio.sorter({items}, {input}) *artio.sorter()*
239239+240240+ the default sorter provides support for pattern matching. a `/.../` match at
241241+ the start of the input will limit the fuzzy sorter to items matching the
242242+ pattern. if you want to use `/.../` in your fuzzy matches, make sure to
243243+ escape it by starting the input with an empty space (` /.../`). fuzzy
244244+ sorting will be done on the input with the pattern removed.
144245145246API-BUILTINS
146247