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

Question: How to disable default mappings #81

Closed
voyeg3r opened this issue Aug 7, 2022 · 1 comment
Closed

Question: How to disable default mappings #81

voyeg3r opened this issue Aug 7, 2022 · 1 comment
Labels
question Further information is requested

Comments

@voyeg3r
Copy link

voyeg3r commented Aug 7, 2022

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
Copy link
Owner

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:

  1. 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 the false as a flag not to map this command.
  2. 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 your ftplugin/markdown.lua file).

@jakewvincent jakewvincent added the question Further information is requested label Aug 7, 2022
@jakewvincent jakewvincent changed the title Commenting default mappings does not work How to disable default mappings Aug 8, 2022
@jakewvincent jakewvincent pinned this issue Aug 30, 2022
@jakewvincent jakewvincent changed the title How to disable default mappings Question: How to disable default mappings Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants