echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.74k stars 179 forks source link

A way to disable default mini.starter keybinds #831

Closed prescientmoon closed 4 months ago

prescientmoon commented 4 months ago

Contributing guidelines

Module(s)

mini.starter

Description

A lot of people use C-p in order to bring up the telescope file picker, which conflicts with the buffer-local mapping introduced by mini.starter. I tried looking through the help file, but couldn't find a way to remove said keybind. Is there a way to do this?

echasnovski commented 4 months ago

Yes, there is a way to do this. All special keys are implemented as buffer local mappings. Users can use special MiniStarterOpened even to delete mappings they don't like inside an autocommand. With something like this:

require('mini.starter').setup()
local disable_ctrl_np = function()
  vim.keymap.del('n', '<C-n>', { buffer = true })
  vim.keymap.del('n', '<C-p>', { buffer = true })
end
vim.api.nvim_create_autocmd('User', { pattern = 'MiniStarterOpened', callback = disable_ctrl_np })