mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-08 18:45:13 +00:00
improve mbox telescope picker sorter
This commit is contained in:
parent
17df485e19
commit
f1e339d720
|
@ -44,13 +44,18 @@ function! s:native_picker(mboxes)
|
||||||
call himalaya#mbox#post_input(a:mboxes[choice])
|
call himalaya#mbox#post_input(a:mboxes[choice])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:pickers = {"telescope": function("s:telescope_picker"), "fzf": function("s:fzf_picker"), "native": function("s:native_picker")}
|
let s:pickers = {
|
||||||
|
\"telescope": function("s:telescope_picker"),
|
||||||
|
\"fzf": function("s:fzf_picker"),
|
||||||
|
\"native": function("s:native_picker"),
|
||||||
|
\}
|
||||||
|
|
||||||
function! himalaya#mbox#input()
|
function! himalaya#mbox#input()
|
||||||
try
|
try
|
||||||
let mboxes = map(s:cli("mailboxes", [], "Fetching mailboxes", 0), "v:val.name")
|
let mboxes = map(s:cli("mailboxes", [], "Fetching mailboxes", 0), "v:val.name")
|
||||||
|
|
||||||
if exists("g:himalaya_mailbox_picker") " Get user choice for picker, otherwise check runtimepath
|
" Get user choice for picker, otherwise check runtimepath
|
||||||
|
if exists("g:himalaya_mailbox_picker")
|
||||||
let mbox_picker = g:himalaya_mailbox_picker
|
let mbox_picker = g:himalaya_mailbox_picker
|
||||||
else
|
else
|
||||||
if &rtp =~ "telescope"
|
if &rtp =~ "telescope"
|
||||||
|
|
|
@ -40,7 +40,7 @@ M.mbox_picker = function(mboxes)
|
||||||
pickers.new {
|
pickers.new {
|
||||||
results_title = 'Mailboxes',
|
results_title = 'Mailboxes',
|
||||||
finder = finders.new_table(finder_opts),
|
finder = finders.new_table(finder_opts),
|
||||||
sorter = sorters.fuzzy_with_index_bias(),
|
sorter = sorters.get_generic_fuzzy_sorter(),
|
||||||
attach_mappings = function(prompt_bufnr)
|
attach_mappings = function(prompt_bufnr)
|
||||||
actions.select_default:replace(function()
|
actions.select_default:replace(function()
|
||||||
local selection = action_state.get_selected_entry()
|
local selection = action_state.get_selected_entry()
|
||||||
|
|
Loading…
Reference in a new issue