Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularize theme selection for whichkey's telescope commands #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lua/user/whichkey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ local opts = {
nowait = true, -- use `nowait` when creating keymaps
}

local buffer_theme = "dropdown{previewer = false}"
local find_file_theme = "dropdown{previewer = false}"
local find_text_theme = "ivy{}"

local mappings = {
["a"] = { "<cmd>Alpha<cr>", "Alpha" },
["b"] = {
"<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<cr>",
"<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_" .. buffer_theme .. ")<cr>",
"Buffers",
},
["e"] = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
Expand All @@ -90,10 +94,13 @@ local mappings = {
["c"] = { "<cmd>Bdelete!<CR>", "Close Buffer" },
["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
["f"] = {
"<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>",
"<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_" .. find_file_theme .. ")<cr>",
"Find files",
},
["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
["F"] = {
"<cmd>lua require('telescope.builtin').live_grep(require('telescope.themes').get_" .. find_text_theme .. ")<cr>",
"Find text",
},
["P"] = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" },

p = {
Expand Down