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

How to unmap default mappings for Telescope plugin? #2825

Closed
LinuxIsCool opened this issue May 7, 2024 · 6 comments
Closed

How to unmap default mappings for Telescope plugin? #2825

LinuxIsCool opened this issue May 7, 2024 · 6 comments

Comments

@LinuxIsCool
Copy link

How can I unmap these keys?

map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "telescope live grep" })

In previous nvchad I had in mappings.lua:

---@type MappingsTable
local M = {}

M.disabled = {
  n = {
    ["<leader>f"] = "",
    ["<leader>ff"] = "",
    ["<leader>fg"] = "",
    ["<leader>fb"] = "",
    ["<leader>fh"] = "",
    ["<leader>fa"] = "",
    ["<leader>fm"] = "",
    ["<leader>fo"] = "",
    ["<leader>fw"] = "",
    ["<leader>fz"] = "",
  },
}
return M

Now I'm trying in mappings.lua:

require "nvchad.mappings"

-- Disable mappings
local nomap = vim.keymap.del

nomap("n", "<leader>f")
nomap("n", "<leader>fa")
nomap("n", "<leader>fb")
nomap("n", "<leader>ff")
nomap("n", "<leader>fh")
nomap("n", "<leader>fm")
nomap("n", "<leader>fo")
nomap("n", "<leader>fw")
nomap("n", "<leader>fz")

But getting error:

Error executing vim.schedule lua callback: vim/keymap.lua:0: E31: No such mapping
stack traceback:
        [C]: in function 'nvim_del_keymap'
        vim/keymap.lua: in function 'nomap'
        /home/ygg/.config/nvim/lua/mappings.lua:6: in main chunk
        [C]: in function 'require'
        /home/ygg/.config/nvim/init.lua:38: in function </home/ygg/.config/nvim/init.l
ua:37>
@LinuxIsCool
Copy link
Author

Furthermore, how can I simply disable Telescope?

@siduck
Copy link
Member

siduck commented May 8, 2024

check the list of mappins in nvchad first, there is no such mapping as leader f

@siduck siduck closed this as completed May 8, 2024
@LinuxIsCool
Copy link
Author

I don't understand your answer. I linked directly to the mapping.

It's in NvChad/lua/nvchad/mappings.lua

And you can see it with whichkey as well.

@siduck
Copy link
Member

siduck commented May 8, 2024

image

there is no leader f here?

@LinuxIsCool
Copy link
Author

LinuxIsCool commented May 9, 2024

I would like to unmap <leader>f as a prefix, thus I would like to unmap all those mappings that begin with <leader>f.

@siduck
Copy link
Member

siduck commented May 9, 2024

Vim.keymap.Del has nothing to do with prefixes , its which key stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants