@@ -91,29 +91,31 @@ B.gh_issues = function(opts)
9191 print (" Empty " .. title )
9292 return
9393 end
94- pickers .new (opts , {
95- prompt_title = title ,
96- finder = finders .new_table {
97- results = results ,
98- entry_maker = make_entry .gen_from_string (opts ),
99- },
100- previewer = previewers .new_termopen_previewer {
101- get_command = function (entry )
102- local tmp_table = vim .split (entry .value , " \t " )
103- if vim .tbl_isempty (tmp_table ) then
104- return { " echo" , " " }
105- end
106- return { " gh" , " issue" , " view" , tmp_table [1 ] }
94+ pickers
95+ .new (opts , {
96+ prompt_title = title ,
97+ finder = finders .new_table {
98+ results = results ,
99+ entry_maker = make_entry .gen_from_string (opts ),
100+ },
101+ previewer = previewers .new_termopen_previewer {
102+ get_command = function (entry )
103+ local tmp_table = vim .split (entry .value , " \t " )
104+ if vim .tbl_isempty (tmp_table ) then
105+ return { " echo" , " " }
106+ end
107+ return { " gh" , " issue" , " view" , tmp_table [1 ] }
108+ end ,
109+ },
110+ sorter = conf .file_sorter (opts ),
111+ attach_mappings = function (_ , map )
112+ actions .select_default :replace (gh_a .gh_issue_insert )
113+ map (" i" , " <c-t>" , gh_a .gh_web_view " issue" )
114+ map (" i" , " <c-l>" , gh_a .gh_issue_insert_markdown_link )
115+ return true
107116 end ,
108- },
109- sorter = conf .file_sorter (opts ),
110- attach_mappings = function (_ , map )
111- actions .select_default :replace (gh_a .gh_issue_insert )
112- map (" i" , " <c-t>" , gh_a .gh_web_view " issue" )
113- map (" i" , " <c-l>" , gh_a .gh_issue_insert_markdown_link )
114- return true
115- end ,
116- }):find ()
117+ })
118+ :find ()
117119 end )
118120end
119121
@@ -128,31 +130,33 @@ B.gh_pull_request = function(opts)
128130 print (" Empty " .. title )
129131 return
130132 end
131- pickers .new (opts , {
132- prompt_title = title ,
133- finder = finders .new_table {
134- results = results ,
135- entry_maker = make_entry .gen_from_string (opts ),
136- },
137- previewer = gh_p .gh_pr_preview .new (opts ),
138- sorter = conf .file_sorter (opts ),
139- attach_mappings = function (_ , map )
140- map (" i" , " <c-e>" , gh_a .gh_pr_v_toggle )
141- -- can't map to <c-m
142- map (" i" , " <c-r>" , gh_a .gh_pr_merge )
143- map (" i" , " <c-t>" , gh_a .gh_web_view " pr" )
144- map (" i" , " <c-a>" , gh_a .gh_pr_approve )
145- map (" i" , " <c-f>" , function (prompt_bufnr )
146- local selection = action_state .get_selected_entry ()
147- actions .close (prompt_bufnr )
148- local pr_number = vim .split (selection .value , " \t " )[1 ]
133+ pickers
134+ .new (opts , {
135+ prompt_title = title ,
136+ finder = finders .new_table {
137+ results = results ,
138+ entry_maker = make_entry .gen_from_string (opts ),
139+ },
140+ previewer = gh_p .gh_pr_preview .new (opts ),
141+ sorter = conf .file_sorter (opts ),
142+ attach_mappings = function (_ , map )
143+ map (" i" , " <c-e>" , gh_a .gh_pr_v_toggle )
144+ -- can't map to <c-m
145+ map (" i" , " <c-r>" , gh_a .gh_pr_merge )
146+ map (" i" , " <c-t>" , gh_a .gh_web_view " pr" )
147+ map (" i" , " <c-a>" , gh_a .gh_pr_approve )
148+ map (" i" , " <c-f>" , function (prompt_bufnr )
149+ local selection = action_state .get_selected_entry ()
150+ actions .close (prompt_bufnr )
151+ local pr_number = vim .split (selection .value , " \t " )[1 ]
149152
150- B .gh_pull_request_files (opts , pr_number )
151- end )
152- actions .select_default :replace (gh_a .gh_pr_checkout )
153- return true
154- end ,
155- }):find ()
153+ B .gh_pull_request_files (opts , pr_number )
154+ end )
155+ actions .select_default :replace (gh_a .gh_pr_checkout )
156+ return true
157+ end ,
158+ })
159+ :find ()
156160 end )
157161end
158162
@@ -174,14 +178,16 @@ B.gh_pull_request_files = function(opts, pr_number)
174178 print (" Empty " .. title )
175179 return
176180 end
177- pickers .new (opts , {
178- prompt_title = title ,
179- finder = finders .new_table {
180- results = results ,
181- entry_maker = make_entry .gen_from_file (),
182- },
183- previewer = conf .file_previewer (opts ),
184- }):find ()
181+ pickers
182+ .new (opts , {
183+ prompt_title = title ,
184+ finder = finders .new_table {
185+ results = results ,
186+ entry_maker = make_entry .gen_from_file (),
187+ },
188+ previewer = conf .file_previewer (opts ),
189+ })
190+ :find ()
185191 end )
186192end
187193
@@ -196,23 +202,25 @@ B.gh_gist = function(opts)
196202 print (" Empty " .. title )
197203 return
198204 end
199- pickers .new (opts , {
200- prompt_title = title ,
201- finder = finders .new_table {
202- results = results ,
203- entry_maker = gh_e .gen_from_gist (opts ),
204- },
205- previewer = gh_p .gh_gist_preview .new (opts ),
206- sorter = conf .file_sorter (opts ),
207- attach_mappings = function (_ , map )
208- actions .select_default :replace (gh_a .gh_gist_append )
209- map (" i" , " <c-t>" , gh_a .gh_web_view " gist" )
210- map (" i" , " <c-e>" , gh_a .gh_gist_edit )
211- map (" i" , " <c-d>" , gh_a .gh_gist_delete )
212- map (" i" , " <c-n>" , gh_a .gh_gist_create )
213- return true
214- end ,
215- }):find ()
205+ pickers
206+ .new (opts , {
207+ prompt_title = title ,
208+ finder = finders .new_table {
209+ results = results ,
210+ entry_maker = gh_e .gen_from_gist (opts ),
211+ },
212+ previewer = gh_p .gh_gist_preview .new (opts ),
213+ sorter = conf .file_sorter (opts ),
214+ attach_mappings = function (_ , map )
215+ actions .select_default :replace (gh_a .gh_gist_append )
216+ map (" i" , " <c-t>" , gh_a .gh_web_view " gist" )
217+ map (" i" , " <c-e>" , gh_a .gh_gist_edit )
218+ map (" i" , " <c-d>" , gh_a .gh_gist_delete )
219+ map (" i" , " <c-n>" , gh_a .gh_gist_create )
220+ return true
221+ end ,
222+ })
223+ :find ()
216224 end )
217225end
218226
@@ -226,22 +234,24 @@ B.gh_secret = function(opts)
226234 print (" Empty " .. title )
227235 return
228236 end
229- pickers .new (opts , {
230- prompt_title = title ,
231- finder = finders .new_table {
232- results = results ,
233- entry_maker = gh_e .gen_from_secret (opts ),
234- },
235- previewer = gh_p .gh_secret_preview .new (opts ),
236- sorter = conf .file_sorter (opts ),
237- attach_mappings = function (_ , map )
238- actions .select_default :replace (gh_a .gh_secret_append )
239- map (" i" , " <c-e>" , gh_a .gh_secret_set )
240- map (" i" , " <c-n>" , gh_a .gh_secret_set_new )
241- map (" i" , " <c-d>" , gh_a .gh_secret_remove )
242- return true
243- end ,
244- }):find ()
237+ pickers
238+ .new (opts , {
239+ prompt_title = title ,
240+ finder = finders .new_table {
241+ results = results ,
242+ entry_maker = gh_e .gen_from_secret (opts ),
243+ },
244+ previewer = gh_p .gh_secret_preview .new (opts ),
245+ sorter = conf .file_sorter (opts ),
246+ attach_mappings = function (_ , map )
247+ actions .select_default :replace (gh_a .gh_secret_append )
248+ map (" i" , " <c-e>" , gh_a .gh_secret_set )
249+ map (" i" , " <c-n>" , gh_a .gh_secret_set_new )
250+ map (" i" , " <c-d>" , gh_a .gh_secret_remove )
251+ return true
252+ end ,
253+ })
254+ :find ()
245255 end )
246256end
247257
@@ -266,22 +276,24 @@ B.gh_run = function(opts)
266276 print (" Empty " .. title )
267277 return
268278 end
269- pickers .new (opts , {
270- prompt_title = title ,
271- finder = finders .new_table {
272- results = results ,
273- entry_maker = gh_e .gen_from_run (opts ),
274- },
275- previewer = gh_p .gh_run_preview .new (opts ),
276- sorter = conf .file_sorter (opts ),
277- attach_mappings = function (_ , map )
278- map (" i" , " <c-r>" , gh_a .gh_run_rerun )
279- map (" i" , " <c-t>" , gh_a .gh_run_web_view )
280- map (" i" , " <c-a>" , gh_a .gh_run_cancel )
281- actions .select_default :replace (gh_a .gh_run_view_log (opts ))
282- return true
283- end ,
284- }):find ()
279+ pickers
280+ .new (opts , {
281+ prompt_title = title ,
282+ finder = finders .new_table {
283+ results = results ,
284+ entry_maker = gh_e .gen_from_run (opts ),
285+ },
286+ previewer = gh_p .gh_run_preview .new (opts ),
287+ sorter = conf .file_sorter (opts ),
288+ attach_mappings = function (_ , map )
289+ map (" i" , " <c-r>" , gh_a .gh_run_rerun )
290+ map (" i" , " <c-t>" , gh_a .gh_run_web_view )
291+ map (" i" , " <c-a>" , gh_a .gh_run_cancel )
292+ actions .select_default :replace (gh_a .gh_run_view_log (opts ))
293+ return true
294+ end ,
295+ })
296+ :find ()
285297 end )
286298end
287299
0 commit comments