From ae7fd0d27a72fa3088e84992eb5040853164dad6 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 29 Sep 2020 22:52:38 -0400 Subject: feat: Add status, better debug, and some associated refactors * [WIP]: Mon 28 Sep 2020 01:08:24 PM EDT * add much much better tracking. so much less hax * status updates, oneshot job updates, etc. * remove temp function * add status function * asdfasdfasdf --- lua/telescope/config.lua | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'lua/telescope/config.lua') diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua index 9b1677e..9c68d05 100644 --- a/lua/telescope/config.lua +++ b/lua/telescope/config.lua @@ -12,6 +12,8 @@ local function first_non_null(...) end end +local actions = require('telescope.actions') + -- TODO: Add other major configuration points here. -- selection_strategy @@ -42,6 +44,8 @@ function config.set_defaults(defaults) set("border", {}) set("borderchars", { '─', '│', '─', '│', '╭', '╮', '╯', '╰'}) + set("get_status_text", function(self) return string.format("%s / %s", self.stats.processed - self.stats.filtered, self.stats.processed) end) + -- Builtin configuration -- List that will be executed. @@ -51,6 +55,50 @@ function config.set_defaults(defaults) -- TODO: Shortenpath -- Decide how to propagate that to all the opts everywhere. + -- TODO: Add motions to keybindings + -- TODO: Add relative line numbers? + set("default_mappings", { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.close, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.goto_file_selection_edit, + [""] = actions.goto_file_selection_split, + [""] = actions.goto_file_selection_vsplit, + [""] = actions.goto_file_selection_tabedit, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + + -- TODO: When we implement multi-select, you can turn this back on :) + -- [""] = actions.add_selection, + }, + + n = { + [""] = actions.close, + [""] = actions.goto_file_selection_edit, + [""] = actions.goto_file_selection_split, + [""] = actions.goto_file_selection_vsplit, + [""] = actions.goto_file_selection_tabedit, + + -- TODO: This would be weird if we switch the ordering. + ["j"] = actions.move_selection_next, + ["k"] = actions.move_selection_previous, + + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + }, + }) + + -- NOT STABLE. DO NOT USE set("horizontal_config", { get_preview_width = function(columns, _) -- cgit v1.2.3