bullets-vim / bullets.vim

🔫 Bullets.vim is a Vim/NeoVim plugin for automated bullet lists.
https://doriankarter.com
Other
485 stars 35 forks source link

[Bug] Disabling default mappings not working Neovim #147

Open Dani-v-tue opened 8 months ago

Dani-v-tue commented 8 months ago

Hello,

When I try to disable custom keymaps and set my own mapping for <cr> it breaks since the keymaps do not get disabled.

for example:

vim.g.bullets_set_mappings = 0
vim.keymap.set('i', '<cr>', 'test')

This remap will work fine in most files, except .md and .txt (that I tested)

The issue resolves itself when I uninstall the plugin.

Does anyone perhaps know what is causing this?

harshad1 commented 7 months ago

That variable does not actually control the various remappings.

All it does is control whether these are set:


  if g:bullets_set_mappings
    " Automatic bullets
    call s:add_local_mapping(1, 'imap', '<cr>', '<Plug>(bullets-newline)')
    call s:add_local_mapping(1, 'inoremap', '<C-cr>', '<cr>')

    call s:add_local_mapping(1, 'nmap', 'o', '<Plug>(bullets-newline)')

    " Renumber bullet list
    call s:add_local_mapping(1, 'vmap', 'gN', '<Plug>(bullets-renumber)')
    call s:add_local_mapping(1, 'nmap', 'gN', '<Plug>(bullets-renumber)')

    " Toggle checkbox
    call s:add_local_mapping(1, 'nmap', '<leader>x', '<Plug>(bullets-toggle-checkbox)')

    " Promote and Demote outline level
    call s:add_local_mapping(1, 'imap', '<C-t>', '<Plug>(bullets-demote)')
    call s:add_local_mapping(1, 'nmap', '>>', '<Plug>(bullets-demote)')
    call s:add_local_mapping(1, 'vmap', '>', '<Plug>(bullets-demote)')
    call s:add_local_mapping(1, 'imap', '<C-d>', '<Plug>(bullets-promote)')
    call s:add_local_mapping(1, 'nmap', '<<', '<Plug>(bullets-promote)')
    call s:add_local_mapping(1, 'vmap', '<', '<Plug>(bullets-promote)')
  end
harshad1 commented 7 months ago

We need to add a proper function to set / unset the various automatic mappings on etc