summaryrefslogtreecommitdiff
path: root/lua/telescope/config.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-29 22:52:38 -0400
committerGitHub <noreply@github.com>2020-09-29 22:52:38 -0400
commitae7fd0d27a72fa3088e84992eb5040853164dad6 (patch)
tree8b2ecd59ffee6c00fa8fee5f2b570edee5da8724 /lua/telescope/config.lua
parent2ce23696de096733e32135b2f9698a9cca6fdcd4 (diff)
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
Diffstat (limited to 'lua/telescope/config.lua')
-rw-r--r--lua/telescope/config.lua48
1 files changed, 48 insertions, 0 deletions
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 = {
+ ["<C-n>"] = actions.move_selection_next,
+ ["<C-p>"] = actions.move_selection_previous,
+
+ ["<C-c>"] = actions.close,
+
+ ["<Down>"] = actions.move_selection_next,
+ ["<Up>"] = actions.move_selection_previous,
+
+ ["<CR>"] = actions.goto_file_selection_edit,
+ ["<C-x>"] = actions.goto_file_selection_split,
+ ["<C-v>"] = actions.goto_file_selection_vsplit,
+ ["<C-t>"] = actions.goto_file_selection_tabedit,
+
+ ["<C-u>"] = actions.preview_scrolling_up,
+ ["<C-d>"] = actions.preview_scrolling_down,
+
+ -- TODO: When we implement multi-select, you can turn this back on :)
+ -- ["<Tab>"] = actions.add_selection,
+ },
+
+ n = {
+ ["<esc>"] = actions.close,
+ ["<CR>"] = actions.goto_file_selection_edit,
+ ["<C-x>"] = actions.goto_file_selection_split,
+ ["<C-v>"] = actions.goto_file_selection_vsplit,
+ ["<C-t>"] = 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,
+
+ ["<Down>"] = actions.move_selection_next,
+ ["<Up>"] = actions.move_selection_previous,
+
+ ["<C-u>"] = actions.preview_scrolling_up,
+ ["<C-d>"] = actions.preview_scrolling_down,
+ },
+ })
+
+
-- NOT STABLE. DO NOT USE
set("horizontal_config", {
get_preview_width = function(columns, _)