diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-08 22:31:44 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-08 22:31:44 -0400 |
| commit | 59497d664086c4c7aa24a15a1c3b9ccf718ce9c7 (patch) | |
| tree | fc418ff9dbfd96579ccb897c0f15f47c19894bb6 /lua/telescope/builtin.lua | |
| parent | 7938ace0f6681e5bd5207283036b496416879c67 (diff) | |
feat: Do a bit better sorting for command history
To be honest, I'm not 100% sure this is fantastic, but it's definitely a
step in the right direction for command history.
Closes: #150
Diffstat (limited to 'lua/telescope/builtin.lua')
| -rw-r--r-- | lua/telescope/builtin.lua | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua index 6b51036..c483a7b 100644 --- a/lua/telescope/builtin.lua +++ b/lua/telescope/builtin.lua @@ -79,7 +79,6 @@ builtin.commands = function() entry_maker = function(line) return { valid = line ~= "", - entry_type = make_entry.types.GENERIC, value = line, ordinal = line.name, display = line.name @@ -233,7 +232,6 @@ builtin.lsp_code_actions = function(opts) entry_maker = function(line) return { valid = line ~= nil, - entry_type = make_entry.types.GENERIC, value = line, ordinal = line.idx .. line.title, display = line.idx .. ': ' .. line.title @@ -382,7 +380,7 @@ builtin.command_history = function(opts) local history_list = vim.split(history_string, "\n") local results = {} - for i = 3, #history_list do + for i = #history_list, 3, -1 do local item = history_list[i] local _, finish = string.find(item, "%d+ +") table.insert(results, string.sub(item, finish + 1)) @@ -391,7 +389,7 @@ builtin.command_history = function(opts) pickers.new(opts, { prompt = 'Command History', finder = finders.new_table(results), - sorter = sorters.get_generic_fuzzy_sorter(), + sorter = sorters.fuzzy_with_index_bias(), attach_mappings = function(_, map) map('i', '<CR>', actions.set_command_line) @@ -399,12 +397,8 @@ builtin.command_history = function(opts) -- TODO: Find a way to insert the text... it seems hard. -- map('i', '<C-i>', actions.insert_value, { expr = true }) - -- Please add the default mappings for me for the rest of the keys. return true end, - - -- TODO: Adapt `help` to this. - -- previewer = previewers.cat, }):find() end |
