Skip to content

Commit

Permalink
fix(telescope): Fix keymaps for noice.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKJeff16 committed May 30, 2024
1 parent f30c906 commit 8f80263
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lua/lazy_cfg/telescope/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ local Maps = {
},
}

---@type table<MapModes, RegKeysNamed>
local Names = {
n = {
['<leader>fT'] = { name = '+Telescope' },
['<leader>fTb'] = { name = '+Builtins' },
['<leader>fTe'] = { name = '+Extensions' },
},
}

---@type table<string, TelExtension>
local known_exts = {
['scope'] = { 'scope' },
Expand Down Expand Up @@ -133,25 +142,29 @@ local known_exts = {
['noice'] = {
'noice',
---@type fun(): KeyMapDict
keys = exists('noice') and function()
keys = function()
local Noice = require('noice')

---@type KeyMapDict
local res = {
['<leadec>nl'] = {
['<leader>fTenl'] = {
function()
Noice.cmd('last')
end,
desc('NoiceLast'),
},
['<leadec>nh'] = {
['<leader>fTenh'] = {
function()
Noice.cmd('history')
end,
desc('NoiceHistory'),
},
}

if is_tbl(Names['n']) then
Names['n']['<leader>fTen'] = { name = '+Noice' }
end

return res
end,
},
Expand All @@ -176,15 +189,6 @@ for mod, ext in next, known_exts do
::continue::
end

---@type table<MapModes, RegKeysNamed>
local Names = {
n = {
['<leader>fT'] = { name = '+Telescope' },
['<leader>fTb'] = { name = '+Builtins' },
['<leader>fTe'] = { name = '+Extensions' },
},
}

for mode, t in next, Maps do
if WK.available() then
if is_tbl(Names[mode]) and not empty(Names[mode]) then
Expand Down

0 comments on commit 8f80263

Please sign in to comment.