diff --git a/lua/telescope/_extensions/zoxide/list.lua b/lua/telescope/_extensions/zoxide/list.lua index 3390d27..93d1c5c 100644 --- a/lua/telescope/_extensions/zoxide/list.lua +++ b/lua/telescope/_extensions/zoxide/list.lua @@ -60,20 +60,14 @@ local fuzzy_with_z_score_bias = function(opts) end local entry_maker = function(item) - local items = vim.split(string.gsub(item, '^%s*(.-)%s*$', '%1'), " ") - local score = 0 - local item_path = item - - if #items > 1 then - score = tonumber(items[1]) - item_path = items[2] - end + local trimmed = string.gsub(item, '^%s*(.-)%s*$', '%1') + local item_path = string.gsub(trimmed, '^[^%s]* (.*)$', '%1') + local score = tonumber(string.gsub(trimmed, '^([^%s]*) .*$', '%1'), 10) return { - value = item, + value = item_path, ordinal = item_path, - display = item, - + display = item_path, z_score = score, path = item_path } @@ -82,7 +76,6 @@ end local create_mapping = function(prompt_bufnr, mapping_config) return function() local selection = action_state.get_selected_entry() - if mapping_config.before_action ~= nil then mapping_config.before_action(selection) end