File tree Expand file tree Collapse file tree 2 files changed +23
-15
lines changed Expand file tree Collapse file tree 2 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ return function()
1010 format_item = function (v )
1111 return v .display
1212 end ,
13- callback = function (v )
14- vim .api .nvim_win_set_cursor (0 , { v .lnum , 0 })
15- end ,
1613 })
1714 end ,
1815 }
Original file line number Diff line number Diff line change @@ -19,19 +19,30 @@ local ut = require "obsidian.picker.util"
1919---
2020M .pick = function (values , opts )
2121 opts = opts or {}
22- vim .ui .select (values , {
23- prompt = opts .prompt_title ,
24- format_item = opts .format_item or function (value )
25- return ut .make_display (value )
26- end ,
27- }, function (item )
28- if opts .callback and item then
29- if type (item ) == " string" then
30- item = { value = item }
22+
23+ if opts .callback then
24+ vim .ui .select (values , {
25+ prompt = opts .prompt_title ,
26+ format_item = opts .format_item or function (value )
27+ return ut .make_display (value )
28+ end ,
29+ }, function (item )
30+ if item then
31+ if type (item ) == " string" then
32+ item = { value = item }
33+ end
34+ opts .callback (item )
3135 end
32- opts .callback (item )
33- end
34- end )
36+ end )
37+ else
38+ -- HACK: all text
39+ values = vim .tbl_map (function (value )
40+ value .text = value .display
41+ return value
42+ end , values )
43+ vim .fn .setqflist (values )
44+ vim .cmd " copen"
45+ end
3546end
3647
3748--- Grep for a string.
You can’t perform that action at this time.
0 commit comments