Question: How to disable default mappings
voyeg3r opened this issue · 1 comments
voyeg3r commented
I have created a markdown.lua file at ftplugin/markdown.lua with this:
-- Filename: markdown.lua
-- Last Change: Sun, 07 Aug 2022 11:35:18
vim.opt_local.number = false
vim.opt_local.relativenumber = false
vim.g['loaded_spellfile_plugin'] = 0
vim.opt_local.spell = true
vim.bo.spelllang = 'en_us'
vim.bo.textwidth = 80
vim.opt_local.wrap = true
vim.opt_local.suffixesadd:prepend('.md')
vim.keymap.set('n', ']]', function()
vim.fn.search("^#")
vim.cmd('normal zz')
require('core.utils').flash_cursorline()
end,
{ buffer = true, desc = 'Jump to the next Heading' })
vim.keymap.set('n', '[[', function()
vim.fn.search("^#", "b")
vim.cmd('normal zz')
require('core.utils').flash_cursorline()
end,
{ buffer = true, desc = 'Jump to the previous Heading' })
The I have commented these lines:
-- MkdnNextHeading = {'n', ']]'},
-- MkdnPrevHeading = {'n', '[['},
But when I run: :verbose map ]]
it does not show my description, the mkdflow still maps these keys.
jakewvincent commented
Hi @voyeg3r. Right--commenting out these in the config you pass to the setup function won't work because there's a default config that is overridden with anything you specify in your config. Since commented lines by nature aren't interpreted, the default will apply. Here are two ways you can disable the default mappings:
- Instead of commenting them out, set them to
false
in your mkdnflow config. Since you've specified something explicit, it will override the default mapping. After this, the maps module will take thefalse
as a flag not to map this command. - Alternatively, you can disable the entire maps module (see readme or
:h mkdnflow
). This will prevent any mappings you pass in via the setup function from being applied, and it will also prevent all of the default mappings from being applied, so you'd have to manually specify your mappings elsewhere (e.g. in yourftplugin/markdown.lua
file).